Procedures

ProcedureLocationProcedure TypeDescription
abs vector_class Interface

Overload of the abs intrinsic for a vec3

abs_vec vector_class Function

Calculate the absoulte of a vector elementwise

alloc_array setupMod Subroutine

subroutine allocates allocatable arrays

annulus photonMod Subroutine

annular source

annulus_dect detectors Interface
aperture photonMod Subroutine

sample from square aperture to produce diff pattern

bend sdfModifiers Interface
bend_init sdfModifiers Function

Initialise the Bend modifier for a SDF.

box sdfs Interface

Interface to box SDF initialising function

box_init sdfs Function

Initalising function for Box SDF.

calcNormal sdf_baseMod Function

Calculate the surface normal of a SDF at the point p numerically.

camera detectors Interface
capsule sdfs Interface

Interface to capsule SDF initialising function

capsule_init sdfs Function

Initalising function for capsule SDF.

cart_grid gridMod Interface
check_file writer_mod Function

Functional wrapper around inquire to check if file exits

check_hit_annulus detectors Function

Check if a hitpoint is in the annulus

check_hit_camera detectors Function

Check if a hitpoint is in the camera detector ref

check_hit_circle detectors Function

Check if a hitpoint is in the circle

checkpoint writer_mod Subroutine
circle_dect detectors Interface
circular photonMod Subroutine

circular source

cone sdfs Interface

Interface to cone SDF initialising function

cone_init sdfs Function

Initalising function for Capped Cone SDF.

create_directory setupMod Subroutine

create directories if they don't exist

cylinder sdfs Interface

Interface to cylinder SDF initialising function

cylinder_init sdfs Function

Initalising function for Cylinder SDF.

dealloc_array setupMod Subroutine

deallocate data arrays

decode piecewiseMod Subroutine

Compute the 2 indices from a Morton index Adapted from archer2 cpp course

directory setupMod Subroutine

subroutine defines vars to hold paths to various folders

displacement sdfModifiers Interface
displacement_init sdfModifiers Function

Initialise the displacement modifier for a SDF.

display_settings kernels Subroutine

Displays the settings used in the current simulation run

dslit photonMod Subroutine

sample from double slit to produce diff pattern

egg sdfs Interface

Interface to egg SDF initialising function

egg_init sdfs Function

Initalising function for egg SDF. makes a Moss egg. ref.

elongate sdfModifiers Interface
elongate_init sdfModifiers Function

Initialise the elongate modifier for a SDF.

eval_bend sdfModifiers Function

Evaluation function for Bend modifier.

eval_disp sdfModifiers Function

Evaluation function for displacement modifier.

eval_elongate sdfModifiers Function

Evaluation function for Elongate modifier.

eval_extrude sdfModifiers Function

Evaluation function for Extrude modifier.

eval_model sdf_baseMod Function

Evaluate the model

eval_onion sdfModifiers Function

Evaluation function for Onion modifier.

eval_repeat sdfModifiers Function

Evaluation function for Repeat modifier.

eval_revolution sdfModifiers Function

Evaluation function for Revolution modifier.

eval_twist sdfModifiers Function

Evaluation function for Twist modifier.

evaluate_box sdfs Function

Evaluation function for Box SDF.

evaluate_capsule sdfs Function

Evaluation function for Capsule SDF.

evaluate_cone sdfs Function

Evaluation function for Cone SDF.

evaluate_cylinder sdfs Function

Evaluation function for Cylinder SDF.

evaluate_egg sdfs Function

Evaluation function for Egg SDF. ref

evaluate_plane sdfs Function

Evaluation function for Plane SDF.

evaluate_segment sdfs Function

Evaluation function for Segment SDF.

evaluate_sphere sdfs Function

Evaluation function for Sphere SDF.

evaluate_torus sdfs Function

Evaluation function for Torus SDF.

evaluate_triprism sdfs Function

Evaluation function for Triprisim SDF.

extrude sdfModifiers Interface
extrude_init sdfModifiers Function

