CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model. More...
#include <CSGBase.h>
Public Member Functions | |
| CSGBase () | |
| Default constructor. More... | |
| ~CSGBase () | |
| Destructor. 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... | |
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... | |
| CSGSurfaceList & | getSurfaceList () |
| Get the CSGSurfaceList object. More... | |
| CSGCellList & | getCellList () |
| Get the CSGCellList object. More... | |
| CSGUniverseList & | getUniverseList () |
| Get 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 |
| 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.
| 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 109 of file CSGBase.C.
Referenced by createUniverse().
| 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 92 of file CSGBase.C.
Referenced by addCellsToUniverse(), createCell(), and joinUniverseList().
|
inline |
add a unique surface pointer to this base instance
| surf | pointer to surface to add |
Definition at line 49 of file CSGBase.h.
|
private |
Definition at line 272 of file CSGBase.C.
Referenced by addCellToUniverse(), removeCellFromUniverse(), and updateCellRegion().
Definition at line 255 of file CSGBase.C.
Referenced by createCell(), and updateCellRegion().
|
private |
Definition at line 282 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 292 of file CSGBase.C.
Referenced by generateOutput().
| 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 23 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 38 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 52 of file CSGBase.C.
|
inline |
Create an empty Universe object.
| name | unique universe name |
Definition at line 200 of file CSGBase.h.
Referenced by 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 83 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 319 of file CSGBase.C.
|
inline |
Get all cell objects.
Definition at line 134 of file CSGBase.h.
Referenced by generateOutput().
|
inline |
Get all surface objects.
Definition at line 59 of file CSGBase.h.
Referenced by generateOutput().
|
inline |
Get all universe objects.
Definition at line 254 of file CSGBase.h.
Referenced by checkUniverseLinking(), and generateOutput().
|
inline |
Get a Cell object by name.
| name | cell name |
Definition at line 145 of file CSGBase.h.
|
inlineprivate |
Get the CSGCellList object.
Definition at line 349 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 308 of file CSGBase.C.
Referenced by checkUniverseLinking().
|
inline |
Get the Root Universe object.
Definition at line 171 of file CSGBase.h.
Referenced by checkUniverseLinking(), createCell(), 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 323 of file CSGBase.h.
|
inline |
Get a Surface object by name.
| name | surface name |
Definition at line 70 of file CSGBase.h.
|
inlineprivate |
Get the CSGSurfaceList object.
Definition at line 342 of file CSGBase.h.
|
inline |
Get a universe object by name.
| name | universe name |
Definition at line 265 of file CSGBase.h.
|
inlineprivate |
Get the CSGUniverseList object.
Definition at line 356 of file CSGBase.h.
|
private |
join a separate CSGCellList object to this one
| cell_list | CSGCellList from a separate CSGBase object |
Definition at line 179 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 142 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 150 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 158 of file CSGBase.C.
|
private |
join a separate CSGSurfaceList object to this one
| surf_list | CSGSurfaceList from a separate CSGBase object |
Definition at line 168 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 187 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 207 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 227 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 117 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 134 of file CSGBase.C.
Referenced by joinUniverseList().
rename the specified cell
| cell | reference to CSGCell to rename |
| name | new name |
Definition at line 153 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 178 of file CSGBase.h.
|
inline |
rename the specified surface
| surface | CSGSurface to rename |
| name | new name |
Definition at line 81 of file CSGBase.h.
|
inline |
rename the specified universe
| universe | reference to CSGUniverse to rename |
| name | new name |
Definition at line 189 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 71 of file CSGBase.C.
|
private |
List of cells associated with CSG object.
Definition at line 419 of file CSGBase.h.
Referenced by checkCellInBase(), createCell(), getAllCells(), getCellByName(), getCellList(), joinCellList(), renameCell(), and updateCellRegion().
|
private |
List of surfaces associated with CSG object.
Definition at line 416 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 422 of file CSGBase.h.
Referenced by addCellToUniverse(), checkUniverseInBase(), createUniverse(), getAllUniverses(), getRootUniverse(), getUniverseByName(), getUniverseList(), joinUniverseList(), removeCellFromUniverse(), renameRootUniverse(), and renameUniverse().
1.8.14