An open source method of characteristics neutron transport code.
|
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials. More...
#include "src/Geometry.h"
Public Member Functions | |
Geometry () | |
Constructor initializes an empty Geometry. | |
virtual | ~Geometry () |
Destructor clears FSR to Cells and Materials maps. | |
void | setNumDomainModules (int num_x, int num_y, int num_z) |
Sets how many modular track laydown domains are in each MPI domain. More... | |
int | getNumXModules () |
Get the number of modular domains in the x-direction per MPI domain. More... | |
int | getNumYModules () |
Get the number of modular domains in the y-direction per MPI domain. More... | |
int | getNumZModules () |
Get the number of modular domains in the z-direction per MPI domain. More... | |
void | useSymmetry (bool X_symmetry, bool Y_symmetry, bool Z_symmetry) |
Take into account domain symmetries to reduce the problem domain. More... | |
bool | getSymmetry (int axis) |
Get the symmetries used to restrict the domain. More... | |
double | getWidthX () |
Returns the total width in the x-direction of the Geometry in cm. More... | |
double | getWidthY () |
Returns the total width in the y-direction of the Geometry in cm. More... | |
double | getWidthZ () |
Returns the total width in the z-direction of the Geometry in cm. More... | |
double | getMinX () |
Return the minimum x-coordinate contained by the Geometry. More... | |
double | getMaxX () |
Return the maximum x-coordinate contained by the Geometry. More... | |
double | getMinY () |
Return the minimum y-coordinate contained by the Geometry. More... | |
double | getMaxY () |
Return the maximum y-coordinate contained by the Geometry. More... | |
double | getMinZ () |
Return the minimum z-coordinate contained by the Geometry. More... | |
double | getMaxZ () |
Return the maximum z-coordinate contained by the Geometry. More... | |
boundaryType | getMinXBoundaryType () |
Returns the boundary conditions at the minimum x-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
boundaryType | getMaxXBoundaryType () |
Returns the boundary conditions at the maximum x-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
boundaryType | getMinYBoundaryType () |
Returns the boundary conditions at the minimum y-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
boundaryType | getMaxYBoundaryType () |
Returns the boundary conditions at the maximum y-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
boundaryType | getMinZBoundaryType () |
Returns the boundary conditions at the minimum z-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
boundaryType | getMaxZBoundaryType () |
Returns the boundary conditions at the maximum z-coordinate in the Geometry / domain if the geometry is domain-decomposed. More... | |
Universe * | getRootUniverse () |
Returns the Universe at the root node in the CSG tree. More... | |
long | getNumFSRs () |
Returns the number of source regions in the Geometry domain. More... | |
long | getNumTotalFSRs () |
Returns the number of source regions in the entire Geometry. More... | |
int | getNumEnergyGroups () |
Returns the number of energy groups for each Material's nuclear data. More... | |
int | getNumMaterials () |
Returns the number of Materials in the Geometry. More... | |
int | getNumCells () |
Returns the number of Cells in the Geometry. More... | |
std::map< int, Surface * > | getAllSurfaces () |
Return a std::map container of Surface IDs (keys) with Surfaces pointers (values). More... | |
std::map< int, Material * > | getAllMaterials () |
Return a std::map container of Material IDs (keys) with Materials pointers (values). More... | |
std::map< int, Cell * > | getAllCells () |
Return a std::map container of Cell IDs (keys) with Cells pointers (values). More... | |
std::map< int, Cell * > | getAllMaterialCells () |
Return a std::map container of Cell IDs (keys) with Cells pointers (values). More... | |
std::map< int, Universe * > | getAllUniverses () |
Return a std::map container of Universe IDs (keys) with Universes pointers (values). More... | |
std::vector< double > | getUniqueZHeights (bool include_overlaid_mesh=false) |
Returns a vector of z-coords defining a superposition of all axial boundaries in the Geometry. More... | |
std::vector< double > | getUniqueZPlanes () |
Returns a vector of z-coords defining potential unique radial planes in the Geometry. More... | |
bool | isDomainDecomposed () |
Returns whether the Geometry is domain decomposed. More... | |
bool | isRootDomain () |
Returns whether this MPI domain is the root domain. More... | |
void | getDomainIndexes (int *indexes) |
Returns the domain indexes of the current domain. More... | |
void | getDomainStructure (int *structure) |
Returns the number of domains in each direction. More... | |
void | setRootUniverse (Universe *root_universe) |
Sets the root Universe for the CSG tree. More... | |
Cmfd * | getCmfd () |
Returns a pointer to the CMFD object. More... | |
std::vector< std::string > & | getFSRsToKeys () |
Returns the vector that maps FSR IDs to FSR key hashes. More... | |
std::vector< int > & | getFSRsToMaterialIDs () |
Returns a vector indexed by flat source region IDs which contains the corresponding Material IDs. More... | |
std::vector< Point * > & | getFSRsToCentroids () |
Return a vector indexed by flat source region IDs which contains pointers to the corresponding Centroid information. More... | |
std::vector< int > & | getFSRsToCMFDCells () |
Return a vector indexed by flat source region IDs which contains the corresponding CMFD cell. More... | |
std::vector< ExtrudedFSR * > & | getExtrudedFSRLookup () |
Returns the vector that maps FSR IDs to extruded FSRs. More... | |
long | getFSRId (LocalCoords *coords, bool err_check=true) |
Return the ID of the flat source region that a given LocalCoords object resides within. More... | |
long | getGlobalFSRId (LocalCoords *coords, bool err_check=true) |
Return the global ID of the flat source region that a given LocalCoords object resides within. More... | |
Point * | getFSRPoint (long fsr_id) |
Return the characteristic point for a given FSR ID. More... | |
Point * | getFSRCentroid (long fsr_id) |
Return the centroid for a given FSR ID. More... | |
bool | containsFSRCentroids () |
Returns whether any FSR centroids have been set. | |
int | getCmfdCell (long fsr_id) |
Return the CMFD cell for a given FSR ID. More... | |
ExtrudedFSR * | getExtrudedFSR (int extruded_fsr_id) |
Return a pointer to an ExtrudedFSR by its extruded FSR ID. More... | |
std::string | getFSRKey (LocalCoords *coords) |
Generate a string FSR "key" for the FSR where the point reside in. A string FSR "key" identifies an FSR by its unique hierarchical lattice/universe/cell structure. More... | |
void | getFSRKeyFast (LocalCoords *coords, std::string &key) |
Generate a string FSR "key" that identifies an FSR by its unique hierarchical lattice/universe/cell structure. More... | |
void | printToString (std::string &str, int &index, int value) |
Print a number to a given String. More... | |
int | getNumDigits (int number) |
Get the number of digits in base 10 of a number. More... | |
ParallelHashMap< std::string, fsr_data * > & | getFSRKeysMap () |
Returns a pointer to the map that maps FSR keys to FSR IDs. More... | |
ParallelHashMap< std::string, ExtrudedFSR * > & | getExtrudedFSRKeysMap () |
Returns a pointer to the map that maps FSR keys to extruded FSRs. More... | |
void | setCmfd (Cmfd *cmfd) |
Sets the pointer to a CMFD object used for acceleration. More... | |
void | setFSRCentroid (long fsr, Point *centroid) |
Sets the centroid for an FSR. More... | |
void | setOverlaidMesh (double axial_mesh_height, int num_x=0, int num_y=0, int num_radial_domains=0, int *radial_domains=NULL) |
Sets a global overlaid mesh with the given mesh height. More... | |
void | clearBoundaries () |
Clears all boundary conditions from the Geometry. | |
Cell * | findCellContainingCoords (LocalCoords *coords) |
Find the Cell that this LocalCoords object is in at the lowest level of the nested Universe hierarchy. More... | |
Material * | findFSRMaterial (long fsr_id) |
Find the Material for a flat source region ID. More... | |
long | findFSRId (LocalCoords *coords) |
Find and return the ID of the flat source region that a given LocalCoords object resides within. More... | |
int | findExtrudedFSR (LocalCoords *coords) |
Finds and returns a pointer to the axially extruded flat source region that a given LocalCoords object resides within. More... | |
Cell * | findCellContainingFSR (long fsr_id) |
Finds the Cell containing a given fsr ID. More... | |
Cell * | findNextCell (LocalCoords *coords, double azim, double polar=M_PI_2) |
Finds the next Cell for a LocalCoords object along a trajectory defined by two angles : azimuthal from 0 to 2Pi, polar from 0 to Pi. More... | |
void | reserveKeyStrings (int num_threads) |
reserves the FSR key strings More... | |
void | subdivideCells () |
Subdivides all Cells in the Geometry into rings and angular sectors aligned with the z-axis. More... | |
void | initializeAxialFSRs (std::vector< double > global_z_mesh) |
Rays are shot vertically through each ExtrudedFSR struct to calculate the axial mesh and initialize 3D FSRs. More... | |
void | reorderFSRIDs () |
Reorders FSRs so that they are contiguous in the axial direction. | |
void | initializeFlatSourceRegions () |
Compute the number of flat source regions in the Geometry and initialize CMFD. More... | |
void | segmentize2D (Track *track, double z_coord) |
This method performs ray tracing to create Track segments within each flat source region in the Geometry. More... | |
void | segmentize3D (Track3D *track, bool setup=false) |
This method performs ray tracing to create Track segments within each flat source region in the Geometry. More... | |
void | segmentizeExtruded (Track *flattened_track, std::vector< double > z_coords) |
This method performs ray tracing to create extruded track segments within each flat source region in the implicit 2D superposition plane of the Geometry by 2D ray tracing across input heights that encompass all radial geometric details. More... | |
void | fixFSRMaps () |
Fixes the FSR map size so that the map is static and fast. | |
void | initializeFSRVectors () |
Initialize key and material ID vectors for lookup by FSR ID. More... | |
void | computeFissionability (Universe *univ=NULL) |
Determines the fissionability of each Universe within this Geometry. More... | |
void | manipulateXS () |
Modify scattering and total cross sections to study MOC stability. | |
std::vector< long > | getSpatialDataOnGrid (std::vector< double > dim1, std::vector< double > dim2, double offset, const char *plane, const char *domain_type) |
Get the material, cell or FSR IDs on a 2D spatial grid. More... | |
std::string | toString () |
Converts this Geometry's attributes to a character array. More... | |
void | printString () |
Prints a string representation of all of the Geometry's attributes to the console. More... | |
void | printFSRsToFile (const char *plane="xy", int gridsize=1000, double offset=0.0, double *bounds_x=NULL, double *bounds_y=NULL, double *bounds_z=NULL) |
Prints FSR layout to file. More... | |
void | initializeCmfd () |
This is a method that initializes the CMFD Lattice and sets CMFD parameters. | |
void | initializeSpectrumCalculator (Cmfd *spectrum_calculator) |
This is a method that initializes the initial spectrum calculator. | |
bool | withinBounds (LocalCoords *coords) |
Determines whether a point is within the bounding box of the domain. More... | |
bool | withinGlobalBounds (LocalCoords *coords) |
Determines whether a point is within the bounding box of the Geometry. More... | |
std::vector< double > | getGlobalFSRCentroidData (long global_fsr_id) |
Returns the FSR centroid of a global FSR. More... | |
int | getDomainByCoords (LocalCoords *coords) |
Returns the rank of the domain containing the given coordinates. More... | |
std::map< Cell *, std::vector< long > > | getCellsToFSRs () |
Returns a map from cells to FSRs. More... | |
void | dumpToFile (std::string filename) |
Prints all Geometry and Material details to a Geometry restart file. More... | |
void | loadFromFile (std::string filename, bool twiddle=false) |
Loads all Geometry and Material details from a Geometry restart file. More... | |
size_t | twiddleRead (int *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an integer array from file. More... | |
size_t | twiddleRead (bool *ptr, size_t size, size_t nmemb, FILE *stream) |
Read a boolean array from file. More... | |
size_t | twiddleRead (char *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of char from file. More... | |
size_t | twiddleRead (universeType *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of universeType from file. More... | |
size_t | twiddleRead (cellType *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of cellType from file. More... | |
size_t | twiddleRead (surfaceType *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of surfaceType from file. More... | |
size_t | twiddleRead (boundaryType *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of boundaryType from file. More... | |
size_t | twiddleRead (double *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of double from file. More... | |
size_t | twiddleRead (long *ptr, size_t size, size_t nmemb, FILE *stream) |
Read an array of long int from file. More... | |
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials.
The primary purpose for the geometry is to serve as a collection of all geometry-related objects, as well as for ray tracing of characteristic tracks across the Geometry and computing FSR-to-cell offset maps.
void Geometry::computeFissionability | ( | Universe * | univ = NULL | ) |
Determines the fissionability of each Universe within this Geometry.
A Universe is determined fissionable if it contains a Cell filled by a Material with a non-zero fission cross-section. Note that this method recurses through all Universes at each level in the nested Universe hierarchy. Users should only call this method without a parameter (the default) from Python as follows to ensure that the recursion starts from the uppermost Universe level:
univ | the Universe of interest (default is NULL) |
void Geometry::dumpToFile | ( | std::string | filename | ) |
Cell * Geometry::findCellContainingCoords | ( | LocalCoords * | coords | ) |
Find the Cell that this LocalCoords object is in at the lowest level of the nested Universe hierarchy.
This method assumes that the LocalCoords has been initialized with coordinates and a Universe ID. The method will recursively find the Cell on the lowest level of the nested Universe hierarchy by building a linked list of LocalCoords from the LocalCoord passed in as an argument down to the lowest level Cell found. In the process it will set the coordinates at each level of the hierarchy for each LocalCoord in the linked list for the Lattice or Universe that it is in. If the LocalCoords is outside the bounds of the Geometry or on the boundaries this method will return NULL; otherwise it will return a pointer to the Cell that is found by the recursive Geometry::findCell(...) method.
coords | pointer to a LocalCoords object |
Cell * Geometry::findCellContainingFSR | ( | long | fsr_id | ) |
Finds the Cell containing a given fsr ID.
fsr_id | an FSR ID. |
int Geometry::findExtrudedFSR | ( | LocalCoords * | coords | ) |
Finds and returns a pointer to the axially extruded flat source region that a given LocalCoords object resides within.
coords | a LocalCoords object pointer |
long Geometry::findFSRId | ( | LocalCoords * | coords | ) |
Find and return the ID of the flat source region that a given LocalCoords object resides within.
coords | a LocalCoords object pointer |
Material * Geometry::findFSRMaterial | ( | long | fsr_id | ) |
Cell * Geometry::findNextCell | ( | LocalCoords * | coords, |
double | azim, | ||
double | polar = M_PI_2 |
||
) |
Finds the next Cell for a LocalCoords object along a trajectory defined by two angles : azimuthal from 0 to 2Pi, polar from 0 to Pi.
The method will update the LocalCoords passed in as an argument to be the one at the boundary of the next Cell crossed along the given trajectory. It will do this by finding the minimum distance to the surfaces at all levels of the coords hierarchy. If the LocalCoords is outside the bounds of the Geometry or on the boundaries this method will return NULL; otherwise it will return a pointer to the Cell that the LocalCoords will reach next along its trajectory.
coords | pointer to a LocalCoords object |
azim | the azimuthal angle of the trajectory |
polar | the polar angle of the trajectory |
std::map< int, Cell * > Geometry::getAllCells | ( | ) |
std::map< int, Cell * > Geometry::getAllMaterialCells | ( | ) |
std::map< int, Material * > Geometry::getAllMaterials | ( | ) |
std::map< int, Surface * > Geometry::getAllSurfaces | ( | ) |
std::map< int, Universe * > Geometry::getAllUniverses | ( | ) |
std::map< Cell *, std::vector< long > > Geometry::getCellsToFSRs | ( | ) |
Returns a map from cells to FSRs.
Cmfd * Geometry::getCmfd | ( | ) |
Returns a pointer to the CMFD object.
int Geometry::getCmfdCell | ( | long | fsr_id | ) |
Return the CMFD cell for a given FSR ID.
fsr_id | the FSR ID |
int Geometry::getDomainByCoords | ( | LocalCoords * | coords | ) |
Returns the rank of the domain containing the given coordinates.
coords | The coordinates used to search the domain rank |
void Geometry::getDomainIndexes | ( | int * | indexes | ) |
Returns the domain indexes of the current domain.
indexes | A pointer to the array to be filled with the indexes |
void Geometry::getDomainStructure | ( | int * | structure | ) |
Returns the number of domains in each direction.
structure | A pointer to the array to be filled with the domain numbers |
ExtrudedFSR * Geometry::getExtrudedFSR | ( | int | extruded_fsr_id | ) |
Return a pointer to an ExtrudedFSR by its extruded FSR ID.
extruded_fsr_id | the extruded FSR ID |
ParallelHashMap< std::string, ExtrudedFSR * > & Geometry::getExtrudedFSRKeysMap | ( | ) |
Returns a pointer to the map that maps FSR keys to extruded FSRs.
std::vector< ExtrudedFSR * > & Geometry::getExtrudedFSRLookup | ( | ) |
Returns the vector that maps FSR IDs to extruded FSRs.
Point * Geometry::getFSRCentroid | ( | long | fsr_id | ) |
Return the centroid for a given FSR ID.
fsr_id | the FSR ID |
long Geometry::getFSRId | ( | LocalCoords * | coords, |
bool | err_check = true |
||
) |
Return the ID of the flat source region that a given LocalCoords object resides within.
coords | a LocalCoords object pointer |
err_check | whether to fail instead of returning -1 if not found |
std::string Geometry::getFSRKey | ( | LocalCoords * | coords | ) |
Generate a string FSR "key" for the FSR where the point reside in. A string FSR "key" identifies an FSR by its unique hierarchical lattice/universe/cell structure.
Since not all FSRs will reside on the absolute lowest universe level and Cells might overlap other cells, it is important to have a method for uniquely identifying FSRs. This method creates a unique FSR key by constructing a structured string that describes the hierarchy of lattices/universes/cells.
coords | a LocalCoords object pointer |
void Geometry::getFSRKeyFast | ( | LocalCoords * | coords, |
std::string & | key | ||
) |
Generate a string FSR "key" that identifies an FSR by its unique hierarchical lattice/universe/cell structure.
Since not all FSRs will reside on the absolute lowest universe level and Cells might overlap other cells, it is important to have a method for uniquely identifying FSRs. This method creates a unique FSR key by constructing a structured string that describes the hierarchy of lattices/universes/cells.
coords | a LocalCoords object pointer |
key | a reference to the FSR key |
ParallelHashMap< std::string, fsr_data * > & Geometry::getFSRKeysMap | ( | ) |
Returns a pointer to the map that maps FSR keys to FSR IDs.
Point * Geometry::getFSRPoint | ( | long | fsr_id | ) |
Return the characteristic point for a given FSR ID.
fsr_id | the FSR ID |
std::vector< Point * > & Geometry::getFSRsToCentroids | ( | ) |
Return a vector indexed by flat source region IDs which contains pointers to the corresponding Centroid information.
std::vector< int > & Geometry::getFSRsToCMFDCells | ( | ) |
Return a vector indexed by flat source region IDs which contains the corresponding CMFD cell.
std::vector< std::string > & Geometry::getFSRsToKeys | ( | ) |
Returns the vector that maps FSR IDs to FSR key hashes.
std::vector< int > & Geometry::getFSRsToMaterialIDs | ( | ) |
Returns a vector indexed by flat source region IDs which contains the corresponding Material IDs.
std::vector< double > Geometry::getGlobalFSRCentroidData | ( | long | global_fsr_id | ) |
Returns the FSR centroid of a global FSR.
global_fsr_id | The global unique identifier of the FSR |
long Geometry::getGlobalFSRId | ( | LocalCoords * | coords, |
bool | err_check = true |
||
) |
Return the global ID of the flat source region that a given LocalCoords object resides within.
coords | a LocalCoords object pointer |
err_check | whether to fail instead of returning -1 if not found |
double Geometry::getMaxX | ( | ) |
Return the maximum x-coordinate contained by the Geometry.
boundaryType Geometry::getMaxXBoundaryType | ( | ) |
Returns the boundary conditions at the maximum x-coordinate in the Geometry / domain if the geometry is domain-decomposed.
double Geometry::getMaxY | ( | ) |
Return the maximum y-coordinate contained by the Geometry.
boundaryType Geometry::getMaxYBoundaryType | ( | ) |
Returns the boundary conditions at the maximum y-coordinate in the Geometry / domain if the geometry is domain-decomposed.
double Geometry::getMaxZ | ( | ) |
Return the maximum z-coordinate contained by the Geometry.
boundaryType Geometry::getMaxZBoundaryType | ( | ) |
Returns the boundary conditions at the maximum z-coordinate in the Geometry / domain if the geometry is domain-decomposed.
double Geometry::getMinX | ( | ) |
Return the minimum x-coordinate contained by the Geometry.
boundaryType Geometry::getMinXBoundaryType | ( | ) |
Returns the boundary conditions at the minimum x-coordinate in the Geometry / domain if the geometry is domain-decomposed.
double Geometry::getMinY | ( | ) |
Return the minimum y-coordinate contained by the Geometry.
boundaryType Geometry::getMinYBoundaryType | ( | ) |
Returns the boundary conditions at the minimum y-coordinate in the Geometry / domain if the geometry is domain-decomposed.
double Geometry::getMinZ | ( | ) |
Return the minimum z-coordinate contained by the Geometry.
boundaryType Geometry::getMinZBoundaryType | ( | ) |
Returns the boundary conditions at the minimum z-coordinate in the Geometry / domain if the geometry is domain-decomposed.
int Geometry::getNumCells | ( | ) |
Returns the number of Cells in the Geometry.
int Geometry::getNumDigits | ( | int | number | ) |
Get the number of digits in base 10 of a number.
Using std::stringstream would be more clear.
number | the number of interest |
int Geometry::getNumEnergyGroups | ( | ) |
Returns the number of energy groups for each Material's nuclear data.
long Geometry::getNumFSRs | ( | ) |
Returns the number of source regions in the Geometry domain.
int Geometry::getNumMaterials | ( | ) |
Returns the number of Materials in the Geometry.
long Geometry::getNumTotalFSRs | ( | ) |
Returns the number of source regions in the entire Geometry.
int Geometry::getNumXModules | ( | ) |
Get the number of modular domains in the x-direction per MPI domain.
int Geometry::getNumYModules | ( | ) |
Get the number of modular domains in the y-direction per MPI domain.
int Geometry::getNumZModules | ( | ) |
Get the number of modular domains in the z-direction per MPI domain.
Universe * Geometry::getRootUniverse | ( | ) |
std::vector< long > Geometry::getSpatialDataOnGrid | ( | std::vector< double > | dim1, |
std::vector< double > | dim2, | ||
double | offset, | ||
const char * | plane, | ||
const char * | domain_type | ||
) |
Get the material, cell or FSR IDs on a 2D spatial grid.
This is a helper method for the openmoc.plotter module. This method may also be called by the user in Python if needed. A user must initialize NumPy arrays with the x and y grid coordinates input to this function. This function then fills a NumPy array with the domain IDs for each coordinate. An example of how this function might be called in Python is as follows:
dim1 | a numpy array of the first dimension's coordinates |
dim2 | a numpy array of the second dimension's coordinates |
offset | The coordinate at which the plane is located |
plane | The plane for which data is gathered ('xy', 'xz', 'yz') |
domain_type | the type of domain ('fsr', 'material', 'cell') |
bool Geometry::getSymmetry | ( | int | axis | ) |
Get the symmetries used to restrict the domain.
std::vector< double > Geometry::getUniqueZHeights | ( | bool | include_overlaid_mesh = false | ) |
Returns a vector of z-coords defining a superposition of all axial boundaries in the Geometry.
The Geometry is traversed to retrieve all Z-planes and implicit z-boundaries, such as lattice boundaries. The levels of all these z-boundaries are rounded and added to a set containing no duplicates, creating a mesh.
include_overlaid_mesh | whether to include an overlaid mesh in the set of unique z-coords |
std::vector< double > Geometry::getUniqueZPlanes | ( | ) |
Returns a vector of z-coords defining potential unique radial planes in the Geometry.
The Geometry is traversed to retrieve all Z-planes and implicit z-boundaries, such as lattice boundaries. The mid points of this mesh are then used to construct a vector of all potential unique radial planes and returned to the user.
double Geometry::getWidthX | ( | ) |
double Geometry::getWidthY | ( | ) |
double Geometry::getWidthZ | ( | ) |
void Geometry::initializeAxialFSRs | ( | std::vector< double > | global_z_mesh | ) |
Rays are shot vertically through each ExtrudedFSR struct to calculate the axial mesh and initialize 3D FSRs.
From a 2D point within each FSR, a temporary 3D track is created starting at the bottom of the geometry and extending vertically to the top of the geometry. These tracks are segmented using the segmentize3D routine to calculate the distances between axial intersections forming the axial meshes if necessary and initializing the 3D FSRs as new regions are traversed.
global_z_mesh | A global z mesh used for ray tracing. If the vector's length is zero, z meshes are local and need to be created for every ExtrudedFSR. |
void Geometry::initializeFlatSourceRegions | ( | ) |
Compute the number of flat source regions in the Geometry and initialize CMFD.
This method is intended to be called by the user before initiating source iteration. This method first subdivides all Cells by calling the Geometry::subdivideCells() method. Then it initializes the CMFD object.
void Geometry::initializeFSRVectors | ( | ) |
Initialize key and material ID vectors for lookup by FSR ID.
This function initializes and sets reverse lookup vectors by FSR ID. This is called after the FSRs have all been identified and allocated during segmentation. This function must be called after Geometry::segmentize() has completed. It should not be called if tracks are loaded from a file.
bool Geometry::isDomainDecomposed | ( | ) |
Returns whether the Geometry is domain decomposed.
bool Geometry::isRootDomain | ( | ) |
Returns whether this MPI domain is the root domain.
void Geometry::loadFromFile | ( | std::string | filename, |
bool | twiddle = false |
||
) |
void Geometry::printFSRsToFile | ( | const char * | plane = "xy" , |
int | gridsize = 1000 , |
||
double | offset = 0.0 , |
||
double * | bounds_x = NULL , |
||
double * | bounds_y = NULL , |
||
double * | bounds_z = NULL |
||
) |
Prints FSR layout to file.
This provides a way to get the functionality of the plot_flat_source_regions Python function without Python
plane | The "xy", "xz", or "yz" plane in which to extract flat source regions |
gridsize | The number of points to plot in each direction |
offset | The offset of the plane in the third dimension |
bounds_x | a two valued array for the plotted x-limits |
bounds_y | a two valued array for the plotted y-limits |
bounds_z | a two valued array for the plotted z-limits |
void Geometry::printString | ( | ) |
Prints a string representation of all of the Geometry's attributes to the console.
This method calls the printString() method for all Materials, Surfaces, Cell, Universes and Lattices contained by the Geometry.
void Geometry::printToString | ( | std::string & | str, |
int & | index, | ||
int | value | ||
) |
Print a number to a given String.
Using std::stringstream would be more clear.
str | the string to print to |
index | the last index in that string |
value | the number to print |
void Geometry::reserveKeyStrings | ( | int | num_threads | ) |
reserves the FSR key strings
num_threads | the number of threads |
void Geometry::segmentize2D | ( | Track * | track, |
double | z_coord | ||
) |
This method performs ray tracing to create Track segments within each flat source region in the Geometry.
This method starts at the beginning of a Track and finds successive intersection points with FSRs as the Track crosses through the Geometry and creates segment structs and adds them to the Track.
track | a pointer to a track to segmentize |
z_coord | the axial height at which the 2D plane of the geometry is formed |
void Geometry::segmentize3D | ( | Track3D * | track, |
bool | OTF_setup = false |
||
) |
This method performs ray tracing to create Track segments within each flat source region in the Geometry.
This method starts at the beginning of a Track and finds successive intersection points with FSRs as the Track crosses through the Geometry and creates segment structs and adds them to the Track.
track | a pointer to a track to segmentize |
OTF_setup | whether this routine is called during OTF ray tracing setup |
void Geometry::segmentizeExtruded | ( | Track * | flattened_track, |
std::vector< double > | z_coords | ||
) |
This method performs ray tracing to create extruded track segments within each flat source region in the implicit 2D superposition plane of the Geometry by 2D ray tracing across input heights that encompass all radial geometric details.
This method starts at the beginning of an extruded track and finds successive intersection points with FSRs as the extruded track crosses radially through the Geometry at defined z-coords. The minimum distance to intersection of all z-coords is chosen leading to implicitly capturing all geometric radial detail at the defined z-heights, saving the lengths and region IDs to the extruded track and initializing ExtrudedFSR structs in the traversed FSRs.
flattened_track | a pointer to a 2D track to segmentize into regions of extruded FSRs |
z_coords | a vector of axial heights in the root geometry at which the Geometry is segmentized radially |
void Geometry::setCmfd | ( | Cmfd * | cmfd | ) |
Sets the pointer to a CMFD object used for acceleration.
cmfd | a pointer to the CMFD object |
void Geometry::setFSRCentroid | ( | long | fsr, |
Point * | centroid | ||
) |
Sets the centroid for an FSR.
The _FSR_keys_map stores a hash of a std::string representing the Lattice/Cell/Universe hierarchy for a unique region and the associated FSR data. _centroid is a point that represents the numerical centroid of an FSR computed using all segments contained in the FSR. This method is used by the TrackGenerator to set the centroid after segments have been created. It is important to note that this method is a helper function for the TrackGenerator and should not be explicitly called by the user.
fsr | a FSR id |
centroid | a Point representing the FSR centroid |
void Geometry::setNumDomainModules | ( | int | num_x, |
int | num_y, | ||
int | num_z | ||
) |
Sets how many modular track laydown domains are in each MPI domain.
num_x | The number of modular domains in the x-direction per MPI domain |
num_y | The number of modular domains in the y-direction per MPI domain |
num_z | The number of modular domains in the z-direction per MPI domain |
void Geometry::setOverlaidMesh | ( | double | axial_mesh_height, |
int | num_x = 0 , |
||
int | num_y = 0 , |
||
int | num_radial_domains = 0 , |
||
int * | radial_domains = NULL |
||
) |
Sets a global overlaid mesh with the given mesh height.
The global overlaid mesh is overlaid across the entire Geometry
axial_mesh_height | The desired height of axial mesh cells |
num_x | number of divisions in the X direction |
num_y | number of divisions in the Y direction |
num_radial_domains | number of radial domains |
radial_domains | array with the indexes of each domain in X and Y |
void Geometry::setRootUniverse | ( | Universe * | root_universe | ) |
void Geometry::subdivideCells | ( | ) |
Subdivides all Cells in the Geometry into rings and angular sectors aligned with the z-axis.
This method is called by the Geometry::initializeFlatSourceRegions() method but may also be called by the user in Python if needed:
std::string Geometry::toString | ( | ) |
Converts this Geometry's attributes to a character array.
This method calls the toString() method for all Materials, Surfaces, Cell, Universes and Lattices contained by the Geometry.
size_t Geometry::twiddleRead | ( | int * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an integer array from file.
ptr | the integer array to fill with the data read |
size | the size of each element to read (here size(int)) |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | bool * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read a boolean array from file.
ptr | the boolean array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | char * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of char from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | universeType * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of universeType from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | cellType * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of cellType from file.
ptr | the array to fill with the read data |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | surfaceType * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of surfaceType from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | boundaryType * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of boundaryType from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | double * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of double from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
size_t Geometry::twiddleRead | ( | long * | ptr, |
size_t | size, | ||
size_t | nmemb, | ||
FILE * | stream | ||
) |
Read an array of long int from file.
ptr | the array to fill with the data read |
size | the size of each element to read |
nmemb | the number of elements to read |
stream | the file to read from |
void Geometry::useSymmetry | ( | bool | X_symmetry, |
bool | Y_symmetry, | ||
bool | Z_symmetry | ||
) |
Take into account domain symmetries to reduce the problem domain.
X_symmetry | whether the domain is symmetric in X |
Y_symmetry | whether the domain is symmetric in Y |
Z_symmetry | whether the domain is symmetric in Z |
bool Geometry::withinBounds | ( | LocalCoords * | coords | ) |
Determines whether a point is within the bounding box of the domain.
coords | a populated LocalCoords linked list |
bool Geometry::withinGlobalBounds | ( | LocalCoords * | coords | ) |
Determines whether a point is within the bounding box of the Geometry.
coords | a populated LocalCoords linked list |