An open source method of characteristics neutron transport code.
Geometry Class Reference

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...
 
UniversegetRootUniverse ()
 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...
 
CmfdgetCmfd ()
 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...
 
PointgetFSRPoint (long fsr_id)
 Return the characteristic point for a given FSR ID. More...
 
PointgetFSRCentroid (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...
 
ExtrudedFSRgetExtrudedFSR (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.
 
CellfindCellContainingCoords (LocalCoords *coords)
 Find the Cell that this LocalCoords object is in at the lowest level of the nested Universe hierarchy. More...
 
MaterialfindFSRMaterial (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...
 
CellfindCellContainingFSR (long fsr_id)
 Finds the Cell containing a given fsr ID. More...
 
CellfindNextCell (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...
 

Detailed Description

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.

Member Function Documentation

◆ computeFissionability()

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:

geometry.computeFissionability()
Parameters
univthe Universe of interest (default is NULL)

◆ dumpToFile()

void Geometry::dumpToFile ( std::string  filename)

Prints all Geometry and Material details to a Geometry restart file.

Parameters
filenameThe name of the file where the data is printed

◆ findCellContainingCoords()

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.

Parameters
coordspointer to a LocalCoords object
Returns
returns a pointer to a Cell if found, NULL if no Cell found

◆ findCellContainingFSR()

Cell * Geometry::findCellContainingFSR ( long  fsr_id)

Finds the Cell containing a given fsr ID.

Parameters
fsr_idan FSR ID.

◆ findExtrudedFSR()

int Geometry::findExtrudedFSR ( LocalCoords coords)

Finds and returns a pointer to the axially extruded flat source region that a given LocalCoords object resides within.

Parameters
coordsa LocalCoords object pointer
Returns
the ID of an extruded FSR for a given LocalCoords object

◆ findFSRId()

long Geometry::findFSRId ( LocalCoords coords)

Find and return the ID of the flat source region that a given LocalCoords object resides within.

Parameters
coordsa LocalCoords object pointer
Returns
the FSR ID for a given LocalCoords object

◆ findFSRMaterial()

Material * Geometry::findFSRMaterial ( long  fsr_id)

Find the Material for a flat source region ID.

This method finds the fsr_id within the _FSR_to_material_IDs map and returns the corresponding pointer to the Material object.

Parameters
fsr_ida FSR id
Returns
a pointer to the Material that this FSR is in

◆ findNextCell()

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.

Parameters
coordspointer to a LocalCoords object
azimthe azimuthal angle of the trajectory
polarthe polar angle of the trajectory
Returns
a pointer to a Cell if found, NULL if no Cell found

◆ getAllCells()

std::map< int, Cell * > Geometry::getAllCells ( )

Return a std::map container of Cell IDs (keys) with Cells pointers (values).

Returns
a std::map of Cells indexed by Cell ID in the geometry

◆ getAllMaterialCells()

std::map< int, Cell * > Geometry::getAllMaterialCells ( )

Return a std::map container of Cell IDs (keys) with Cells pointers (values).

Returns
a std::map of Cells indexed by Cell ID in the geometry

◆ getAllMaterials()

std::map< int, Material * > Geometry::getAllMaterials ( )

Return a std::map container of Material IDs (keys) with Materials pointers (values).

Returns
a std::map of Materials indexed by Material ID in the geometry

◆ getAllSurfaces()

std::map< int, Surface * > Geometry::getAllSurfaces ( )

Return a std::map container of Surface IDs (keys) with Surfaces pointers (values).

Returns
a std::map of Surfaces indexed by Surface ID in the geometry

◆ getAllUniverses()

std::map< int, Universe * > Geometry::getAllUniverses ( )

Return a std::map container of Universe IDs (keys) with Universes pointers (values).

Returns
a std::map of Universes indexed by Universe ID in the geometry

◆ getCellsToFSRs()

std::map< Cell *, std::vector< long > > Geometry::getCellsToFSRs ( )

Returns a map from cells to FSRs.

Returns
a map from cells to FSRs contained in those cells

◆ getCmfd()

Cmfd * Geometry::getCmfd ( )

Returns a pointer to the CMFD object.

Returns
A pointer to the CMFD object

◆ getCmfdCell()

int Geometry::getCmfdCell ( long  fsr_id)

Return the CMFD cell for a given FSR ID.

Parameters
fsr_idthe FSR ID
Returns
the CMFD cell

◆ getDomainByCoords()

int Geometry::getDomainByCoords ( LocalCoords coords)

Returns the rank of the domain containing the given coordinates.

Parameters
coordsThe coordinates used to search the domain rank
Returns
The rank of the domain containing the coordinates

◆ getDomainIndexes()

void Geometry::getDomainIndexes ( int *  indexes)

Returns the domain indexes of the current domain.

Parameters
indexesA pointer to the array to be filled with the indexes

◆ getDomainStructure()

void Geometry::getDomainStructure ( int *  structure)

Returns the number of domains in each direction.

Parameters
structureA pointer to the array to be filled with the domain numbers

◆ getExtrudedFSR()

ExtrudedFSR * Geometry::getExtrudedFSR ( int  extruded_fsr_id)

Return a pointer to an ExtrudedFSR by its extruded FSR ID.

Parameters
extruded_fsr_idthe extruded FSR ID
Returns
a pointer to the ExtrudedFSR

◆ getExtrudedFSRKeysMap()

ParallelHashMap< std::string, ExtrudedFSR * > & Geometry::getExtrudedFSRKeysMap ( )

Returns a pointer to the map that maps FSR keys to extruded FSRs.

Returns
pointer to _FSR_keys_map map of FSR keys to extruded FSRs

◆ getExtrudedFSRLookup()

std::vector< ExtrudedFSR * > & Geometry::getExtrudedFSRLookup ( )

Returns the vector that maps FSR IDs to extruded FSRs.

Returns
_extruded_FSR_lookup map of FSR keys to extruded FSRs

◆ getFSRCentroid()

Point * Geometry::getFSRCentroid ( long  fsr_id)

Return the centroid for a given FSR ID.

Parameters
fsr_idthe FSR ID
Returns
the FSR's centroid

◆ getFSRId()

long Geometry::getFSRId ( LocalCoords coords,
bool  err_check = true 
)

Return the ID of the flat source region that a given LocalCoords object resides within.

Parameters
coordsa LocalCoords object pointer
err_checkwhether to fail instead of returning -1 if not found
Returns
the FSR ID for a given LocalCoords object

◆ getFSRKey()

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.

Parameters
coordsa LocalCoords object pointer
Returns
the FSR key

◆ getFSRKeyFast()

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.

Parameters
coordsa LocalCoords object pointer
keya reference to the FSR key

◆ getFSRKeysMap()

ParallelHashMap< std::string, fsr_data * > & Geometry::getFSRKeysMap ( )

Returns a pointer to the map that maps FSR keys to FSR IDs.

Returns
pointer to _FSR_keys_map map of FSR keys to FSR IDs

◆ getFSRPoint()

Point * Geometry::getFSRPoint ( long  fsr_id)

Return the characteristic point for a given FSR ID.

Parameters
fsr_idthe FSR ID
Returns
the FSR's characteristic point

◆ getFSRsToCentroids()

std::vector< Point * > & Geometry::getFSRsToCentroids ( )

Return a vector indexed by flat source region IDs which contains pointers to the corresponding Centroid information.

Returns
an array of centroid pointers indexed by FSR ID

◆ getFSRsToCMFDCells()

std::vector< int > & Geometry::getFSRsToCMFDCells ( )

Return a vector indexed by flat source region IDs which contains the corresponding CMFD cell.

Returns
an integer vector of FSR to CMFD cell IDs indexed by FSR ID

◆ getFSRsToKeys()

std::vector< std::string > & Geometry::getFSRsToKeys ( )

Returns the vector that maps FSR IDs to FSR key hashes.

Returns
_FSR_keys_map map of FSR keys to FSR IDs

◆ getFSRsToMaterialIDs()

std::vector< int > & Geometry::getFSRsToMaterialIDs ( )

Returns a vector indexed by flat source region IDs which contains the corresponding Material IDs.

Returns
an integer vector of FSR-to-Material IDs indexed by FSR ID

◆ getGlobalFSRCentroidData()

std::vector< double > Geometry::getGlobalFSRCentroidData ( long  global_fsr_id)

Returns the FSR centroid of a global FSR.

Parameters
global_fsr_idThe global unique identifier of the FSR
Returns
A vector containing the coordinates of the FSR centroid

◆ getGlobalFSRId()

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.

Parameters
coordsa LocalCoords object pointer
err_checkwhether to fail instead of returning -1 if not found
Returns
the FSR ID for a given LocalCoords object

◆ getMaxX()

double Geometry::getMaxX ( )

Return the maximum x-coordinate contained by the Geometry.

Returns
the maximum x-coordinate (cm)

◆ getMaxXBoundaryType()

boundaryType Geometry::getMaxXBoundaryType ( )

Returns the boundary conditions at the maximum x-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the maximum x-coordinate in the domain

◆ getMaxY()

double Geometry::getMaxY ( )

Return the maximum y-coordinate contained by the Geometry.

Returns
the maximum y-coordinate (cm)

◆ getMaxYBoundaryType()

boundaryType Geometry::getMaxYBoundaryType ( )

Returns the boundary conditions at the maximum y-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the maximum y-coordinate in the domain

◆ getMaxZ()

double Geometry::getMaxZ ( )

Return the maximum z-coordinate contained by the Geometry.

Returns
the maximum z-coordinate (cm)

◆ getMaxZBoundaryType()

boundaryType Geometry::getMaxZBoundaryType ( )

Returns the boundary conditions at the maximum z-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the maximum z-coordinate in the domain

◆ getMinX()

double Geometry::getMinX ( )

Return the minimum x-coordinate contained by the Geometry.

Returns
the minimum x-coordinate (cm)

◆ getMinXBoundaryType()

boundaryType Geometry::getMinXBoundaryType ( )

Returns the boundary conditions at the minimum x-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the minimum x-coordinate in the domain

◆ getMinY()

double Geometry::getMinY ( )

Return the minimum y-coordinate contained by the Geometry.

Returns
the minimum y-coordinate (cm)

◆ getMinYBoundaryType()

boundaryType Geometry::getMinYBoundaryType ( )

Returns the boundary conditions at the minimum y-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the minimum y-coordinate in the domain

◆ getMinZ()

double Geometry::getMinZ ( )

Return the minimum z-coordinate contained by the Geometry.

Returns
the minimum z-coordinate (cm)

◆ getMinZBoundaryType()

boundaryType Geometry::getMinZBoundaryType ( )

Returns the boundary conditions at the minimum z-coordinate in the Geometry / domain if the geometry is domain-decomposed.

Returns
the boundary conditions for the minimum z-coordinate in the domain

◆ getNumCells()

int Geometry::getNumCells ( )

Returns the number of Cells in the Geometry.

Returns
the number of Cells

◆ getNumDigits()

int Geometry::getNumDigits ( int  number)

Get the number of digits in base 10 of a number.

Using std::stringstream would be more clear.

Parameters
numberthe number of interest
Returns
the number of digits in base 10 of a number

◆ getNumEnergyGroups()

int Geometry::getNumEnergyGroups ( )

Returns the number of energy groups for each Material's nuclear data.

Returns
the number of energy groups

◆ getNumFSRs()

long Geometry::getNumFSRs ( )

Returns the number of source regions in the Geometry domain.

Returns
number of FSRs

◆ getNumMaterials()

int Geometry::getNumMaterials ( )

Returns the number of Materials in the Geometry.

Returns
the number of Materials

◆ getNumTotalFSRs()

long Geometry::getNumTotalFSRs ( )

Returns the number of source regions in the entire Geometry.

Returns
number of FSRs

◆ getNumXModules()

int Geometry::getNumXModules ( )

Get the number of modular domains in the x-direction per MPI domain.

Returns
_num_modules_x number of modular domains in the x-direction in domain

◆ getNumYModules()

int Geometry::getNumYModules ( )

Get the number of modular domains in the y-direction per MPI domain.

Returns
_num_modules_y number of modular domains in the y-direction in domain

◆ getNumZModules()

int Geometry::getNumZModules ( )

Get the number of modular domains in the z-direction per MPI domain.

Returns
_num_modules_z number of modular domains in the z-direction in domain

◆ getRootUniverse()

Universe * Geometry::getRootUniverse ( )

Returns the Universe at the root node in the CSG tree.

Returns
the root Universe

◆ getSpatialDataOnGrid()

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:

grid_x = numpy.arange(-2., +2., 100)
grid_y = numpy.arange(-2., +2., 100)
domain_ids = geometry.getSpatialDataOnGrid(
grid_x, grid_y, 20., 'xy', 'material')
Parameters
dim1a numpy array of the first dimension's coordinates
dim2a numpy array of the second dimension's coordinates
offsetThe coordinate at which the plane is located
planeThe plane for which data is gathered ('xy', 'xz', 'yz')
domain_typethe type of domain ('fsr', 'material', 'cell')
Returns
a NumPy array or list of the domain IDs

◆ getSymmetry()

bool Geometry::getSymmetry ( int  axis)

Get the symmetries used to restrict the domain.

Returns
a boolean indicating if the symmetry along this axis is used

◆ getUniqueZHeights()

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.

Parameters
include_overlaid_meshwhether to include an overlaid mesh in the set of unique z-coords
Returns
a vector of z-coords

◆ getUniqueZPlanes()

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.

Returns
a vector of z-coords

◆ getWidthX()

double Geometry::getWidthX ( )

Returns the total width in the x-direction of the Geometry in cm.

Returns
the total width of the Geometry in the x-direction (cm)

◆ getWidthY()

double Geometry::getWidthY ( )

Returns the total width in the y-direction of the Geometry in cm.

Returns
the total width of the Geometry in the y-direction (cm)

◆ getWidthZ()

double Geometry::getWidthZ ( )

Returns the total width in the z-direction of the Geometry in cm.

Returns
the total width of the Geometry in the z-direction (cm)

◆ initializeAxialFSRs()

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.

Parameters
global_z_meshA 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.

◆ initializeFlatSourceRegions()

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.

◆ initializeFSRVectors()

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.

◆ isDomainDecomposed()

bool Geometry::isDomainDecomposed ( )

Returns whether the Geometry is domain decomposed.

Returns
If the domain is decomposed (true) or not (false)

◆ isRootDomain()

bool Geometry::isRootDomain ( )

Returns whether this MPI domain is the root domain.

Returns
If this domain is the root domain (true) or not (false)

◆ loadFromFile()

void Geometry::loadFromFile ( std::string  filename,
bool  twiddle = false 
)

Loads all Geometry and Material details from a Geometry restart file.

Parameters
filenameThe name of the file from which the data is loaded
twiddleWhether the bytes are inverted (BGQ) or not

◆ printFSRsToFile()

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

Parameters
planeThe "xy", "xz", or "yz" plane in which to extract flat source regions
gridsizeThe number of points to plot in each direction
offsetThe offset of the plane in the third dimension
bounds_xa two valued array for the plotted x-limits
bounds_ya two valued array for the plotted y-limits
bounds_za two valued array for the plotted z-limits

◆ printString()

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.

◆ printToString()

void Geometry::printToString ( std::string &  str,
int &  index,
int  value 
)

Print a number to a given String.

Using std::stringstream would be more clear.

Parameters
strthe string to print to
indexthe last index in that string
valuethe number to print
Returns
the number of digits in base 10 of a number

◆ reserveKeyStrings()

void Geometry::reserveKeyStrings ( int  num_threads)

reserves the FSR key strings

Parameters
num_threadsthe number of threads

◆ segmentize2D()

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.

Parameters
tracka pointer to a track to segmentize
z_coordthe axial height at which the 2D plane of the geometry is formed

◆ segmentize3D()

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.

Parameters
tracka pointer to a track to segmentize
OTF_setupwhether this routine is called during OTF ray tracing setup

◆ segmentizeExtruded()

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.

Parameters
flattened_tracka pointer to a 2D track to segmentize into regions of extruded FSRs
z_coordsa vector of axial heights in the root geometry at which the Geometry is segmentized radially

◆ setCmfd()

void Geometry::setCmfd ( Cmfd cmfd)

Sets the pointer to a CMFD object used for acceleration.

Parameters
cmfda pointer to the CMFD object

◆ setFSRCentroid()

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.

Parameters
fsra FSR id
centroida Point representing the FSR centroid

◆ setNumDomainModules()

void Geometry::setNumDomainModules ( int  num_x,
int  num_y,
int  num_z 
)

Sets how many modular track laydown domains are in each MPI domain.

Parameters
num_xThe number of modular domains in the x-direction per MPI domain
num_yThe number of modular domains in the y-direction per MPI domain
num_zThe number of modular domains in the z-direction per MPI domain

◆ setOverlaidMesh()

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

Parameters
axial_mesh_heightThe desired height of axial mesh cells
num_xnumber of divisions in the X direction
num_ynumber of divisions in the Y direction
num_radial_domainsnumber of radial domains
radial_domainsarray with the indexes of each domain in X and Y

◆ setRootUniverse()

void Geometry::setRootUniverse ( Universe root_universe)

Sets the root Universe for the CSG tree.

Parameters
root_universethe root Universe of the CSG tree.

◆ subdivideCells()

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:

geometry.subdivideCells()

◆ toString()

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.

Returns
a character array of this Geometry's class attributes

◆ twiddleRead() [1/9]

size_t Geometry::twiddleRead ( int *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an integer array from file.

Parameters
ptrthe integer array to fill with the data read
sizethe size of each element to read (here size(int))
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [2/9]

size_t Geometry::twiddleRead ( bool *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read a boolean array from file.

Parameters
ptrthe boolean array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [3/9]

size_t Geometry::twiddleRead ( char *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of char from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [4/9]

size_t Geometry::twiddleRead ( universeType ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of universeType from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [5/9]

size_t Geometry::twiddleRead ( cellType ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of cellType from file.

Parameters
ptrthe array to fill with the read data
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [6/9]

size_t Geometry::twiddleRead ( surfaceType ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of surfaceType from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [7/9]

size_t Geometry::twiddleRead ( boundaryType ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of boundaryType from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [8/9]

size_t Geometry::twiddleRead ( double *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of double from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ twiddleRead() [9/9]

size_t Geometry::twiddleRead ( long *  ptr,
size_t  size,
size_t  nmemb,
FILE *  stream 
)

Read an array of long int from file.

Parameters
ptrthe array to fill with the data read
sizethe size of each element to read
nmembthe number of elements to read
streamthe file to read from
Returns
the return status of the read operation

◆ useSymmetry()

void Geometry::useSymmetry ( bool  X_symmetry,
bool  Y_symmetry,
bool  Z_symmetry 
)

Take into account domain symmetries to reduce the problem domain.

Parameters
X_symmetrywhether the domain is symmetric in X
Y_symmetrywhether the domain is symmetric in Y
Z_symmetrywhether the domain is symmetric in Z

◆ withinBounds()

bool Geometry::withinBounds ( LocalCoords coords)

Determines whether a point is within the bounding box of the domain.

Parameters
coordsa populated LocalCoords linked list
Returns
boolean indicating whether the coords is within the domain

◆ withinGlobalBounds()

bool Geometry::withinGlobalBounds ( LocalCoords coords)

Determines whether a point is within the bounding box of the Geometry.

Parameters
coordsa populated LocalCoords linked list
Returns
boolean indicating whether the coords is within the geometry

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