Initialise the extrude modifier for a SDF.

finalise kernels Subroutine

Routine writes out simulation data, deallocates arrays and prints total runtime

find inttau2 Function

searches for bracketing indices for a value value in an array a

focus photonMod Subroutine
fresnel surfaces Function

calculates the fresnel coefficents

get_new_file_name writer_mod Function

If file exits, get numeral to append to filename

get_vector parse_HelpersMod Function

Vector helper function for parsing toml

get_vessels setupGeometry Function

setup blood vessel scene

get_voxel gridMod Function

get current voxel the photon packet is in

getAlbedo sdf_baseMod Function

Return albedo for the current SDF.

getg2 sdf_baseMod Function

Return factor for the current SDF.

gethgg sdf_baseMod Function

Return g-factor for the current SDF.

getKappa sdf_baseMod Function

Return for the current SDF

getMua sdf_baseMod Function

Return for the current SDF.

getN sdf_baseMod Function

Return refractive index for the current SDF.

getValue piecewiseMod Subroutine

The constant version of sample

handle_annulus_dect parse_detectorsMod Subroutine

Read in Annulus_detector settings and initalise variable

handle_camera parse_detectorsMod Subroutine

Read in Camera settings and initalise variable

handle_circle_dect parse_detectorsMod Subroutine

Read in Circle_detector settings and initalise variable

histempty_fn historyStack Function
histfinish_sub historyStack Subroutine
history_stack_t historyStack Interface
histpeek_fn historyStack Function
histpop_fn historyStack Function
histpush_sub historyStack Subroutine
histwrite_sub historyStack Subroutine
histzero_sub historyStack Subroutine
hit_init detector_mod Function
hit_t detector_mod Interface
identity sdfHelpers Function

Returns the identity transformation matrix

init_annulus_dect detectors Function

Initalise Annular detector

init_camera detectors Function

Initalise Camera detector

init_circle_dect detectors Function

Initalise Circle detector

init_grid gridMod Function

setup grid

init_historyStack historyStack Function
init_mono opticalProperties Function
init_photon photonMod Function

set up all the variables in the photon object

init_piecewise1D piecewiseMod Function

initalise the piecewise1D type with an array size (n, 2). Calculates the CDF of this array. Input array

init_piecewise2D piecewiseMod Function

Initalise the piecewise2D type with a given cell_width, cell_height and input image

init_rng random Subroutine

initiate RNG state with reproducible state

init_source photonMod Function

Bind emission function to photon object

init_spectral opticalProperties Function
init_vec4_vector_real vec4_class Function

Initalise vec4 from a vec3 and Scalar e.g vec4 = [vec3%x, vec3%y, vec3%z, scalar]

intersectCircle geometry Function

ref

intersectCone geometry Function

calculates where a line, with origin:orig and direction:dir hits a cone, radius:radius and height:height with centre:centre. centre is the point under the apex at the cone's base. returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel and pbrt need to check z height after moving ray if not this is an infinte cone cone lies height ways along z-axis

intersectCylinder geometry Function

calculates where a line, with origin:orig and direction:dir hits a cylinder, centre:centre and radius:radius This solves for an infinitely long cylinder centered on the z axis with radius radius returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel need to check z height after moving ray if not this is an infinite cylinder

intersectEllipse geometry Function

calculates where a line, with origin:orig and direction:dir hits a ellipse, centre:centre and axii:semia, semib returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel and pbrt need to check z height after moving ray if not this is an infinte ellipse-cylinder ellipse lies length ways along z-axis semia and semib are the semimajor axis which are the half width and height.

intersection sdfModifiers Function

Intersection operator. Returns the intersection of two SDFs.

intersectPlane geometry Function

ref

intersectSphere geometry Function

calculates where a line, with origin:orig and direction:dir hits a sphere, centre:centre and radius:radius returns true if intersection exists returns t, the paramertised parameter of the line equation adapted from scratchapixel

