CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model. More...
#include <CSGBase.h>
Public Member Functions | |
| CSGBase () | |
| Default constructor. More... | |
| CSGBase (const CSGBase &other_base) | |
| Copy constructor. More... | |
| ~CSGBase () | |
| Destructor. More... | |
| std::unique_ptr< CSGBase > | clone () const |
| Create a deep copy of this CSGBase instance. More... | |
| const CSGSurface & | addSurface (std::unique_ptr< CSGSurface > surf) |
| add a unique surface pointer to this base instance More... | |
| std::vector< std::reference_wrapper< const CSGSurface > > | getAllSurfaces () const |
| Get all surface objects. More... | |
| const CSGSurface & | getSurfaceByName (const std::string &name) const |
| Get a Surface object by name. More... | |
| void | renameSurface (const CSGSurface &surface, const std::string &name) |
| rename the specified surface More... | |
| const CSGCell & | createCell (const std::string &name, const std::string &mat_name, const CSGRegion ®ion, const CSGUniverse *add_to_univ=nullptr) |
| Create a Material Cell object. More... | |
| const CSGCell & | createCell (const std::string &name, const CSGRegion ®ion, const CSGUniverse *add_to_univ=nullptr) |
| Create a Void Cell object. More... | |
| const CSGCell & | createCell (const std::string &name, const CSGUniverse &fill_univ, const CSGRegion ®ion, const CSGUniverse *add_to_univ=nullptr) |
| Create a Universe Cell object. More... | |
| std::vector< std::reference_wrapper< const CSGCell > > | getAllCells () const |
| Get all cell objects. More... | |
| const CSGCell & | getCellByName (const std::string &name) const |
| Get a Cell object by name. More... | |
| void | renameCell (const CSGCell &cell, const std::string &name) |
| rename the specified cell More... | |
| void | updateCellRegion (const CSGCell &cell, const CSGRegion ®ion) |
| change the region of the specified cell More... | |
| const CSGUniverse & | getRootUniverse () const |
| Get the Root Universe object. More... | |
| void | renameRootUniverse (const std::string &name) |
| rename the root universe for this instance (default is ROOT_UNIVERSE) More... | |
| void | renameUniverse (const CSGUniverse &universe, const std::string &name) |
| rename the specified universe More... | |
| const CSGUniverse & | createUniverse (const std::string &name) |
| Create an empty Universe object. More... | |
| const CSGUniverse & | createUniverse (const std::string &name, std::vector< std::reference_wrapper< const CSGCell >> &cells) |
| Create a Universe object from list of cells. More... | |
| void | addCellToUniverse (const CSGUniverse &universe, const CSGCell &cell) |
| Add a cell to an existing universe. More... | |
| void | addCellsToUniverse (const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells) |
| Add a list of cells to an existing universe. More... | |
| void | removeCellFromUniverse (const CSGUniverse &universe, const CSGCell &cell) |
| Remove a cell from an existing universe. More... | |
| void | removeCellsFromUniverse (const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells) |
| Remove a list of cells from an existing universe. More... | |
| std::vector< std::reference_wrapper< const CSGUniverse > > | getAllUniverses () const |
| Get all universe objects. More... | |
| const CSGUniverse & | getUniverseByName (const std::string &name) |
| Get a universe object by name. More... | |
| void | joinOtherBase (std::unique_ptr< CSGBase > base) |
| Join another CSGBase object to this one. More... | |
| void | joinOtherBase (std::unique_ptr< CSGBase > base, std::string &new_root_name_join) |
| Join another CSGBase object to this one. More... | |
| void | joinOtherBase (std::unique_ptr< CSGBase > base, const std::string &new_root_name_base, const std::string &new_root_name_join) |
| Join another CSGBase object to this one. More... | |
| nlohmann::json | generateOutput () const |
| generate the JSON representation output for the CSG object More... | |
| bool | operator== (const CSGBase &other) const |
| Operator overload for checking if two CSGBase objects are equal. More... | |
| bool | operator!= (const CSGBase &other) const |
| Operator overload for checking if two CSGBase objects are not equal. More... | |
Private Member Functions | |
| CSGSurface & | getSurface (const std::string &name) |
| Get a Surface object by name. More... | |
| void | checkUniverseLinking () const |
| Check universes linked to root universe match universes defined in _universe_list. More... | |
| void | getLinkedUniverses (const CSGUniverse &univ, std::vector< std::string > &linked_universe_names) const |
| Recursive method to retrieve all universes linked to current universe. More... | |
| const CSGSurfaceList & | getSurfaceList () const |
| Get a const reference to the CSGSurfaceList object. More... | |
| CSGSurfaceList & | getSurfaceList () |
| Get a non-const reference to the CSGSurfaceList object. More... | |
| const CSGCellList & | getCellList () const |
| Get a const reference to the CSGCellList object. More... | |
| CSGCellList & | getCellList () |
| Get a non-const reference to the CSGCellList object. More... | |
| const CSGUniverseList & | getUniverseList () const |
| Get a const reference to the CSGUniverseList object. More... | |
| CSGUniverseList & | getUniverseList () |
| Get a non-const reference to the CSGUniverseList object. More... | |
| void | joinSurfaceList (CSGSurfaceList &surf_list) |
| join a separate CSGSurfaceList object to this one More... | |
| void | joinCellList (CSGCellList &cell_list) |
| join a separate CSGCellList object to this one More... | |
| void | joinUniverseList (CSGUniverseList &univ_list) |
| join a separate CSGUniverseList object to this one; root universes from univ_list will be combined into this root universe More... | |
| void | joinUniverseList (CSGUniverseList &univ_list, const std::string &new_root_name_incoming) |
| join a separate CSGUniverseList object to this one; the incoming root universe will be moved to a new universe of the new name specified. More... | |
| void | joinUniverseList (CSGUniverseList &univ_list, const std::string &new_root_name_base, const std::string &new_root_name_incoming) |
| join a separate CSGUniverseList object to this one; both this root universe and the incoming root universe will be maintained as separate universes of the specified names. More... | |
| void | checkRegionSurfaces (const CSGRegion ®ion) const |
| bool | checkCellInBase (const CSGCell &cell) const |
| bool | checkUniverseInBase (const CSGUniverse &universe) const |
| const CSGCell & | addCellToList (const CSGCell &cell) |
| Add a new cell to the cell list based on a cell reference. More... | |
| const CSGUniverse & | addUniverseToList (const CSGUniverse &univ) |
| Add a new universe to the universe list based on a universe reference. More... | |
| FRIEND_TEST (CSGBaseTest, testCheckRegionSurfaces) | |
| Friends for unit testing. More... | |
| FRIEND_TEST (CSGBaseTest, testAddGetSurface) | |
| FRIEND_TEST (CSGBaseTest, testUniverseLinking) | |
Private Attributes | |
| CSGSurfaceList | _surface_list |
| List of surfaces associated with CSG object. More... | |
| CSGCellList | _cell_list |
| List of cells associated with CSG object. More... | |
| CSGUniverseList | _universe_list |
| List of universes associated with CSG object. More... | |
| CSG::CSGBase::CSGBase | ( | ) |
Default constructor.
Definition at line 15 of file CSGBase.C.
| CSG::CSGBase::CSGBase | ( | const CSGBase & | other_base | ) |
Copy constructor.
Definition at line 20 of file CSGBase.C.
| void CSG::CSGBase::addCellsToUniverse | ( | const CSGUniverse & | universe, |
| std::vector< std::reference_wrapper< const CSGCell >> & | cells | ||
| ) |
Add a list of cells to an existing universe.
| universe | universe to which to add the cells |
| cells | list of references to cells to add |
Definition at line 179 of file CSGBase.C.
Referenced by createUniverse().
Add a new cell to the cell list based on a cell reference.
This method is called by the copy constructor of CSGBase
| cell | reference to CSGCell that should be added to cell list |
Definition at line 48 of file CSGBase.C.
Referenced by addUniverseToList(), and CSGBase().
| void CSG::CSGBase::addCellToUniverse | ( | const CSGUniverse & | universe, |
| const CSGCell & | cell | ||
| ) |
Add a cell to an existing universe.
| universe | universe to which to add the cell |
| cell | cell to add |
Definition at line 162 of file CSGBase.C.
Referenced by addCellsToUniverse(), createCell(), CSGBase(), and joinUniverseList().
|
inline |
add a unique surface pointer to this base instance
| surf | pointer to surface to add |
Definition at line 57 of file CSGBase.h.
|
private |
Add a new universe to the universe list based on a universe reference.
This method is called by the copy constructor of CSGBase
| univ | reference to CSGUniverse that should be added to universe list |
Definition at line 75 of file CSGBase.C.
Referenced by addCellToList(), and CSGBase().
|
private |
Definition at line 342 of file CSGBase.C.
Referenced by addCellToUniverse(), removeCellFromUniverse(), and updateCellRegion().
Definition at line 325 of file CSGBase.C.
Referenced by createCell(), and updateCellRegion().
|
private |
Definition at line 352 of file CSGBase.C.
Referenced by addCellToUniverse(), and removeCellFromUniverse().
|
private |
Check universes linked to root universe match universes defined in _universe_list.
Definition at line 362 of file CSGBase.C.
Referenced by generateOutput().
|
inline |
| const CSGCell & CSG::CSGBase::createCell | ( | const std::string & | name, |
| const std::string & | mat_name, | ||
| const CSGRegion & | region, | ||
| const CSGUniverse * | add_to_univ = nullptr |
||
| ) |
Create a Material Cell object.
| name | unique cell name |
| mat_name | material name |
| region | cell region |
| add_to_univ | (optional) universe to which this cell will be added (default is root universe) |
Definition at line 93 of file CSGBase.C.
| const CSGCell & CSG::CSGBase::createCell | ( | const std::string & | name, |
| const CSGRegion & | region, | ||
| const CSGUniverse * | add_to_univ = nullptr |
||
| ) |
Create a Void Cell object.
| name | unique cell name |
| region | cell region |
| add_to_univ | (optional) universe to which this cell will be added (default is root universe) |
Definition at line 108 of file CSGBase.C.
| const CSGCell & CSG::CSGBase::createCell | ( | const std::string & | name, |
| const CSGUniverse & | fill_univ, | ||
| const CSGRegion & | region, | ||
| const CSGUniverse * | add_to_univ = nullptr |
||
| ) |
Create a Universe Cell object.
| name | unique cell name |
| fill_univ | universe that will fill the cell |
| region | cell region |
| add_to_univ | (optional) universe to which this cell will be added (default is root universe) |
Definition at line 122 of file CSGBase.C.
|
inline |
Create an empty Universe object.
| name | unique universe name |
Definition at line 208 of file CSGBase.h.
Referenced by addUniverseToList(), and joinUniverseList().
| const CSGUniverse & CSG::CSGBase::createUniverse | ( | const std::string & | name, |
| std::vector< std::reference_wrapper< const CSGCell >> & | cells | ||
| ) |
Create a Universe object from list of cells.
| name | unique universe name |
| cells | list of cells to add to universe |
Definition at line 153 of file CSGBase.C.
|
private |
Friends for unit testing.
|
private |
|
private |
| nlohmann::json CSG::CSGBase::generateOutput | ( | ) | const |
generate the JSON representation output for the CSG object
Definition at line 389 of file CSGBase.C.
|
inline |
Get all cell objects.
Definition at line 142 of file CSGBase.h.
Referenced by generateOutput().
|
inline |
Get all surface objects.
Definition at line 67 of file CSGBase.h.
Referenced by generateOutput().
|
inline |
Get all universe objects.
Definition at line 262 of file CSGBase.h.
Referenced by checkUniverseLinking(), and generateOutput().
|
inline |
Get a Cell object by name.
| name | cell name |
Definition at line 153 of file CSGBase.h.
|
inlineprivate |
Get a const reference to the CSGCellList object.
Definition at line 370 of file CSGBase.h.
Referenced by CSGBase(), and operator==().
|
inlineprivate |
Get a non-const reference to the CSGCellList object.
Definition at line 377 of file CSGBase.h.
|
private |
Recursive method to retrieve all universes linked to current universe.
| univ | Reference to universe under consideration |
| linked_universe_name | List of universe names linked to current universe |
Definition at line 378 of file CSGBase.C.
Referenced by checkUniverseLinking().
|
inline |
Get the Root Universe object.
Definition at line 179 of file CSGBase.h.
Referenced by checkUniverseLinking(), createCell(), CSGBase(), and joinUniverseList().
|
inlineprivate |
Get a Surface object by name.
Note: This is a private method that returns a non-const reference. For the public method that returns a const reference, use getSurfaceByName
| name | surface name |
Definition at line 337 of file CSGBase.h.
|
inline |
Get a Surface object by name.
| name | surface name |
Definition at line 78 of file CSGBase.h.
|
inlineprivate |
Get a const reference to the CSGSurfaceList object.
Definition at line 356 of file CSGBase.h.
Referenced by operator==().
|
inlineprivate |
Get a non-const reference to the CSGSurfaceList object.
Definition at line 363 of file CSGBase.h.
|
inline |
Get a universe object by name.
| name | universe name |
Definition at line 273 of file CSGBase.h.
|
inlineprivate |
Get a const reference to the CSGUniverseList object.
Definition at line 384 of file CSGBase.h.
Referenced by CSGBase(), and operator==().
|
inlineprivate |
Get a non-const reference to the CSGUniverseList object.
Definition at line 391 of file CSGBase.h.
|
private |
join a separate CSGCellList object to this one
| cell_list | CSGCellList from a separate CSGBase object |
Definition at line 249 of file CSGBase.C.
Referenced by joinOtherBase().
Join another CSGBase object to this one.
The cells of the root universe of the incoming CSGBase will be added to the existing root universe of this CSGBase.
| base | pointer to a different CSGBase object |
Definition at line 212 of file CSGBase.C.
| void CSG::CSGBase::joinOtherBase | ( | std::unique_ptr< CSGBase > | base, |
| std::string & | new_root_name_join | ||
| ) |
Join another CSGBase object to this one.
For the incoming CSGBase object, the root universe is added to this CSGBase object as a new non-root universe with the specified new name. Note: this newly created universe will not be connected to the root universe of this CSGBase object by default.
| base | pointer to a different CSGBase object |
| new_root_name_join | new name for the universe generated from the incoming root universe |
Definition at line 220 of file CSGBase.C.
| void CSG::CSGBase::joinOtherBase | ( | std::unique_ptr< CSGBase > | base, |
| const std::string & | new_root_name_base, | ||
| const std::string & | new_root_name_join | ||
| ) |
Join another CSGBase object to this one.
The root universe for the incoming CSGBase object is added to this CSGBase object as a non-root universe with a new name. The root universe of this CSGBase object will be renamed and designated as non-root. Note: upon completion of this join method, the root universe of this CSGBase object will be empty. Neither of the new non-root universes will be connected to the new root universe by default.
| base | pointer to a different CSGBase object |
| new_root_name_base | new name for universe generated from this root universe |
| new_root_name_join | new name for the universe generated from the incoming root universe |
Definition at line 228 of file CSGBase.C.
|
private |
join a separate CSGSurfaceList object to this one
| surf_list | CSGSurfaceList from a separate CSGBase object |
Definition at line 238 of file CSGBase.C.
Referenced by joinOtherBase().
|
private |
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined into this root universe
| univ_list | CSGUniverseList from a separate CSGBase object |
Definition at line 257 of file CSGBase.C.
Referenced by joinOtherBase().
|
private |
join a separate CSGUniverseList object to this one; the incoming root universe will be moved to a new universe of the new name specified.
| univ_list | CSGUniverseList from a separate CSGBase object |
| new_root_name_incoming | new name for the universe generated from the incoming root universe |
Definition at line 277 of file CSGBase.C.
|
private |
join a separate CSGUniverseList object to this one; both this root universe and the incoming root universe will be maintained as separate universes of the specified names.
Note: upon completion of this join method, the root universe will be empty.
| univ_list | CSGUniverseList from a separate CSGBase object |
| new_root_name_base | new name for universe generated from this root universe |
| new_root_name_incoming | new name for the universe generated from the incoming root universe |
Definition at line 297 of file CSGBase.C.
| bool CSG::CSGBase::operator!= | ( | const CSGBase & | other | ) | const |
| bool CSG::CSGBase::operator== | ( | const CSGBase & | other | ) | const |
Operator overload for checking if two CSGBase objects are equal.
Definition at line 441 of file CSGBase.C.
| void CSG::CSGBase::removeCellFromUniverse | ( | const CSGUniverse & | universe, |
| const CSGCell & | cell | ||
| ) |
Remove a cell from an existing universe.
| universe | universe from which to remove the cell |
| cell | cell to remove |
Definition at line 187 of file CSGBase.C.
Referenced by removeCellsFromUniverse().
| void CSG::CSGBase::removeCellsFromUniverse | ( | const CSGUniverse & | universe, |
| std::vector< std::reference_wrapper< const CSGCell >> & | cells | ||
| ) |
Remove a list of cells from an existing universe.
| universe | universe from which to remove the cells |
| cells | list of references to cells to remove |
Definition at line 204 of file CSGBase.C.
Referenced by joinUniverseList().
rename the specified cell
| cell | reference to CSGCell to rename |
| name | new name |
Definition at line 161 of file CSGBase.h.
|
inline |
rename the root universe for this instance (default is ROOT_UNIVERSE)
| name | new name for the root universe |
Definition at line 186 of file CSGBase.h.
|
inline |
rename the specified surface
| surface | CSGSurface to rename |
| name | new name |
Definition at line 89 of file CSGBase.h.
|
inline |
rename the specified universe
| universe | reference to CSGUniverse to rename |
| name | new name |
Definition at line 197 of file CSGBase.h.
change the region of the specified cell
| cell | cell to update the region for |
| region | new region to assign to cell |
Definition at line 141 of file CSGBase.C.
|
private |
List of cells associated with CSG object.
Definition at line 470 of file CSGBase.h.
Referenced by addCellToList(), checkCellInBase(), createCell(), CSGBase(), getAllCells(), getCellByName(), getCellList(), joinCellList(), renameCell(), and updateCellRegion().
|
private |
List of surfaces associated with CSG object.
Definition at line 467 of file CSGBase.h.
Referenced by addSurface(), checkRegionSurfaces(), getAllSurfaces(), getSurface(), getSurfaceByName(), getSurfaceList(), joinSurfaceList(), and renameSurface().
|
private |
List of universes associated with CSG object.
Definition at line 473 of file CSGBase.h.
Referenced by addCellToUniverse(), addUniverseToList(), checkUniverseInBase(), createUniverse(), getAllUniverses(), getRootUniverse(), getUniverseByName(), getUniverseList(), joinUniverseList(), removeCellFromUniverse(), renameRootUniverse(), and renameUniverse().
1.8.14