MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PhysicsEngine Class Reference
Collaboration diagram for PhysicsEngine:

Public Member Functions

 PhysicsEngine (ComputationalDomain &comp_domain, InteractionData &interaction_data)
 Constructor for the PhysicsEngine class.
 
void transportPhoton (Photon &photon)
 Transports a photon until an photoelectric interaction occurs or leaves the voxel grid (i.e. terminated).
 
void transportPhotonOneStep (Photon &photon, std::vector< TempSurfaceTallyData > &temp_surface_tally_data_per_photon, std::vector< TempVolumeTallyData > &temp_volume_tally_data_per_photon, std::vector< TempVoxelData > &temp_voxel_data_per_photon)
 Transports photon one step. Either performs a real or delta interaction.
 
void setInteractionType (Photon &photon, Material &material, double total_cross_section)
 Sets the interaction type of the photon.
 
void addVolumeTallies (std::vector< std::unique_ptr< VolumeTally > > &&volume_tallies)
 Sets the volume tallies of the simulation.
 
void addSurfaceTallies (std::vector< std::unique_ptr< SurfaceTally > > &&surface_tallies)
 Sets the surface tallies of the simulation.
 
void initializeVoxelData ()
 Initializes the voxel data for a thread. Exists since omp_max_num_threads() is influenced by previous parallel sections. So, the number of threads that are available does not match the result of omp_get_max_threads().
 
std::vector< VolumeQuantityContainergetVolumeQuantityContainers ()
 Returns the VolumeQuantityContainers of the simulation.
 
std::vector< SurfaceQuantityContainergetSurfaceQuantityContainers ()
 Returns the SurfaceQuantityContainers of the simulation.
 
void addVoxelDataToComputationalDomain ()
 Takes thread local voxel data and adds it to the computational domain. Should be called after all photons have been transported. Not thread safe.
 

Static Public Member Functions

static void processPhotonOutsideVoxelGrid (Photon &photon)
 Processes the domain boundary crossing of a photon by terminating the photon.
 

Private Member Functions

double getFreePath (double max_cross_section)
 Returns the free path length of the photon.
 
bool isDeltaScatter (double cross_section, double max_cross_section)
 Checks if the photon undergoes delta scattering or interacts.
 
void updateTempTallyPerPhoton (std::vector< TempSurfaceTallyData > &temp_surface_tally_data_per_photon, std::vector< TempVolumeTallyData > &temp_volume_tally_data_per_photon, TempSurfaceTallyData &temp_surface_tally_data, TempVolumeTallyData &temp_volume_tally_data)
 Updates the temporary tallies for the photon.
 
void processTallies (std::vector< TempSurfaceTallyData > &temp_surface_tally_data_per_photon, std::vector< TempVolumeTallyData > &temp_volume_tally_data_per_photon, std::vector< TempVoxelData > &temp_voxel_data_per_photon)
 Processes the tallies for the photon.
 

Private Attributes

ComputationalDomaincomp_domain_
 
ProbabilityDist::Uniform uniform_dist_
 
InteractionDatainteraction_data_
 
std::vector< std::vector< std::unique_ptr< VolumeTally > > > thread_local_volume_tallies_
 
std::vector< std::vector< std::unique_ptr< SurfaceTally > > > thread_local_surface_tallies_
 
std::vector< std::vector< TempVoxelData > > thread_local_voxel_data_
 
std::shared_ptr< PhotoelectricEffectphotoelectric_effect_
 
std::shared_ptr< IncoherentScatteringincoherent_scattering_
 
std::shared_ptr< CoherentScatteringcoherent_scattering_
 

Detailed Description

Definition at line 21 of file physics_engine.h.

Constructor & Destructor Documentation

◆ PhysicsEngine()

PhysicsEngine::PhysicsEngine ( ComputationalDomain & comp_domain,
InteractionData & interaction_data )

Constructor for the PhysicsEngine class.

Parameters
comp_domainThe computational domain.
interaction_dataThe interaction data.

Member Function Documentation

◆ addSurfaceTallies()

void PhysicsEngine::addSurfaceTallies ( std::vector< std::unique_ptr< SurfaceTally > > && surface_tallies)

Sets the surface tallies of the simulation.

Parameters
surface_talliesThe surface tallies.

◆ addVolumeTallies()

void PhysicsEngine::addVolumeTallies ( std::vector< std::unique_ptr< VolumeTally > > && volume_tallies)

Sets the volume tallies of the simulation.

Parameters
volume_talliesThe volume tallies.

◆ getFreePath()

double PhysicsEngine::getFreePath ( double max_cross_section)
private

Returns the free path length of the photon.

The free path length is sampled using inverse sampling on the max cross section

Parameters
max_cross_sectionThe max cross section of the photon's current voxel.
Returns
The free path length.

◆ getSurfaceQuantityContainers()

std::vector< SurfaceQuantityContainer > PhysicsEngine::getSurfaceQuantityContainers ( )

Returns the SurfaceQuantityContainers of the simulation.

Returns
A vector of SurfaceQuantityContainers corresponding to each surface tally.

◆ getVolumeQuantityContainers()

std::vector< VolumeQuantityContainer > PhysicsEngine::getVolumeQuantityContainers ( )