invert mat_class Function

Performs a direct calculation of the inverse of a 4×4 matrix. from http://fortranwiki.org/fortran/show/Matrix+inversion

json_writer historyStack Subroutine
length vector_class Function

Returns the length of a vec3

length vec4_class Function

Returns the length of a vec4

magnitude vector_class Function

Returns the magnitude of a vec3

magnitude_fn vec4_class Function

Returns the magnitude of a vec4

mat mat_class Interface

Intalise Matrix with 1D Array

mat_add_scal mat_class Function

Matrix + Scalar = Matrix

mat_div_scal mat_class Function

Matrix / scalar

mat_init mat_class Function

Initalise matrix type from 1D array

mat_minus_scal mat_class Function

Matrix - Scalar

mat_mult_mat mat_class Function

Matrix * vec4

mat_mult_scal mat_class Function

Matrix * Scalar

max vector_class Interface

Overload of the max intrinsic for a vec3

max_vec vector_class Function

Get the max value elementwise between a vec3 and a scalar

maxval_vec vector_class Function

Get the max value in a vec3

min vector_class Interface

Overload of the min intrinsic for a vec3

min_vec vector_class Function

Get the min value elementwise between a vec3 and a scalar

minval_vec vector_class Function

Get the min value in a vec3

model sdf_baseMod Interface
model_init sdf_baseMod Function

Initalise the model type.

mono opticalProperties Interface
next random Function
nextpwr2 piecewiseMod Function

Get the next power of 2. i.e given 5 will return 8 (4^2) only works on 32bit ints ref

nint vector_class Interface

Overload of the nint intrinsic for a vec3

nint_vec vector_class Function

Overload the nint intrinsic for a vec3 elementwise

normalise_fluence writer_mod Subroutine

normalise fluence in the Lucy 1999 way

nrrd_write writer_mod Interface
obj_writer historyStack Subroutine
onion sdfModifiers Interface
onion_init sdfModifiers Function

Initialise the Onion modifier for a SDF.

opticalProp_t opticalProperties Interface
opticalProp_t_assign opticalProperties Subroutine
opticaProp_new opticalProperties Function
pack_bits piecewiseMod Function

Reverse the split function. I.e go from 0a0b0c0d to abcd Adapted from archer2 cpp course

parse_detectors parse_detectorsMod Subroutine

parse the detectors

parse_geometry parse_mod Subroutine

parse geometry information

parse_grid parse_mod Subroutine

parse grid input data

parse_output parse_mod Subroutine

parse output file information

parse_params parse_mod Subroutine

entry point for parsing toml file

parse_simulation parse_mod Subroutine

parse simulation information

parse_source parse_sourcesMod Subroutine

Parse sources any updates here MUST be reflected in docs/config.md

parse_spectrum parse_SpectrumMod Subroutine

Parse spectrums to be used

pathlength_scatter kernels Subroutine
pencil photonMod Subroutine

pencil beam source

photon photonMod Interface
piecewise1D piecewiseMod Interface
piecewise2D piecewiseMod Interface
plane sdfs Interface

Interface to plane SDF initialising function

plane_init sdfs Function

Initalising function for plane SDF.

ply_writer historyStack Subroutine
point photonMod Subroutine

isotropic point source

ran2 random Function

wrapper for call random number

randint random Function

sample a random integer between [a, b]

rang random Subroutine

sample a 2D Guassian distribution

ranu random Function

uniformly sample in range[a, b)

raw_write writer_mod Interface
record_hit_1D_sub detector_mod Subroutine

check if a hit is on the detector and record it if so

record_hit_2D_sub detector_mod Subroutine

check if a hit is on the detector and record it if so

reflect surfaces Subroutine

get vector of reflected photon

reflect_refract surfaces Subroutine

wrapper routine for fresnel calculation

refract surfaces Subroutine

get vector of refracted photon

render sdf_baseMod Interface
render_sub sdf_baseMod Subroutine

