18 #include <sys/types.h> 131 std::vector<std::string> _FSRs_to_keys;
134 std::vector<Point*> _FSRs_to_centroids;
137 bool _contains_FSR_centroids;
140 std::vector<int> _FSRs_to_material_IDs;
143 std::vector<ExtrudedFSR*> _extruded_FSR_lookup;
146 std::vector<int> _FSRs_to_CMFD_cells;
158 std::map<int, Material*> _all_materials;
161 std::vector<std::string> _fsr_keys;
164 bool _domain_decomposed;
167 bool _domain_FSRs_counted;
183 std::vector<long> _num_domain_FSRs;
198 std::vector<bool> _symmetries;
205 bool _loaded_from_file;
208 Cell* findFirstCell(
LocalCoords* coords,
double azim,
double polar=M_PI_2);
222 void useSymmetry(
bool X_symmetry,
bool Y_symmetry,
bool Z_symmetry);
264 void setDomainDecomposition(
int nx,
int ny,
int nz, MPI_Comm comm);
265 MPI_Comm getMPICart();
289 int getNeighborDomain(
int offset_x,
int offset_y,
int offset_z);
296 int num_y=0,
int num_radial_domains=0,
297 int* radial_domains=NULL);
317 std::vector<double> z_coords);
325 std::vector<double> dim2,
328 const char* domain_type);
332 double offset=0.0,
double* bounds_x = NULL,
333 double* bounds_y = NULL,
double* bounds_z = NULL);
340 void countDomainFSRs();
341 void getLocalFSRId(
long global_fsr_id,
long &local_fsr_id,
int &domain);
349 void loadFromFile(std::string filename,
bool twiddle=
false);
350 size_t twiddleRead(
int* ptr,
size_t size,
size_t nmemb, FILE* stream);
351 size_t twiddleRead(
bool* ptr,
size_t size,
size_t nmemb, FILE* stream);
352 size_t twiddleRead(
char* ptr,
size_t size,
size_t nmemb, FILE* stream);
357 size_t twiddleRead(
double* ptr,
size_t size,
size_t nmemb, FILE* stream);
358 size_t twiddleRead(
long* ptr,
size_t size,
size_t nmemb, FILE* stream);
double getWidthY()
Returns the total width in the y-direction of the Geometry in cm.
Definition: Geometry.cpp:118
void initializeFSRVectors()
Initialize key and material ID vectors for lookup by FSR ID.
Definition: Geometry.cpp:2733
double getMaxX()
Return the maximum x-coordinate contained by the Geometry.
Definition: Geometry.cpp:153
void manipulateXS()
Modify scattering and total cross sections to study MOC stability.
Definition: Geometry.cpp:468
Represents a Cell inside of a Universe.
Definition: Cell.h:56
std::map< int, Surface * > getAllSurfaces()
Return a std::map container of Surface IDs (keys) with Surfaces pointers (values).
Definition: Geometry.cpp:405
Material ** _materials
Definition: Geometry.h:100
The LocalCoords represents a set of local coordinates on some level of nested Universes making up the...
Definition: LocalCoords.h:46
Point * _point
Definition: Geometry.h:60
int getDomainByCoords(LocalCoords *coords)
Returns the rank of the domain containing the given coordinates.
Definition: Geometry.cpp:1372
ParallelHashMap< std::string, ExtrudedFSR * > & getExtrudedFSRKeysMap()
Returns a pointer to the map that maps FSR keys to extruded FSRs.
Definition: Geometry.cpp:3255
Point * getFSRPoint(long fsr_id)
Return the characteristic point for a given FSR ID.
Definition: Geometry.cpp:1466
boundaryType getMaxXBoundaryType()
Returns the boundary conditions at the maximum x-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:255
Geometry()
Constructor initializes an empty Geometry.
Definition: Geometry.cpp:18
int getNumDigits(int number)
Get the number of digits in base 10 of a number.
Definition: Geometry.cpp:1786
long getFSRId(LocalCoords *coords, bool err_check=true)
Return the ID of the flat source region that a given LocalCoords object resides within.
Definition: Geometry.cpp:1339
double getMaxY()
Return the maximum y-coordinate contained by the Geometry.
Definition: Geometry.cpp:188
bool containsFSRCentroids()
Returns whether any FSR centroids have been set.
Definition: Geometry.cpp:1500
int getNumXModules()
Get the number of modular domains in the x-direction per MPI domain.
Definition: Geometry.cpp:653
void loadFromFile(std::string filename, bool twiddle=false)
Loads all Geometry and Material details from a Geometry restart file.
Definition: Geometry.cpp:3964
Cell * findCellContainingCoords(LocalCoords *coords)
Find the Cell that this LocalCoords object is in at the lowest level of the nested Universe hierarchy...
Definition: Geometry.cpp:973
boundaryType getMaxYBoundaryType()
Returns the boundary conditions at the maximum y-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:281
boundaryType
The types of boundary conditions supported by OpenMOC for Surfaces.
Definition: boundary_type.h:15
std::map< int, Cell * > getAllMaterialCells()
Return a std::map container of Cell IDs (keys) with Cells pointers (values).
Definition: Geometry.cpp:521
std::map< Cell *, std::vector< long > > getCellsToFSRs()
Returns a map from cells to FSRs.
Definition: Geometry.cpp:1399
int getNumEnergyGroups()
Returns the number of energy groups for each Material's nuclear data.
Definition: Geometry.cpp:343
long findFSRId(LocalCoords *coords)
Find and return the ID of the flat source region that a given LocalCoords object resides within...
Definition: Geometry.cpp:1210
A Universe represents an unbounded space in 3D.
Definition: Universe.h:58
std::string getFSRKey(LocalCoords *coords)
Generate a string FSR "key" for the FSR where the point reside in. A string FSR "key" identifies an F...
Definition: Geometry.cpp:1836
surfaceType
The types of surfaces supported by OpenMOC.
Definition: Surface.h:40
bool getSymmetry(int axis)
Get the symmetries used to restrict the domain.
Definition: Geometry.cpp:747
void dumpToFile(std::string filename)
Prints all Geometry and Material details to a Geometry restart file.
Definition: Geometry.cpp:3607
void printToString(std::string &str, int &index, int value)
Print a number to a given String.
Definition: Geometry.cpp:1807
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.
Definition: Geometry.cpp:878
size_t twiddleRead(int *ptr, size_t size, size_t nmemb, FILE *stream)
Read an integer array from file.
Definition: Geometry.cpp:4413
bool withinGlobalBounds(LocalCoords *coords)
Determines whether a point is within the bounding box of the Geometry.
Definition: Geometry.cpp:3332
std::string toString()
Converts this Geometry's attributes to a character array.
Definition: Geometry.cpp:2956
bool withinBounds(LocalCoords *coords)
Determines whether a point is within the bounding box of the domain.
Definition: Geometry.cpp:3313
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...
Definition: Geometry.cpp:3398
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 ...
Definition: Geometry.cpp:2284
Class to represent a 2D/3D point in space.
Definition: Point.h:24
Material * findFSRMaterial(long fsr_id)
Find the Material for a flat source region ID.
Definition: Geometry.cpp:1031
double getWidthX()
Returns the total width in the x-direction of the Geometry in cm.
Definition: Geometry.cpp:109
An object to track progress.
double getMinZ()
Return the minimum z-coordinate contained by the Geometry.
Definition: Geometry.cpp:206
void reorderFSRIDs()
Reorders FSRs so that they are contiguous in the axial direction.
Definition: Geometry.cpp:2665
void getFSRKeyFast(LocalCoords *coords, std::string &key)
Generate a string FSR "key" that identifies an FSR by its unique hierarchical lattice/universe/cell s...
Definition: Geometry.cpp:1647
size_t _num_fsrs
Definition: Geometry.h:103
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.
Definition: Geometry.cpp:2893
A 3D Track represents a characteristic line across the geometry.
Definition: Track3D.h:35
fsr_data()
Definition: Geometry.h:47
int _mat_id
Definition: Geometry.h:57
int getNumZModules()
Get the number of modular domains in the z-direction per MPI domain.
Definition: Geometry.cpp:671
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials.
Definition: Geometry.h:122
void setRootUniverse(Universe *root_universe)
Sets the root Universe for the CSG tree.
Definition: Geometry.cpp:625
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.
Definition: Geometry.cpp:3005
double getMaxZ()
Return the maximum z-coordinate contained by the Geometry.
Definition: Geometry.cpp:223
void useSymmetry(bool X_symmetry, bool Y_symmetry, bool Z_symmetry)
Take into account domain symmetries to reduce the problem domain.
Definition: Geometry.cpp:682
~fsr_data()
Definition: Geometry.h:66
void initializeCmfd()
This is a method that initializes the CMFD Lattice and sets CMFD parameters.
Definition: Geometry.cpp:3121
void reset_auto_ids()
Resets the auto-generated unique IDs for Materials, Surfaces, Cells and Universes/Lattices to 10000...
Definition: Geometry.cpp:7
Point * getFSRCentroid(long fsr_id)
Return the centroid for a given FSR ID.
Definition: Geometry.cpp:1487
void segmentize3D(Track3D *track, bool setup=false)
This method performs ray tracing to create Track segments within each flat source region in the Geome...
Definition: Geometry.cpp:2146
int findExtrudedFSR(LocalCoords *coords)
Finds and returns a pointer to the axially extruded flat source region that a given LocalCoords objec...
Definition: Geometry.cpp:1276
bool isDomainDecomposed()
Returns whether the Geometry is domain decomposed.
Definition: Geometry.cpp:580
ExtrudedFSR * getExtrudedFSR(int extruded_fsr_id)
Return a pointer to an ExtrudedFSR by its extruded FSR ID.
Definition: Geometry.cpp:1926
int _fsr_id
Definition: Geometry.h:94
void setNumDomainModules(int num_x, int num_y, int num_z)
Sets how many modular track laydown domains are in each MPI domain.
Definition: Geometry.cpp:639
long * _fsr_ids
Definition: Geometry.h:97
void initializeFlatSourceRegions()
Compute the number of flat source regions in the Geometry and initialize CMFD.
Definition: Geometry.cpp:1962
void printString()
Prints a string representation of all of the Geometry's attributes to the console.
Definition: Geometry.cpp:2988
double * _mesh
Definition: Geometry.h:91
std::vector< std::string > & getFSRsToKeys()
Returns the vector that maps FSR IDs to FSR key hashes.
Definition: Geometry.cpp:3264
int _cmfd_cell
Definition: Geometry.h:54
long getGlobalFSRId(LocalCoords *coords, bool err_check=true)
Return the global ID of the flat source region that a given LocalCoords object resides within...
Definition: Geometry.cpp:1429
void initializeAxialFSRs(std::vector< double > global_z_mesh)
Rays are shot vertically through each ExtrudedFSR struct to calculate the axial mesh and initialize 3...
Definition: Geometry.cpp:2534
Cell * findCellContainingFSR(long fsr_id)
Finds the Cell containing a given fsr ID.
Definition: Geometry.cpp:3351
boundaryType getMinYBoundaryType()
Returns the boundary conditions at the minimum y-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:268
LocalCoords * _coords
Definition: Geometry.h:106
A class for Coarse Mesh Finite Difference (CMFD) acceleration.
Definition: Cmfd.h:51
std::map< int, Cell * > getAllCells()
Return a std::map container of Cell IDs (keys) with Cells pointers (values).
Definition: Geometry.cpp:505
The Material class represents a unique material and its relevant nuclear data (i.e., multigroup cross-sections) for neutron transport.
Definition: Material.h:51
void reserveKeyStrings(int num_threads)
reserves the FSR key strings
Definition: Geometry.cpp:1627
A thread-safe hash map supporting insertion and lookup operations.
std::vector< ExtrudedFSR * > & getExtrudedFSRLookup()
Returns the vector that maps FSR IDs to extruded FSRs.
Definition: Geometry.cpp:3273
boundaryType getMinXBoundaryType()
Returns the boundary conditions at the minimum x-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:242
ExtrudedFSR()
Definition: Geometry.h:87
long getNumFSRs()
Returns the number of source regions in the Geometry domain.
Definition: Geometry.cpp:319
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 fro...
Definition: Geometry.cpp:1065
long _fsr_id
Definition: Geometry.h:51
void fixFSRMaps()
Fixes the FSR map size so that the map is static and fast.
Definition: Geometry.cpp:2515
void computeFissionability(Universe *univ=NULL)
Determines the fissionability of each Universe within this Geometry.
Definition: Geometry.cpp:2816
Point * _centroid
Definition: Geometry.h:63
void setFSRCentroid(long fsr, Point *centroid)
Sets the centroid for an FSR.
Definition: Geometry.cpp:3379
long getNumTotalFSRs()
Returns the number of source regions in the entire Geometry.
Definition: Geometry.cpp:328
std::vector< double > getUniqueZPlanes()
Returns a vector of z-coords defining potential unique radial planes in the Geometry.
Definition: Geometry.cpp:3579
virtual ~Geometry()
Destructor clears FSR to Cells and Materials maps.
Definition: Geometry.cpp:45
boundaryType getMaxZBoundaryType()
Returns the boundary conditions at the maximum z-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:307
int getNumMaterials()
Returns the number of Materials in the Geometry.
Definition: Geometry.cpp:369
double getWidthZ()
Returns the total width in the z-direction of the Geometry in cm.
Definition: Geometry.cpp:127
void getDomainStructure(int *structure)
Returns the number of domains in each direction.
Definition: Geometry.cpp:614
int getCmfdCell(long fsr_id)
Return the CMFD cell for a given FSR ID.
Definition: Geometry.cpp:1618
ParallelHashMap< std::string, fsr_data * > & getFSRKeysMap()
Returns a pointer to the map that maps FSR keys to FSR IDs.
Definition: Geometry.cpp:3246
std::map< int, Universe * > getAllUniverses()
Return a std::map container of Universe IDs (keys) with Universes pointers (values).
Definition: Geometry.cpp:547
void clearBoundaries()
Clears all boundary conditions from the Geometry.
Definition: Geometry.cpp:939
bool isRootDomain()
Returns whether this MPI domain is the root domain.
Definition: Geometry.cpp:589
std::vector< Point * > & getFSRsToCentroids()
Return a vector indexed by flat source region IDs which contains pointers to the corresponding Centro...
Definition: Geometry.cpp:3293
std::vector< int > & getFSRsToCMFDCells()
Return a vector indexed by flat source region IDs which contains the corresponding CMFD cell...
Definition: Geometry.cpp:3303
void segmentize2D(Track *track, double z_coord)
This method performs ray tracing to create Track segments within each flat source region in the Geome...
Definition: Geometry.cpp:1999
std::map< int, Material * > getAllMaterials()
Return a std::map container of Material IDs (keys) with Materials pointers (values).
Definition: Geometry.cpp:438
double getMinY()
Return the minimum y-coordinate contained by the Geometry.
Definition: Geometry.cpp:171
void subdivideCells()
Subdivides all Cells in the Geometry into rings and angular sectors aligned with the z-axis...
Definition: Geometry.cpp:1941
Represents a repeating 3D Lattice of Universes.
Definition: Universe.h:156
int getNumYModules()
Get the number of modular domains in the y-direction per MPI domain.
Definition: Geometry.cpp:662
std::vector< int > & getFSRsToMaterialIDs()
Returns a vector indexed by flat source region IDs which contains the corresponding Material IDs...
Definition: Geometry.cpp:3283
void getDomainIndexes(int *indexes)
Returns the domain indexes of the current domain.
Definition: Geometry.cpp:603
boundaryType getMinZBoundaryType()
Returns the boundary conditions at the minimum z-coordinate in the Geometry / domain if the geometry ...
Definition: Geometry.cpp:294
Universe * getRootUniverse()
Returns the Universe at the root node in the CSG tree.
Definition: Geometry.cpp:562
Cmfd * getCmfd()
Returns a pointer to the CMFD object.
Definition: Geometry.cpp:571
A Track represents a characteristic line across the geometry.
Definition: Track.h:67
A thread-safe hash map supporting insertion and lookup operations.
Definition: ParallelHashMap.h:76
void initializeSpectrumCalculator(Cmfd *spectrum_calculator)
This is a method that initializes the initial spectrum calculator.
Definition: Geometry.cpp:3180
double getMinX()
Return the minimum x-coordinate contained by the Geometry.
Definition: Geometry.cpp:136
int getNumCells()
Returns the number of Cells in the Geometry.
Definition: Geometry.cpp:387
universeType
The type of universe.
Definition: Universe.h:40
cellType
The type of cell.
Definition: Cell.h:39
void setCmfd(Cmfd *cmfd)
Sets the pointer to a CMFD object used for acceleration.
Definition: Geometry.cpp:864
An ExtrudedFSR struct represents a FSR region in the superposition plane for axial on-the-fly ray tra...
Definition: Geometry.h:84
std::vector< double > getGlobalFSRCentroidData(long global_fsr_id)
Returns the FSR centroid of a global FSR.
Definition: Geometry.cpp:1568
A fsr_data struct represents an FSR with a unique FSR ID and a characteristic point that lies within ...
Definition: Geometry.h:44