An open source method of characteristics neutron transport code.
|
The TrackGenerator3D is dedicated to generating and storing Tracks which cyclically wrap across the Geometry in three dimensions. More...
#include "src/TrackGenerator3D.h"
Public Member Functions | |
TrackGenerator3D (Geometry *geometry, int num_azim, int num_polar, double azim_spacing, double z_spacing) | |
Constructor for the TrackGenerator3D assigns default values. More... | |
virtual | ~TrackGenerator3D () |
Destructor frees memory for all Tracks. | |
int | getNumPolar () |
Return the number of polar angles in . More... | |
double | getDesiredZSpacing () |
Return the track polar spacing (cm). More... | |
long | getNumTracks () |
Return the total number of 3D Tracks across the Geometry. More... | |
long | getNumSegments () |
Return the total number of Track segments across the Geometry. More... | |
long | getNum3DTracks () |
Return the total number of 3D Tracks across the Geometry. More... | |
long | getNum3DSegments () |
Return the total number of 3D Track segments across the Geometry. More... | |
Track3D **** | get3DTracks () |
Get the array of 3D Tracks, only used in EXPLICT-3D ray tracing. More... | |
double | getZSpacing (int azim, int polar) |
Returns the spacing between tracks in the axial direction for the requested azimuthal angle index and polar angle index. More... | |
int | getNumRows () |
Returns the number of rows in the temporary segment storage matrix. More... | |
int | getNumColumns () |
Returns the number of columns in the temporary segment storage matrix. More... | |
segment * | getTemporarySegments (int thread_id) |
Returns an array of temporary segments for use in on-the-fly computations. More... | |
Track3D * | getTemporary3DTracks (int thread_id) |
Returns an array of temporary 3D Tracks for use in on-the-fly computations. More... | |
Track ** | getTemporaryTracksArray (int thread_id) |
Returns an array of pointers to temporary Tracks for use in on-the-fly computations. More... | |
int | getNumZ (int azim, int polar) |
Returns the number of 3D Tracks in the z-direction for a given azimuthal angle index and polar angle index. More... | |
int | getNumL (int azim, int polar) |
Returns the number of 3D Tracks in the radial direction for a given azimuthal angle index and polar angle index. More... | |
int *** | getTracksPerStack () |
Returns a 3D array of the number of 3D Tracks in each z-stack. More... | |
int | getMaxNumTracksPerStack () |
Returns the maximum number of tracks in a single stack. More... | |
bool | containsTracks () |
Returns whether or not the TrackGenerator contains Tracks for its current number of azimuthal angles, track spacing and geometry. More... | |
bool | containsSegments () |
Returns whether or not the TrackGenerator contains 3D segments for its current number of azimuthal angles, track spacing and geometry. More... | |
bool | containsTemporaryTracks () |
Returns whether or not the TrackGenerator contains an allocation for temporary Tracks to be filled on-the-fly. | |
long | get3DTrackID (TrackStackIndexes *tsi) |
Returns the 3D Track ID based on its indexes. More... | |
void | convertTCItoTSI (TrackChainIndexes *tci, TrackStackIndexes *tsi) |
Converts TrackChainIndexes to TrackStackIndexes. More... | |
void | convertTSItoTCI (TrackStackIndexes *tsi, TrackChainIndexes *tci) |
Converts TrackStackIndexes to TrackChainIndexes. More... | |
int | getLinkIndex (TrackChainIndexes *tci) |
Returns the index into the chain based on chain indexes. More... | |
int | getNum3DTrackChainLinks (TrackChainIndexes *tci) |
Calculates the number of Tracks in the l-z traversal. More... | |
void | getTSIByIndex (long id, TrackStackIndexes *tsi) |
Updates stack indexes to reflect those from the given Track ID. More... | |
void | getTrackOTF (Track3D *track, TrackStackIndexes *tsi) |
Updates the provided Track with the correct information based on the Track indexes. More... | |
void | setNumPolar (int num_polar) |
Set the number of polar angles in . More... | |
void | setDesiredZSpacing (double spacing) |
Set the suggested track polar spacing (cm). More... | |
void | setSegmentFormation (segmentationType segmentation_type) |
Set the type of segmentation used for segment formation. More... | |
void | setSegmentationZones (std::vector< double > z_mesh) |
Sets the z-planes over which 2D segmentation is performed for on-the-fly calculations. More... | |
void | setLinkingTracks (TrackStackIndexes *tsi, TrackChainIndexes *tci, bool outgoing, Track3D *track) |
Fills the provided 3D Track with its linking information. More... | |
void | setLinkIndex (TrackChainIndexes *tci, TrackStackIndexes *tsi) |
Updates the index into the 3D chain based on chain and stack indexes. More... | |
void | useGlobalZMesh () |
Sets a global z-mesh to use during axial on-the-fly ray tracing. More... | |
void | retrieveTrackCoords (double *coords, long num_tracks) |
Fills an array with the x,y,z coordinates for each Track. More... | |
void | retrieve3DTrackCoords (double *coords, long num_tracks) |
Fills an array with the x,y,z coordinates for each Track. More... | |
void | retrieveGlobalZMesh (double *&z_mesh, int &num_fsrs) |
Provides the global z-mesh and size if available. More... | |
void | retrieveSingle3DTrackCoords (double coords[6], long track_id) |
Fills an array with the x,y,z coordinates for a given track. More... | |
void | retrieveSegmentCoords (double *coords, long num_segments) |
Fills an array with the x,y,z coordinates for each Track segment. More... | |
void | retrieve3DSegmentCoords (double *coords, long num_segments) |
Fills an array with the x,y coordinates for each Track segment. More... | |
void | create3DTracksArrays () |
Allocates memory for 3D Tracks. More... | |
void | checkBoundaryConditions () |
Checks the boundary conditions for all 3D surfaces for inconsistent periodic boundary conditions. | |
Public Member Functions inherited from TrackGenerator | |
TrackGenerator (Geometry *geometry, int num_azim, double azim_spacing) | |
Constructor for the TrackGenerator assigns default values. More... | |
virtual | ~TrackGenerator () |
Destructor frees memory for all Tracks. | |
int | getNumAzim () |
Return the number of azimuthal angles in . More... | |
double | getDesiredAzimSpacing () |
Return the track azimuthal spacing (cm). More... | |
Geometry * | getGeometry () |
Return the Geometry for this TrackGenerator if one has been set. More... | |
long | getNum2DTracks () |
Return the total number of 2D Tracks across the Geometry. More... | |
long | getNum2DSegments () |
Return the total number of 2D Track segments across the Geometry. More... | |
void | countSegments () |
Counts the number of segments for each Track in the Geometry. More... | |
bool | getPeriodic () |
Returns whether periodic boundaries are present in Track generation. More... | |
Track ** | get2DTracksArray () |
Returns an array of the Track pointers by increasing UID. More... | |
Track ** | getTracksArray () |
Returns an array of the Track pointers by increasing UID. More... | |
Track ** | get2DTracks () |
Returns a 2D jagged array of the 2D Tracks. More... | |
FP_PRECISION | getMaxOpticalLength () |
Calculates and returns the maximum optical length for any segment in the Geometry. More... | |
int | getMaxNumSegments () |
Returns the maximum number of segments along a single track. More... | |
int | getNumThreads () |
Returns the number of shared memory OpenMP threads in use. More... | |
int | getNumX (int azim) |
Returns the number of 2D Tracks in the x-direction for a given azimuthal angle index. More... | |
int | getNumY (int azim) |
Returns the number of 2D Tracks in the y-direction for a given azimuthal angle index. More... | |
void | exportFSRVolumes (double *out_volumes, int num_fsrs) |
FSR volumes are copied to an array input by the user. More... | |
void | initializeVolumes () |
Computes the volumes/areas of each Cell and Material in the Geometry. More... | |
void | initializeFSRVolumesBuffer () |
Initialize an array to contain the FSR volumes. | |
FP_PRECISION * | getFSRVolumesBuffer () |
Return the array used to store the FSR volumes. More... | |
FP_PRECISION * | getFSRVolumes () |
Computes and returns an array of volumes indexed by FSR. More... | |
FP_PRECISION | getFSRVolume (long fsr_id) |
Returns the volume of an FSR. More... | |
double | getZCoord () |
Returns the z-coord of the radial plane used in 2D calculations. More... | |
Quadrature * | getQuadrature () |
Returns the Quadrature object. More... | |
FP_PRECISION | retrieveMaxOpticalLength () |
Retrieves the max optical path length of 3D segments for use in on-the-fly computation. More... | |
omp_lock_t * | getFSRLocks () |
Return the array of FSR locks for atomic FSR operations. More... | |
segmentationType | getSegmentFormation () |
Returns the type of ray tracing used for segment formation. More... | |
int | get2DTrackID (int a, int x) |
Get the id of a 2D Track based on its azimuthal angle and index in the azimuthal stack. More... | |
long * | getTracksPerAzim () |
Return the number of tracks for each azimuthal angle. More... | |
void | setNumThreads (int num_threads) |
Sets the number of shared memory OpenMP threads to use (>0). More... | |
void | setNumAzim (int num_azim) |
Set the number of azimuthal angles in . More... | |
void | setDesiredAzimSpacing (double spacing) |
Set the suggested azimuthal track spacing (cm). More... | |
void | setGeometry (Geometry *geometry) |
Set a pointer to the Geometry to use for track generation. More... | |
void | setZCoord (double z_coord) |
Sets the z-coord of the radial plane used in 2D calculations. More... | |
void | setQuadrature (Quadrature *quadrature) |
Sets the Quadrature used for integrating the MOC equations. More... | |
void | setMaxOpticalLength (FP_PRECISION tau) |
Sets the max optical path length of 3D segments for use in on-the-fly computation. More... | |
void | setMaxNumSegments (int max_num_segments) |
Sets the maximum number of segments per Track. More... | |
void | setDumpSegments (bool dump_segments) |
Sets a flag to record all segment information in the tracking file. More... | |
void | retrieve2DTrackCoords (double *coords, long num_tracks) |
Fills an array with the x,y,z coordinates for each Track. More... | |
void | retrieve2DSegmentCoords (double *coords, long num_segments) |
Fills an array with the x,y,z coordinates for each Track segment. More... | |
void | generateFSRCentroids (FP_PRECISION *FSR_volumes) |
Generates the numerical centroids of the FSRs. More... | |
void | generateTracks () |
Generates tracks for some number of azimuthal angles and track spacing. More... | |
void | splitSegments (FP_PRECISION max_optical_length) |
Splits Track segments into sub-segments for a user-defined maximum optical length for the problem. More... | |
double | leastCommonMultiple (double a, double b) |
Calculates the least common multiple of two numbers a and b. More... | |
void | dumpSegmentsToFile () |
Writes all Track and segment data to a "*.tracks" binary file. More... | |
bool | readSegmentsFromFile () |
Reads Tracks in from a "*.tracks" binary file. More... | |
void | initializeTrackFileDirectory () |
This method creates a directory to store Track files, and reads in ray tracing data for Tracks and segments from a Track file if one exists. More... | |
void | initializeTracksArray () |
Creates a Track array by increasing uid. More... | |
void | printTimerReport (bool mpi_reduce) |
Print the track generation timer report. More... | |
void | printMemoryReport () |
Print the track generation memory report. | |
Additional Inherited Members | |
Protected Member Functions inherited from TrackGenerator | |
void | initializeTrackReflections () |
Initializes 2D Track reflections. More... | |
Protected Attributes inherited from TrackGenerator | |
int | _num_threads |
int | _num_azim |
double | _azim_spacing |
int | _num_2D_tracks |
int * | _num_x |
int * | _num_y |
long * | _tracks_per_azim |
Track ** | _tracks_2D |
Track ** | _tracks_2D_array |
Geometry * | _geometry |
bool | _use_input_file |
std::string | _tracks_filename |
omp_lock_t * | _FSR_locks |
bool | _contains_2D_tracks |
bool | _contains_2D_segments |
Quadrature * | _quadrature |
double | _z_coord |
bool | _periodic |
segmentationType | _segment_formation |
FP_PRECISION | _max_optical_length |
int | _max_num_segments |
bool | _dump_segments |
bool | _segments_centered |
FP_PRECISION * | _FSR_volumes |
Timer * | _timer |
double | _x_min |
double | _y_min |
double | _z_min |
double | _x_max |
double | _y_max |
double | _z_max |
The TrackGenerator3D is dedicated to generating and storing Tracks which cyclically wrap across the Geometry in three dimensions.
The TrackGenerator creates Track and initializes boundary conditions (vacuum, reflective, or periodic) for each Track in three dimensions.
TrackGenerator3D::TrackGenerator3D | ( | Geometry * | geometry, |
int | num_azim, | ||
int | num_polar, | ||
double | azim_spacing, | ||
double | z_spacing | ||
) |
Constructor for the TrackGenerator3D assigns default values.
geometry | a pointer to a Geometry object |
num_azim | number of azimuthal angles in |
num_polar | number of polar angles in |
azim_spacing | track azimuthal spacing (cm) |
z_spacing | track axial spacing (cm) |
|
virtual |
Returns whether or not the TrackGenerator contains 3D segments for its current number of azimuthal angles, track spacing and geometry.
Reimplemented from TrackGenerator.
|
virtual |
Returns whether or not the TrackGenerator contains Tracks for its current number of azimuthal angles, track spacing and geometry.
Reimplemented from TrackGenerator.
void TrackGenerator3D::convertTCItoTSI | ( | TrackChainIndexes * | tci, |
TrackStackIndexes * | tsi | ||
) |
Converts TrackChainIndexes to TrackStackIndexes.
tci | The TrackChainIndexes of the 3D Track |
tsi | The TrackStackIndexes of the 3D Track to be updated |
void TrackGenerator3D::convertTSItoTCI | ( | TrackStackIndexes * | tsi, |
TrackChainIndexes * | tci | ||
) |
Converts TrackStackIndexes to TrackChainIndexes.
tsi | The TrackStackIndexes of the 3D Track |
tci | The TrackChainIndexes of the 3D Track to be updated |
void TrackGenerator3D::create3DTracksArrays | ( | ) |
Allocates memory for 3D Tracks.
Before calling this function, the number of tracks per z-stack should be known and initialized in the _tracks_per_stack 3D array
long TrackGenerator3D::get3DTrackID | ( | TrackStackIndexes * | tsi | ) |
Track3D **** TrackGenerator3D::get3DTracks | ( | ) |
Get the array of 3D Tracks, only used in EXPLICT-3D ray tracing.
double TrackGenerator3D::getDesiredZSpacing | ( | ) |
Return the track polar spacing (cm).
This will return the user-specified track spacing and NOT the effective track spacing which is computed and used to generate cyclic tracks.
int TrackGenerator3D::getLinkIndex | ( | TrackChainIndexes * | tci | ) |
Returns the index into the chain based on chain indexes.
tci | The chain indexes |
int TrackGenerator3D::getMaxNumTracksPerStack | ( | ) |
Returns the maximum number of tracks in a single stack.
long TrackGenerator3D::getNum3DSegments | ( | ) |
int TrackGenerator3D::getNum3DTrackChainLinks | ( | TrackChainIndexes * | tci | ) |
Calculates the number of Tracks in the l-z traversal.
tci | The chain indexes |
long TrackGenerator3D::getNum3DTracks | ( | ) |
Return the total number of 3D Tracks across the Geometry.
int TrackGenerator3D::getNumColumns | ( | ) |
Returns the number of columns in the temporary segment storage matrix.
For on-the-fly computation, a matrix of temporary segments is allocated for each thread. This matrix is indexed by the z-stack index (row) and the segment number (column). The number of columns is equal to the maximum number of segments per Track at the time of allocation.
int TrackGenerator3D::getNumL | ( | int | azim, |
int | polar | ||
) |
Returns the number of 3D Tracks in the radial direction for a given azimuthal angle index and polar angle index.
azim | the azimuthal angle index |
polar | the polar angle index |
int TrackGenerator3D::getNumPolar | ( | ) |
Return the number of polar angles in .
int TrackGenerator3D::getNumRows | ( | ) |
Returns the number of rows in the temporary segment storage matrix.
For on-the-fly computation, a matrix of temporary segments is allocated for each thread. This matrix is indexed by the z-stack index (row) and the segment number (column). For ray tracing by individual Tracks the number of rows is always one since temporary segments only need to be stored for one Track at a time.
|
virtual |
Return the total number of Track segments across the Geometry.
Reimplemented from TrackGenerator.
|
virtual |
Return the total number of 3D Tracks across the Geometry.
Reimplemented from TrackGenerator.
int TrackGenerator3D::getNumZ | ( | int | azim, |
int | polar | ||
) |
Returns the number of 3D Tracks in the z-direction for a given azimuthal angle index and polar angle index.
azim | the azimuthal angle index |
polar | the polar angle index |
Track3D * TrackGenerator3D::getTemporary3DTracks | ( | int | thread_id | ) |
Returns an array of temporary 3D Tracks for use in on-the-fly computations.
thread_id | The thread ID, as assigned by OpenMP |
segment * TrackGenerator3D::getTemporarySegments | ( | int | thread_id | ) |
Returns an array of temporary segments for use in on-the-fly computations.
For on-the-fly computation, a matrix of temporary segments is allocated for each thread. This matrix is indexed by the z-stack index (row) and the segment number (column). The row index should be one if temporary segments are only required for one Track at a given time. If the segmentation method is not an on-the-fly method, NULL is returned.
thread_id | The thread ID, as assigned by OpenMP |
Track ** TrackGenerator3D::getTemporaryTracksArray | ( | int | thread_id | ) |
Returns an array of pointers to temporary Tracks for use in on-the-fly computations.
thread_id | The thread ID, as assigned by OpenMP |
void TrackGenerator3D::getTrackOTF | ( | Track3D * | track, |
TrackStackIndexes * | tsi | ||
) |
int *** TrackGenerator3D::getTracksPerStack | ( | ) |
Returns a 3D array of the number of 3D Tracks in each z-stack.
A 3D array is returned indexed first by azimuthal angle, second by 2D track number, and third by polar angle. This array describes the number of tracks in each z-stack.
void TrackGenerator3D::getTSIByIndex | ( | long | id, |
TrackStackIndexes * | tsi | ||
) |
double TrackGenerator3D::getZSpacing | ( | int | azim, |
int | polar | ||
) |
Returns the spacing between tracks in the axial direction for the requested azimuthal angle index and polar angle index.
azim | the requested azimuthal angle index |
polar | the requested polar angle index |
void TrackGenerator3D::retrieve3DSegmentCoords | ( | double * | coords, |
long | num_segments | ||
) |
Fills an array with the x,y coordinates for each Track segment.
This class method is intended to be called by the OpenMOC Python "plotter" module as a utility to assist in plotting segments. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:
coords | an array of coords of length 7 times the number of segments |
num_segments | the total number of Track segments |
void TrackGenerator3D::retrieve3DTrackCoords | ( | double * | coords, |
long | num_tracks | ||
) |
Fills an array with the x,y,z coordinates for each Track.
This class method is intended to be called by the OpenMOC Python "plotter" module as a utility to assist in plotting tracks. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:
coords | an array of coords of length 6 times the number of Tracks |
num_tracks | the total number of Tracks |
void TrackGenerator3D::retrieveGlobalZMesh | ( | double *& | z_mesh, |
int & | num_fsrs | ||
) |
Provides the global z-mesh and size if available.
For some cases, a global z-mesh is generated for the Geometry. If so, a pointer to the associated mesh (array) is updated as well as the number of FSRs in the mesh. If no global z-mesh has been generated, a null pointer is given to z_mesh and the number of FSRs is assigned to be zero.
z_mesh | The global z-mesh to be updated |
num_fsrs | The number of FSRs in the z-mesh |
|
virtual |
Fills an array with the x,y,z coordinates for each Track segment.
This class method is intended to be called by the OpenMOC Python "plotter" module as a utility to assist in plotting segments. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:
coords | an array of coords of length 7 times the number of segments |
num_segments | the total number of Track segments |
Reimplemented from TrackGenerator.
void TrackGenerator3D::retrieveSingle3DTrackCoords | ( | double | coords[6], |
long | track_id | ||
) |
Fills an array with the x,y,z coordinates for a given track.
This class method is intended to be called by the OpenMOC Python "plotter" module as a utility to assist in plotting tracks. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:
coords | an array of coords of length 6 |
track_id | the ID of the requested track |
|
virtual |
Fills an array with the x,y,z coordinates for each Track.
This class method is intended to be called by the OpenMOC Python "plotter" module as a utility to assist in plotting tracks. Although this method appears to require two arguments, in reality it only requires one due to SWIG and would be called from within Python as follows:
coords | an array of coords of length 6 times the number of Tracks |
num_tracks | the total number of Tracks |
Reimplemented from TrackGenerator.
void TrackGenerator3D::setDesiredZSpacing | ( | double | spacing | ) |
Set the suggested track polar spacing (cm).
spacing | the suggested track polar spacing |
void TrackGenerator3D::setLinkIndex | ( | TrackChainIndexes * | tci, |
TrackStackIndexes * | tsi | ||
) |
Updates the index into the 3D chain based on chain and stack indexes.
tci | The chain indexes to be updated |
tsi | The stack indexes |
void TrackGenerator3D::setLinkingTracks | ( | TrackStackIndexes * | tsi, |
TrackChainIndexes * | tci, | ||
bool | outgoing, | ||
Track3D * | track | ||
) |
void TrackGenerator3D::setNumPolar | ( | int | num_polar | ) |
Set the number of polar angles in .
num_polar | the number of polar angles in |
void TrackGenerator3D::setSegmentationZones | ( | std::vector< double > | zones | ) |
Sets the z-planes over which 2D segmentation is performed for on-the-fly calculations.
zones | the z-coordinates defining the height of the radial segmentation planes |
void TrackGenerator3D::setSegmentFormation | ( | segmentationType | segmentation_type | ) |
Set the type of segmentation used for segment formation.
segmentation_type | a segmentationType defining the type of segmentation to be used in segment formation. Options are:
|
void TrackGenerator3D::useGlobalZMesh | ( | ) |
Sets a global z-mesh to use during axial on-the-fly ray tracing.
In axial on-the-fly ray tracing, normally each extruded FSR contains a z-mesh. During on-the-fly segmentation when a new extruded FSR is entered, a binary search must be conducted to determine the axial cell. Alternatively, this function can be called which creates a global z-mesh from the geometry so that binary searches must only be conducted at the beginning of the track.