Render the SDFs onto a voxel grid

render_vec sdf_baseMod Subroutine

Render the SDF Wrapper around the render function to allow ease of use

repeat sdfModifiers Interface
repeat_init sdfModifiers Function

Initialise the Repeat modifier for a SDF.

revolution sdfModifiers Interface
revolution_init sdfModifiers Function

Initialise the Revolution modifier for a SDF.

rotate_x sdfHelpers Function

rotation in the x-axis function from here

rotate_y sdfHelpers Function

rotation in the y-axis function from here

rotate_z sdfHelpers Function

rotation in the z-axis function from here

rotationAlign sdfHelpers Function

Calculate the rotation matrix to rotate vector a onto b ref1 ref2

rotmat sdfHelpers Function

Rotate around around an axis by a given angle taken from here

sample1D piecewiseMod Subroutine

Randomly sample from 1D array

sample2D piecewiseMod Subroutine
scal_add_mat mat_class Function

Scaler + Matrix

scal_add_vec vector_class Function

vec3 + scalar

scal_add_vec vec4_class Function

Elementwise scalar + vec4

scal_minus_vec vector_class Function

scalar - vec3

scal_minus_vec vec4_class Function

Elementwise Scalar - vec4

scal_mult_mat mat_class Function

Matrix * Scalar

scal_mult_vec vector_class Function

Scalar * vec3 elementwise

scal_mult_vec vec4_class Function

Elementwise Scalar * vec4

scatter photonMod Subroutine

Scattering routine. Implments both isotropic and henyey-greenstein scattering taken from mcxyz

sdf sdf_baseMod Interface
sdf_assign sdf_baseMod Subroutine

sdf initializer

sdf_evaluate sdf_baseMod Function

Evaluate the SDF at a given position.

sdf_new sdf_baseMod Function

sdf initializer

search_1D piecewiseMod Subroutine

search by bisection for 1D array

search_2D piecewiseMod Subroutine

search by bisection for 1D array

segment sdfs Interface

Interface to segment SDF initialising function

segment_init sdfs Function

Initalising function for segment SDF. Note this is a 2D function

set_photon photonMod Subroutine
setup kernels Subroutine

setup simulation by reading in setting file, and setup variables to be used.

setup_egg setupGeometry Function

setup an egg, with yolk, albumen and shell

setup_exp setupGeometry Function

Setup experimental geometry from Georgies paper. i.e a glass bottle with contents

setup_logo setupGeometry Function

setup uni crest geometry

setup_omg_sdf setupGeometry Function

setup OMG scene

setup_scat_test setupGeometry Function

set up scattering test scene with user defined tau

setup_scat_test2 setupGeometry Function

set up scattering test scene 2 with user defined tau and hgg

setup_simulation setupMod Subroutine

Read in parameters Setup up various simulation parameters and routines

setup_sphere setupGeometry Function

setup the sphere test case from tran and jacques paper.

setup_sphere_scene setupGeometry Function

setup a test scene with user defined spheres

sin vec4_class Interface

Vec4 overload of the sin intrinsic

sin_vec vec4_class Function

Sine of a vec4, elementwise

skewSymm sdfHelpers Function

Calculate the Skew Symmetric matrix for a given vector

slm photonMod Subroutine

image source

SmoothUnion sdfModifiers Function

Smooth union. Joins two SDFs together smoothly

solveQuadratic geometry Function

solves quadratic equation given coeffs a, b, and c returns true if real solution returns x0 and x1 adapted from scratchapixel

spectral opticalProperties Interface
sphere sdfs Interface
sphere_init sdfs Function

Initalising function for Sphere SDF.

subtraction sdfModifiers Function

Subtraction operator. Takes one SDF from another. Take the first SDF from the 2nd SDF

tauint2 inttau2 Subroutine

optical depth integration subroutine Moves photons to interaction location Calculated is any reflection or refraction happens whilst moving

test_kernel kernels Subroutine
torus sdfs Interface

Interface to torus SDF initialising function

torus_init sdfs Function

Initalising function for Torus SDF.

translate sdfHelpers Function

Returns the Translation matrix for a given vector translation.

triprism sdfs Interface

Interface to triprisim SDF initialising function

triprism_init sdfs Function

Initalising function for triprisim SDF.

twist sdfModifiers Interface
twist_init sdfModifiers Function

Initialise the twist modifier for a SDF.

uniform photonMod Subroutine

uniformly illuminate a surface of the simulation media

union sdfModifiers Function

Union operation. Joins two SDFs together

update_grids inttau2 Subroutine

record fluence using path length estimators. Uses voxel grid

update_opticalProp_t opticalProperties Subroutine
update_pos inttau2 Subroutine

routine that updates positions of photon and calls Fresnel routines if photon leaves current voxel

update_voxels inttau2 Subroutine

updates the current voxel based upon position

updateMono opticalProperties Subroutine
updateSpectral opticalProperties Subroutine
vec4 vec4_class Interface

Initalise a vec4 from a vec3 and a scalar

vec_add_scal vector_class Function

vec3 + scalar

vec_add_scal vec4_class Function

Elementwise vec4 + scalar

vec_add_vec vector_class Function

vec3 + vec3

vec_add_vec vec4_class Function

Elementwise vec4 + vec4

vec_cross_vec vector_class Function

vec3 x vec3

vec_div_scal_int vector_class Function

vec3 / scalar elementwise. Scalar is an integer

vec_div_scal_int vec4_class Function

Elementwise vec4 / Scalar. Scalar is an integer

vec_div_scal_r4 vector_class Function

vec3 / scalar elementwise. Scalar is a 32-bit float

vec_div_scal_r4 vec4_class Function

Elementwise vec4 / Scalar. Scalar is 32-bit float

vec_div_scal_r8 vector_class Function

vec3 / scalar elementwise. Scalar is a 64-bit float

vec_div_scal_r8 vec4_class Function

Elementwise vec4 / Scalar. Scalar is 32-bit float

vec_dot_mat vector_class Function

vec3 . matrix

vec_dot_vec vector_class Function

vec3 . vec3

vec_dot_vec vec4_class Function

dot product between two vec4s

vec_equal_vec vector_class Function

vec3 == vec3

vec_minus_scal vector_class Function

vec3 - scalar

vec_minus_scal vec4_class Function

Elementwise vec4 - scalar

vec_minus_vec vector_class Function

vec3 - vec3

vec_minus_vec vec4_class Function

Elementwise vec4 - vec4

vec_mult_exp_scal_int vector_class Function

vec3**scalar for integer scalar

vec_mult_exp_scal_r4 vector_class Function

vec3**scalar for 32-bit float scalar

vec_mult_exp_scal_r8 vector_class Function

vec3**scalar for 64-bit float scalar

vec_mult_scal vector_class Function

vec3 * scalar elementwise

vec_mult_scal vec4_class Function

Elementwise vec4 * Scalar

vec_mult_vec vector_class Function

vec3 * vec3 elementwise

vec_mult_vec vec4_class Function

Elementwise vec4 * vec4

wall_dist inttau2 Function

funtion that returns distant to nearest wall and which wall that is (x, y, or z)

weight_scatter kernels Subroutine
write_3d_r4_nrrd writer_mod Subroutine

write 3D array of float32's to .nrrd fileformat

write_3d_r4_raw writer_mod Subroutine

write 3D array of float32's to disk as raw binary data

write_3d_r8_nrrd writer_mod Subroutine

write 3D array of float64's to .nrrd fileformat

write_3d_r8_raw writer_mod Subroutine

write 3D array of float64s to disk as raw binary data

write_data writer_mod Subroutine

routine automatically selects which way to write out results based upon file extension

write_detected_photons writer_mod Subroutine
write_hdr writer_mod Subroutine

write out header information for .nrrd file format

zarray setupMod Subroutine

zero data arrays