image source
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(photon) | :: | this | ||||
type(spectrum_t), | intent(in) | :: | spectrum |
Input image to sample position from |
||
type(toml_table), | intent(inout), | optional | :: | dict |
Metadata dictionary |
|
type(seq), | intent(inout), | optional | :: | seqs(2) |
random numbers from a sequence. Quasi-Monte Carlo |
subroutine slm(this, spectrum, dict, seqs) !! image source ! TODO fix hardcoded size of 200 ! investigate +2 error use piecewiseMod use tomlf, only : toml_table, get_value use random, only : ran2, seq use sim_state_mod, only : state use constants, only : TWOPI class(photon) :: this !> Input image to sample position from type(spectrum_t), intent(in) :: spectrum !> Metadata dictionary type(toml_table), optional, intent(inout) :: dict !> random numbers from a sequence. Quasi-Monte Carlo type(seq), optional, intent(inout) :: seqs(2) integer :: cell(3) real(kind=wp) :: x, y this%pos = photon_origin%pos call spectrum%p%sample(x, y) this%pos%x = (x-100) / (state%grid%nxg / (2.*state%grid%xmax)) this%pos%y = (y-100) / (state%grid%nyg / (2.*state%grid%ymax)) this%nxp = photon_origin%nxp this%nyp = photon_origin%nyp this%nzp = photon_origin%nzp this%phi = atan2(this%nyp, this%nxp) this%cosp = cos(this%phi) this%sinp = sin(this%phi) this%cost = this%nzp this%sint = sqrt(1._wp - this%cost**2) this%tflag = .false. this%cnts = 0 this%bounces = 0 this%layer = 1 this%weight = 1.0_wp this%phase = 0.0_wp this%wavelength = 500.e-9_wp this%energy = 1._wp this%fact = TWOPI/(this%wavelength) ! Linear Grid cell = state%grid%get_voxel(this%pos) this%xcell = cell(1) this%ycell = cell(2) this%zcell = cell(3) end subroutine slm