Returns the VolumeQuantityContainers of the simulation.

Returns
A vector of VolumeQuantityContainers corresponding to each volume tally.

◆ isDeltaScatter()

bool PhysicsEngine::isDeltaScatter ( double cross_section,
double max_cross_section )
private

Checks if the photon undergoes delta scattering or interacts.

Parameters
cross_sectionThe total cross section of the photon's current material.
max_cross_sectionThe max total cross section of all the materials in the computation domain.
Returns
True if the photon undergoes delta scattering, false if it interacts.

◆ processPhotonOutsideVoxelGrid()

static void PhysicsEngine::processPhotonOutsideVoxelGrid ( Photon & photon)
static

Processes the domain boundary crossing of a photon by terminating the photon.

Parameters
photonThe photon to process.

◆ processTallies()

void PhysicsEngine::processTallies ( std::vector< TempSurfaceTallyData > & temp_surface_tally_data_per_photon,
std::vector< TempVolumeTallyData > & temp_volume_tally_data_per_photon,
std::vector< TempVoxelData > & temp_voxel_data_per_photon )
private

Processes the tallies for the photon.

Parameters
temp_surface_tally_data_per_photon
temp_volume_tally_data_per_photon
temp_voxel_data_per_photon

◆ setInteractionType()

void PhysicsEngine::setInteractionType ( Photon & photon,
Material & material,
double total_cross_section )

Sets the interaction type of the photon.

The interaction type is either photoelectric, coherent, or incoherent. This is determined by sampling the ratios of interaction cross sections to the total cross section.

Parameters
photonThe photon to set the interaction type for.
materialThe material of the photon's current voxel.
total_cross_sectionThe total cross section of the photon's current voxel.

◆ transportPhoton()

void PhysicsEngine::transportPhoton ( Photon & photon)

Transports a photon until an photoelectric interaction occurs or leaves the voxel grid (i.e. terminated).

Parameters
photonThe photon to transport.

◆ transportPhotonOneStep()

void PhysicsEngine::transportPhotonOneStep ( Photon & photon,
std::vector< TempSurfaceTallyData > & temp_surface_tally_data_per_photon,
std::vector< TempVolumeTallyData > & temp_volume_tally_data_per_photon,
std::vector< TempVoxelData > & temp_voxel_data_per_photon )

Transports photon one step. Either performs a real or delta interaction.

This is the heart of simulation. This function uses the delta tracking algorithm to transport the photon to its next interaction. This requires the interaction cross sections and free path length to be sampled.

Parameters
photonThe photon to transport.
temp_surface_tally_data_per_photonStores the surface tally data for the photon.
temp_volume_tally_data_per_photonStores the volume tally data for the photon.
temp_voxel_data_per_photonStores the voxel data for the photon.

◆ updateTempTallyPerPhoton()

void PhysicsEngine::updateTempTallyPerPhoton ( std::vector< TempSurfaceTallyData > & temp_surface_tally_data_per_photon,
std::vector< TempVolumeTallyData > & temp_volume_tally_data_per_photon,
TempSurfaceTallyData & temp_surface_tally_data,
TempVolumeTallyData & temp_volume_tally_data )
private

Updates the temporary tallies for the photon.

Parameters
temp_surface_tally_data_per_photonStores the surface tally data for the photon.
temp_volume_tally_data_per_photonStores the volume tally data for the photon.
temp_surface_tally_dataStores the surface tally data for the photon's current voxel.
temp_volume_tally_dataStores the volume tally data for the photon's current voxel.

Member Data Documentation

◆ coherent_scattering_

std::shared_ptr<CoherentScattering> PhysicsEngine::coherent_scattering_
private

Definition at line 123 of file physics_engine.h.

◆ comp_domain_

ComputationalDomain& PhysicsEngine::comp_domain_
private

Definition at line 115 of file physics_engine.h.

◆ incoherent_scattering_

std::shared_ptr<IncoherentScattering> PhysicsEngine::incoherent_scattering_
private

Definition at line 122 of file physics_engine.h.

◆ interaction_data_

InteractionData& PhysicsEngine::interaction_data_
private

Definition at line 117 of file physics_engine.h.

◆ photoelectric_effect_

std::shared_ptr<PhotoelectricEffect> PhysicsEngine::photoelectric_effect_
private

Definition at line 121 of file physics_engine.h.

◆ thread_local_surface_tallies_

std::vector<std::vector<std::unique_ptr<SurfaceTally> > > PhysicsEngine::thread_local_surface_tallies_
private

Definition at line 119 of file physics_engine.h.

◆ thread_local_volume_tallies_

std::vector<std::vector<std::unique_ptr<VolumeTally> > > PhysicsEngine::thread_local_volume_tallies_
private

Definition at line 118 of file physics_engine.h.

◆ thread_local_voxel_data_

std::vector<std::vector<TempVoxelData> > PhysicsEngine::thread_local_voxel_data_
private

Definition at line 120 of file physics_engine.h.

◆ uniform_dist_

ProbabilityDist::Uniform PhysicsEngine::uniform_dist_
private

Definition at line 116 of file physics_engine.h.


The documentation for this class was generated from the following file: