https://mooseframework.inl.gov
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CSG::CSGBase Class Reference

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< CSGBaseclone () const
 Create a deep copy of this CSGBase instance. More...
 
const CSGSurfaceaddSurface (std::unique_ptr< CSGSurface > surf)
 add a unique surface pointer to this base instance More...
 
void deleteSurface (const CSGSurface &surface)
 Remove a Surface object passed in by reference from the stored surface list. More...
 
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces () const
 Get all surface objects. More...
 
const CSGSurfacegetSurfaceByName (const std::string &name) const
 Get a Surface object by name. More...
 
bool hasSurface (const std::string &name) const
 Check if a surface with given name exists in CSGBase object. More...
 
void renameSurface (const CSGSurface &surface, const std::string &name)
 rename the specified surface More...
 
const CSGCellcreateCell (const std::string &name, const std::string &mat_name, const CSGRegion &region, const CSGUniverse *add_to_univ=nullptr)
 Create a Material Cell object. More...
 
const CSGCellcreateCell (const std::string &name, const CSGRegion &region, const CSGUniverse *add_to_univ=nullptr)
 Create a Void Cell object. More...
 
const CSGCellcreateCell (const std::string &name, const CSGUniverse &fill_univ, const CSGRegion &region, const CSGUniverse *add_to_univ=nullptr)
 Create a Universe Cell object. More...
 
const CSGCellcreateCell (const std::string &name, const CSGLattice &fill_lattice, const CSGRegion &region, const CSGUniverse *add_to_univ=nullptr)
 Create a Lattice Cell object. More...
 
void deleteCell (const CSGCell &cell)
 Remove a Cell object passed in by reference from the stored cell list. More...
 
std::vector< std::reference_wrapper< const CSGCell > > getAllCells () const
 Get all cell objects. More...
 
const CSGCellgetCellByName (const std::string &name) const
 Get a Cell object by name. More...
 
bool hasCell (const std::string &name) const
 Check if a cell with given name exists in CSGBase object. More...
 
void renameCell (const CSGCell &cell, const std::string &name)
 rename the specified cell More...
 
void updateCellRegion (const CSGCell &cell, const CSGRegion &region)
 change the region of the specified cell More...
 
void resetCellFill (const CSGCell &cell)
 reset the fill of the specified cell to void More...
 
void updateCellFill (const CSGCell &cell, const std::string &mat_name)
 change the fill of the specified cell to a material fill More...
 
void updateCellFill (const CSGCell &cell, const CSGUniverse *univ)
 change the fill of the specified cell to a universe fill More...
 
void updateCellFill (const CSGCell &cell, const CSGLattice *lattice)
 change the fill of the specified cell to a lattice fill More...
 
const CSGUniversegetRootUniverse () 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 CSGUniversecreateUniverse (const std::string &name)
 Create an empty Universe object. More...
 
const CSGUniversecreateUniverse (const std::string &name, std::vector< std::reference_wrapper< const CSGCell >> &cells)
 Create a Universe object from list of cells. More...
 
void deleteUniverse (const CSGUniverse &univ)
 Remove a Universe object passed in by reference from the stored universe list. 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 CSGUniversegetUniverseByName (const std::string &name)
 Get a universe object by name. More...
 
bool hasUniverse (const std::string &name) const
 Check if a universe with given name exists in CSGBase object. More...
 
template<typename LatticeType = CSGLattice>
const LatticeType & addLattice (std::unique_ptr< LatticeType > lattice)
 add a unique lattice pointer to this base instance; universes that make the lattice must already be a part of this CSGBase instance. More...
 
void deleteLattice (const CSGLattice &lattice)
 Remove a Lattice object passed in by reference from the stored lattice list. More...
 
void setUniverseAtLatticeIndex (const CSGLattice &lattice, const CSGUniverse &universe, std::pair< int, int > index)
 set location in the lattice to be the provided universe More...
 
void setLatticeUniverses (const CSGLattice &lattice, std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> &universes)
 Set provided universes as the layout of the lattice. More...
 
void renameLattice (const CSGLattice &lattice, const std::string &name)
 rename the lattice More...
 
void setLatticeOuter (const CSGLattice &lattice, const std::string &outer_name)
 Set the outer fill for the lattice to the material name provided. More...
 
void setLatticeOuter (const CSGLattice &lattice, const CSGUniverse &outer_univ)
 Set the outer fill for the lattice to the universe provided. More...
 
void resetLatticeOuter (const CSGLattice &lattice)
 reset the outer fill for the lattice to VOID More...
 
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices () const
 Get all lattice objects. More...
 
template<typename LatticeType = CSGLattice>
const LatticeType & getLatticeByName (const std::string &name)
 Get a lattice object of the specified type by name This is a templated method with a default type of CSGLattice. More...
 
bool hasLattice (const std::string &name) const
 Check if a lattice with given name exists in CSGBase object. More...
 
void joinOtherBase (std::unique_ptr< CSGBase > base, const bool ignore_identical_components)
 Join another CSGBase object to this one. More...
 
void joinOtherBase (std::unique_ptr< CSGBase > base, const bool ignore_identical_components, const std::string &new_root_name_join)
 Join another CSGBase object to this one. More...
 
void joinOtherBase (std::unique_ptr< CSGBase > base, const bool ignore_identical_components, 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...
 
void addTransformation (const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
 Apply a transformation to a CSG object. More...
 
void applyTranslation (const CSGObjectVariant &csg_object, const std::tuple< Real, Real, Real > &distances)
 Apply a translation to a CSG object in the specified x, y, and z directions. More...
 
void applyRotation (const CSGObjectVariant &csg_object, const std::tuple< Real, Real, Real > &angles)
 Apply a rotation to a CSG object using (phi, theta, psi) angle notation (in degrees). More...
 
void applyAxisRotation (const CSGObjectVariant &csg_object, RotationAxisType axis, const Real angle)
 Apply a rotation to a CSG object about a specified axis (X, Y, Z). More...
 
void applyScaling (const CSGObjectVariant &csg_object, const std::tuple< Real, Real, Real > &values)
 Scale a CSG object in the specified x, y, and z directions. More...
 

Private Member Functions

CSGSurfacegetSurface (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, std::vector< std::string > &linked_cell_names) const
 Recursive method to retrieve all universes and cells linked to current universe. More...
 
const CSGSurfaceListgetSurfaceList () const
 Get a const reference to the CSGSurfaceList object. More...
 
CSGSurfaceListgetSurfaceList ()
 Get a non-const reference to the CSGSurfaceList object. More...
 
const CSGCellListgetCellList () const
 Get a const reference to the CSGCellList object. More...
 
CSGCellListgetCellList ()
 Get a non-const reference to the CSGCellList object. More...
 
const CSGUniverseListgetUniverseList () const
 Get a const reference to the CSGUniverseList object. More...
 
CSGUniverseListgetUniverseList ()
 Get a non-const reference to the CSGUniverseList object. More...
 
const CSGLatticeListgetLatticeList () const
 Get a const reference to the CSGLatticeList object. More...
 
CSGLatticeListgetLatticeList ()
 Get the CSGLatticeList object. More...
 
void updateIncomingCSGReferences (CSGBase &incoming_base)
 update references of incoming CSGbase to point to those of existing CSGBase object. More...
 
void replaceSurfaceRefsByName (std::map< std::string, std::reference_wrapper< const CSGSurface >> &identical_surface_refs, CSGBase &base)
 update surface references of incoming CSGBase to point to those of existing CSGBase object based on CSGSurface name. More...
 
void replaceCellRefsByName (std::map< std::string, std::reference_wrapper< const CSGCell >> &identical_cell_refs, CSGBase &base)
 update cell references of incoming CSGbase to point to those of existing CSGBase object based on CSGCell name. More...
 
void replaceUniverseRefsByName (std::map< std::string, std::reference_wrapper< const CSGUniverse >> &identical_universe_refs, CSGBase &base)
 update universe references of incoming CSGbase to point to those of existing CSGBase object based on CSGUniverse name. More...
 
void replaceLatticeRefsByName (std::map< std::string, std::reference_wrapper< const CSGLattice >> &identical_lattice_refs, CSGBase &base)
 update lattice references of incoming CSGbase to point to those of existing CSGBase object based on CSGLattice name. More...
 
void joinSurfaceList (CSGSurfaceList &surf_list, const bool ignore_identical_surfaces)
 join a separate CSGSurfaceList object to this one More...
 
void joinCellList (CSGCellList &cell_list, const bool ignore_identical_cells)
 join a separate CSGCellList object to this one More...
 
void joinLatticeList (CSGLatticeList &lattice_list, const bool ignore_identical_lattices)
 join a separate CSGLatticeList object to this one More...
 
void joinUniverseList (CSGUniverseList &univ_list, const bool ignore_identical_universes)
 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 bool ignore_identical_universes, 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 bool ignore_identical_universes, 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 &region) const
 
bool checkSurfaceInBase (const CSGSurface &surface) const
 
bool checkCellInBase (const CSGCell &cell) const
 
bool checkUniverseInBase (const CSGUniverse &universe) const
 
bool checkLatticeInBase (const CSGLattice &lattice) const
 
const CSGCelladdCellToList (const CSGCell &cell)
 Add a new cell to the cell list based on a cell reference. More...
 
const CSGUniverseaddUniverseToList (const CSGUniverse &univ)
 Add a new universe to the universe list based on a universe reference. More...
 
const CSGLatticeaddLatticeToList (const CSGLattice &lattice)
 Add a new lattice to the lattice list based on a lattice 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...
 
CSGLatticeList _lattice_list
 List of lattices associated with CSG object. More...
 

Detailed Description

CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.

Definition at line 51 of file CSGBase.h.

Constructor & Destructor Documentation

◆ CSGBase() [1/2]

CSG::CSGBase::CSGBase ( )

Default constructor.

Definition at line 17 of file CSGBase.C.

18  : _surface_list(CSGSurfaceList()),
19  _cell_list(CSGCellList()),
20  _universe_list(CSGUniverseList()),
21  _lattice_list(CSGLatticeList())
22 {
23 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ CSGBase() [2/2]

CSG::CSGBase::CSGBase ( const CSGBase other_base)

Copy constructor.

Definition at line 25 of file CSGBase.C.

26  : _surface_list(other_base.getSurfaceList()),
27  _cell_list(CSGCellList()),
28  _universe_list(CSGUniverseList()),
29  _lattice_list(CSGLatticeList())
30 {
31  // Iterate through all cell references from the other CSGBase instance and
32  // create new CSGCell pointers based on these references. This is done
33  // recursively to properly handle cells with universe fills
34  for (const auto & [name, cell] : other_base.getCellList().getCellListMap())
35  addCellToList(*cell);
36 
37  // Link all cells in other_base root universe to current root universe
38  for (auto & root_cell : other_base.getRootUniverse().getAllCells())
39  {
40  const auto & list_cell = _cell_list.getCell(root_cell.get().getName());
41  addCellToUniverse(getRootUniverse(), list_cell);
42  }
43 
44  // Iterate through all universe references from the other CSGBase instance and
45  // create new CSGUniverse pointers based on these references. This is done in case
46  // any universe exist in the universe list that are not connected to the cell list.
47  for (const auto & [name, univ] : other_base.getUniverseList().getUniverseListMap())
48  addUniverseToList(*univ);
49 
50  // Iterate through all lattice references from the other CSGBase instance and
51  // create new CSGLattice pointers based on these references.
52  for (const auto & [name, lattice] : other_base.getLatticeList().getLatticeListMap())
53  addLatticeToList(*lattice);
54 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
Definition: CSGBase.C:120
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
const CSGCell & addCellToList(const CSGCell &cell)
Add a new cell to the cell list based on a cell reference.
Definition: CSGBase.C:85
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424
const CSGLattice & addLatticeToList(const CSGLattice &lattice)
Add a new lattice to the lattice list based on a lattice reference.
Definition: CSGBase.C:138

◆ ~CSGBase()

CSG::CSGBase::~CSGBase ( )

Destructor.

Definition at line 56 of file CSGBase.C.

56 {}

Member Function Documentation

◆ addCellsToUniverse()

void CSG::CSGBase::addCellsToUniverse ( const CSGUniverse universe,
std::vector< std::reference_wrapper< const CSGCell >> &  cells 
)

Add a list of cells to an existing universe.

Parameters
universeuniverse to which to add the cells
cellslist of references to cells to add

Definition at line 441 of file CSGBase.C.

Referenced by createUniverse().

443 {
444  for (auto & c : cells)
445  addCellToUniverse(universe, c);
446 }
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ addCellToList()

const CSGCell & CSG::CSGBase::addCellToList ( const CSGCell cell)
private

Add a new cell to the cell list based on a cell reference.

This method is called by the copy constructor of CSGBase

Parameters
cellreference to CSGCell that should be added to cell list

Definition at line 85 of file CSGBase.C.

Referenced by addUniverseToList(), and CSGBase().

86 {
87  // If cell has already been created, we just return a reference to it
88  const auto name = cell.getName();
89  if (_cell_list.hasCell(name))
90  return _cell_list.getCell(name);
91 
92  // Otherwise if the cell has material or void cell, we can create it directly
93  const auto fill_type = cell.getFillType();
94  const auto region = cell.getRegion();
95  if (fill_type == "VOID")
96  return _cell_list.addVoidCell(name, region);
97  else if (fill_type == "CSG_MATERIAL")
98  {
99  const auto mat_name = cell.getFillMaterial();
100  return _cell_list.addMaterialCell(name, mat_name, region);
101  }
102  else if (fill_type == "LATTICE")
103  {
104  // add lattice recursively to capture all linked universes in the lattice
105  const CSGLattice & lattice = addLatticeToList(cell.getFillLattice());
106  return _cell_list.addLatticeCell(name, lattice, region);
107  }
108  // Otherwise if the cell has a universe fill, we need to recursively define
109  // all linked universes and cells first before defining this cell
110  else if (fill_type == "UNIVERSE")
111  {
112  const auto & univ = addUniverseToList(cell.getFillUniverse());
113  return _cell_list.addUniverseCell(name, univ, region);
114  }
115  else
116  mooseError("Cell " + name + " has unrecognized fill type " + fill_type);
117 }
std::string name(const ElemQuality q)
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:53
CSGCell & addMaterialCell(const std::string &name, const std::string &mat_name, const CSGRegion &region)
Add a Material Cell object to cell list.
Definition: CSGCellList.C:59
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:67
CSGCell & addLatticeCell(const std::string &name, const CSGLattice &lattice, const CSGRegion &region)
Add a Lattice Cell object to cell list.
Definition: CSGCellList.C:75
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
Definition: CSGBase.C:120
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:67
const CSGLattice & addLatticeToList(const CSGLattice &lattice)
Add a new lattice to the lattice list based on a lattice reference.
Definition: CSGBase.C:138
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
Definition: CSGCellList.h:85

◆ addCellToUniverse()

void CSG::CSGBase::addCellToUniverse ( const CSGUniverse universe,
const CSGCell cell 
)

Add a cell to an existing universe.

Parameters
universeuniverse to which to add the cell
cellcell to add

Definition at line 424 of file CSGBase.C.

Referenced by addCellsToUniverse(), createCell(), CSGBase(), and joinUniverseList().

425 {
426  // make sure cell is a part of this CSGBase instance
427  if (!checkCellInBase(cell))
428  mooseError("A cell named " + cell.getName() + " is being added to universe " +
429  universe.getName() +
430  " that is different from the cell of the same name in the CSGBase instance.");
431  // make sure universe is a part of this CSGBase instance
432  if (!checkUniverseInBase(universe))
433  mooseError("Cells are being added to a universe named " + universe.getName() +
434  " that is different " +
435  "from the universe of the same name in the CSGBase instance.");
436  auto & univ = _universe_list.getUniverse(universe.getName());
437  univ.addCell(cell);
438 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956
void addCell(const CSGCell &cell)
add cell to universe
Definition: CSGUniverse.C:28

◆ addLattice()

template<typename LatticeType = CSGLattice>
const LatticeType& CSG::CSGBase::addLattice ( std::unique_ptr< LatticeType >  lattice)
inline

add a unique lattice pointer to this base instance; universes that make the lattice must already be a part of this CSGBase instance.

Parameters
latticepointer to lattice to add
Returns
reference to CSGLattice that was added

Definition at line 403 of file CSGBase.h.

Referenced by addLatticeToList().

404  {
405  static_assert(std::is_base_of_v<CSGLattice, LatticeType>, "Is not a CSGLattice");
406  // make sure all universes are a part of this base instance
407  auto universes = lattice->getUniverses();
408  for (auto univ_list : universes)
409  for (const CSGUniverse & univ : univ_list)
410  if (!checkUniverseInBase(univ))
411  mooseError("Cannot add lattice " + lattice->getName() + " of type " + lattice->getType() +
412  ". Universe " + univ.getName() + " is not in the CSGBase instance.");
413 
414  if (lattice->getOuterType() == "UNIVERSE")
415  {
416  const CSGUniverse & outer_univ = lattice->getOuterUniverse();
417  if (!checkUniverseInBase(outer_univ))
418  mooseError("Cannot add lattice " + lattice->getName() + " of type " + lattice->getType() +
419  ". Outer universe " + outer_univ.getName() + " is not in the CSGBase instance.");
420  }
421  auto & lat_ref = _lattice_list.addLattice(std::move(lattice));
422  return dynamic_cast<LatticeType &>(lat_ref);
423  }
CSGLattice & addLattice(std::unique_ptr< CSGLattice > lattice, const bool ignore_identical_lattice=false)
add an existing lattice to list.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ addLatticeToList()

const CSGLattice & CSG::CSGBase::addLatticeToList ( const CSGLattice lattice)
private

Add a new lattice to the lattice list based on a lattice reference.

This method is called by the copy constructor of CSGBase

Parameters
latticereference to CSGLattice that should be added to universe list

Definition at line 138 of file CSGBase.C.

Referenced by addCellToList(), and CSGBase().

139 {
140  // If lattice has already been created, we just return a reference to it
141  const auto name = lattice.getName();
142  if (_lattice_list.hasLattice(name))
143  return _lattice_list.getLattice(name);
144 
145  // Clone the lattice (associated universes need to be transferred and set)
146  auto cloned_lattice = lattice.clone();
147 
148  // If lattice has associated universes, we need to add them to this CSGBase instance as well.
149  // addUniverseToList is called recursively in case associated universes have not been added to
150  // the universe list yet.
151  std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> current_univ_map;
152  for (const auto & univ_list : lattice.getUniverses())
153  {
154  std::vector<std::reference_wrapper<const CSGUniverse>> current_univ_list;
155  for (const auto & univ_ref : univ_list)
156  current_univ_list.push_back(addUniverseToList(univ_ref.get()));
157  current_univ_map.push_back(current_univ_list);
158  }
159 
160  // Set universes only if lattice has universes defined
161  if (current_univ_map.size() > 0)
162  cloned_lattice->setUniverses(current_univ_map);
163 
164  // Update reference to outer universe if it exists
165  if (lattice.getOuterType() == "UNIVERSE")
166  {
167  const auto & outer_univ_ref = addUniverseToList(lattice.getOuterUniverse());
168  cloned_lattice->updateOuter(outer_univ_ref);
169  }
170 
171  // Use addLattice to add the cloned lattice
172  return addLattice(std::move(cloned_lattice));
173 }
std::string name(const ElemQuality q)
bool hasLattice(const std::string &name) const
return whether lattice with given name exists in lattice list
const LatticeType & addLattice(std::unique_ptr< LatticeType > lattice)
add a unique lattice pointer to this base instance; universes that make the lattice must already be a...
Definition: CSGBase.h:403
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
Definition: CSGBase.C:120
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
virtual std::unique_ptr< CSGLattice > clone() const =0
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ addSurface()

const CSGSurface& CSG::CSGBase::addSurface ( std::unique_ptr< CSGSurface surf)
inline

add a unique surface pointer to this base instance

Parameters
surfpointer to surface to add
Returns
reference to CSGSurface that was added

Definition at line 79 of file CSGBase.h.

80  {
81  return _surface_list.addSurface(std::move(surf));
82  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf, const bool ignore_identical_surface=false)
add a surface object to existing SurfaceList.

◆ addTransformation()

void CSG::CSGBase::addTransformation ( const CSGObjectVariant csg_object,
TransformationType  type,
const std::tuple< Real, Real, Real > &  values 
)

Apply a transformation to a CSG object.

Parameters
csg_objectThe CSG object to transform (Surface, Cell, Universe, Region, or Lattice)
typeThe type of transformation to apply (TRANSLATION, ROTATION, SCALE)
valuestuple of transformation values (3 values for any transformation type)

Definition at line 545 of file CSGBase.C.

Referenced by applyAxisRotation(), applyRotation(), applyScaling(), and applyTranslation().

548 {
549  // Use std::visit to handle each type in the variant
550  std::visit(
551  [&](const auto & obj)
552  {
553  using T = std::decay_t<decltype(obj.get())>;
554 
555  // Handle each CSG object type differently because each needs to check that it exists in
556  // this base instance
557  if constexpr (std::is_same_v<T, CSGCell>)
558  {
559  const CSGCell & cell = obj.get();
560  if (!checkCellInBase(cell))
561  mooseError("Cannot apply transformation to cell ",
562  cell.getName(),
563  " that is not in this CSGBase instance.");
564 
565  // Get non-const reference and apply transformation
566  CSGCell & mutable_cell = _cell_list.getCell(cell.getName());
567  mooseAssert(mutable_cell == cell, "Mutable cell does not match const cell passed in.");
568  mutable_cell.addTransformation(type, values);
569  }
570  else if constexpr (std::is_same_v<T, CSGSurface>)
571  {
572  const CSGSurface & surface = obj.get();
573  if (!checkSurfaceInBase(surface))
574  mooseError("Cannot apply transformation to surface ",
575  surface.getName(),
576  " that is not in this CSGBase instance.");
577 
578  // Get non-const reference and apply transformation
579  CSGSurface & mutable_surface = _surface_list.getSurface(surface.getName());
580  mooseAssert(mutable_surface == surface,
581  "Mutable surface does not match const surface passed in.");
582  mutable_surface.addTransformation(type, values);
583  }
584  else if constexpr (std::is_same_v<T, CSGUniverse>)
585  {
586  const CSGUniverse & universe = obj.get();
587  if (!checkUniverseInBase(universe))
588  mooseError("Cannot apply transformation to universe ",
589  universe.getName(),
590  " that is not in this CSGBase instance.");
591 
592  // Get non-const reference and apply transformation
593  CSGUniverse & mutable_universe = _universe_list.getUniverse(universe.getName());
594  mooseAssert(mutable_universe == universe,
595  "Mutable universe does not match const universe passed in.");
596  mutable_universe.addTransformation(type, values);
597  }
598  else if constexpr (std::is_same_v<T, CSGLattice>)
599  {
600  const CSGLattice & lattice = obj.get();
601  if (!checkLatticeInBase(lattice))
602  mooseError("Cannot apply transformation to lattice ",
603  lattice.getName(),
604  " that is not in this CSGBase instance.");
605 
606  // Get non-const reference and apply transformation
607  CSGLattice & mutable_lattice = _lattice_list.getLattice(lattice.getName());
608  mooseAssert(mutable_lattice == lattice,
609  "Mutable lattice does not match const lattice passed in.");
610  mutable_lattice.addTransformation(type, values);
611  }
612  else if constexpr (std::is_same_v<T, CSGRegion>)
613  {
614  // iterate on the surfaces of the region and apply the transformation to those surfaces
615  const CSGRegion & region = obj.get();
616  const auto surfaces = region.getSurfaces();
617  for (const CSGSurface & surface : surfaces)
618  {
619  if (!checkSurfaceInBase(surface))
620  mooseError("Cannot apply transformation to region with surface ",
621  surface.getName(),
622  " that is not in this CSGBase instance.");
623  addTransformation(surface, type, values);
624  }
625  }
626  else
627  mooseError("Transformation not implemented for this object type: ", typeid(T).name());
628  },
629  csg_object);
630 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
Definition: CSGBase.C:545
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
bool checkSurfaceInBase(const CSGSurface &surface) const
Definition: CSGBase.C:946
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ addUniverseToList()

const CSGUniverse & CSG::CSGBase::addUniverseToList ( const CSGUniverse univ)
private

Add a new universe to the universe list based on a universe reference.

This method is called by the copy constructor of CSGBase

Parameters
univreference to CSGUniverse that should be added to universe list

Definition at line 120 of file CSGBase.C.

Referenced by addCellToList(), addLatticeToList(), and CSGBase().

121 {
122  // If universe has already been created, we just return a reference to it
123  const auto name = univ.getName();
124  if (_universe_list.hasUniverse(name))
125  return _universe_list.getUniverse(name);
126 
127  // Otherwise we create a new universe based on its associated cells.
128  // addCellToList is called recursively in case associated cells have not
129  // been added to the cell list yet.
130  const auto univ_cells = univ.getAllCells();
131  std::vector<std::reference_wrapper<const CSGCell>> current_univ_cells;
132  for (const auto & univ_cell : univ_cells)
133  current_univ_cells.push_back(addCellToList(univ_cell));
134  return createUniverse(name, current_univ_cells);
135 }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
const std::vector< std::reference_wrapper< const CSGCell > > & getAllCells() const
Get list of the all cells in the universe.
Definition: CSGUniverse.h:73
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
bool hasUniverse(const std::string &name) const
return whether universe with given name exists in universe list
const CSGCell & addCellToList(const CSGCell &cell)
Add a new cell to the cell list based on a cell reference.
Definition: CSGBase.C:85
const CSGUniverse & createUniverse(const std::string &name)
Create an empty Universe object.
Definition: CSGBase.h:308

◆ applyAxisRotation()

void CSG::CSGBase::applyAxisRotation ( const CSGObjectVariant csg_object,
RotationAxisType  axis,
const Real  angle 
)

Apply a rotation to a CSG object about a specified axis (X, Y, Z).

Parameters
csg_objectThe CSG object to rotate (Surface, Cell, Universe, Region, or Lattice)
axisAxis type (X, Y, or Z) about which to rotate
angleangle in degrees to rotate about the specified axis

Definition at line 633 of file CSGBase.C.

636 {
637  // convert to the Euler angles (phi, theta, psi) based on axis
638  Real phi = 0.0;
639  Real theta = 0.0;
640  Real psi = 0.0;
641 
642  switch (axis)
643  {
644  case RotationAxisType::X:
645  theta = angle;
646  break;
647  case RotationAxisType::Y:
648  phi = 90.0;
649  theta = angle;
650  psi = -90.0;
651  break;
652  case RotationAxisType::Z:
653  phi = angle;
654  break;
655  default:
656  mooseError("Invalid axis type provided for axis rotation.");
657  }
658 
659  addTransformation(csg_object, TransformationType::ROTATION, std::make_tuple(phi, theta, psi));
660 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
Definition: CSGBase.C:545
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ applyRotation()

void CSG::CSGBase::applyRotation ( const CSGObjectVariant csg_object,
const std::tuple< Real, Real, Real > &  angles 
)
inline

Apply a rotation to a CSG object using (phi, theta, psi) angle notation (in degrees).

Parameters
csg_objectThe CSG object to rotate (Surface, Cell, Universe, Region, or Lattice)
anglessize 3 tuple {phi, theta, psi} with rotation angles in degrees

Definition at line 619 of file CSGBase.h.

621  {
622  addTransformation(csg_object, TransformationType::ROTATION, angles);
623  }
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
Definition: CSGBase.C:545

◆ applyScaling()

void CSG::CSGBase::applyScaling ( const CSGObjectVariant csg_object,
const std::tuple< Real, Real, Real > &  values 
)
inline

Scale a CSG object in the specified x, y, and z directions.

Parameters
csg_objectThe CSG object to scale (Surface, Cell, Universe, Region, or Lattice)
valuessize 3 tuple with scaling values in x, y, and z directions {x, y, z}

Definition at line 641 of file CSGBase.h.

643  {
644  addTransformation(csg_object, TransformationType::SCALE, values);
645  }
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
Definition: CSGBase.C:545

◆ applyTranslation()

void CSG::CSGBase::applyTranslation ( const CSGObjectVariant csg_object,
const std::tuple< Real, Real, Real > &  distances 
)
inline

Apply a translation to a CSG object in the specified x, y, and z directions.

Parameters
csg_objectThe CSG object to translate (Surface, Cell, Universe, Region, or Lattice)
distancessize 3 tuple with translation distances in x, y, and z directions {x, y, z}

Definition at line 607 of file CSGBase.h.

609  {
610  addTransformation(csg_object, TransformationType::TRANSLATION, distances);
611  }
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
Definition: CSGBase.C:545

◆ checkCellInBase()

bool CSG::CSGBase::checkCellInBase ( const CSGCell cell) const
private

Definition at line 956 of file CSGBase.C.

Referenced by addCellToUniverse(), addTransformation(), deleteCell(), removeCellFromUniverse(), resetCellFill(), updateCellFill(), and updateCellRegion().

957 {
958  auto name = cell.getName();
959  // if no cell by this name exists, an error will be produced by getCell
960  auto & list_cell = _cell_list.getCell(name);
961  // return whether that the cell in the list is the same as the cell provided (in memory)
962  return &cell == &list_cell;
963 }
std::string name(const ElemQuality q)
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ checkLatticeInBase()

bool CSG::CSGBase::checkLatticeInBase ( const CSGLattice lattice) const
private

Definition at line 976 of file CSGBase.C.

Referenced by addTransformation(), deleteLattice(), resetLatticeOuter(), setLatticeOuter(), setLatticeUniverses(), setUniverseAtLatticeIndex(), and updateCellFill().

977 {
978  auto name = lattice.getName();
979  // if no lattice by this name exists, an error will be produced by getLattice
980  auto & list_lattice = _lattice_list.getLattice(name);
981  // return whether that the lattice in the list is the same as the lattice provided (in memory)
982  return &lattice == &list_lattice;
983 }
std::string name(const ElemQuality q)
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ checkRegionSurfaces()

void CSG::CSGBase::checkRegionSurfaces ( const CSGRegion region) const
private

Definition at line 934 of file CSGBase.C.

Referenced by createCell(), and updateCellRegion().

935 {
936  const auto surfs = region.getSurfaces();
937  for (const CSGSurface & s : surfs)
938  {
939  if (!checkSurfaceInBase(s))
940  mooseError("Region is being set with a surface named " + s.getName() +
941  " that is different from the surface of the same name in the CSGBase instance.");
942  }
943 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool checkSurfaceInBase(const CSGSurface &surface) const
Definition: CSGBase.C:946

◆ checkSurfaceInBase()

bool CSG::CSGBase::checkSurfaceInBase ( const CSGSurface surface) const
private

Definition at line 946 of file CSGBase.C.

Referenced by addTransformation(), checkRegionSurfaces(), and deleteSurface().

947 {
948  auto name = surface.getName();
949  // if no surface by this name exists, an error will be produced by getSurface
950  auto & list_surf = _surface_list.getSurface(name);
951  // return whether that the surface in the list is the same as the surface provided (in memory)
952  return &surface == &list_surf;
953 }
std::string name(const ElemQuality q)
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ checkUniverseInBase()

bool CSG::CSGBase::checkUniverseInBase ( const CSGUniverse universe) const
private

Definition at line 966 of file CSGBase.C.

Referenced by addCellToUniverse(), addLattice(), addTransformation(), deleteUniverse(), removeCellFromUniverse(), setLatticeOuter(), setLatticeUniverses(), setUniverseAtLatticeIndex(), and updateCellFill().

967 {
968  auto name = universe.getName();
969  // if no universe by this name exists, an error will be produced by getUniverse
970  auto & list_univ = _universe_list.getUniverse(name);
971  // return whether that the universe in the list is the same as the universe provided (in memory)
972  return &universe == &list_univ;
973 }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.

◆ checkUniverseLinking()

void CSG::CSGBase::checkUniverseLinking ( ) const
private

Check universes linked to root universe match universes defined in _universe_list.

Definition at line 986 of file CSGBase.C.

Referenced by generateOutput().

987 {
988  std::vector<std::string> linked_universe_names;
989  std::vector<std::string> linked_cell_names;
990 
991  // Recursively figure out which universe names are linked to root universe
992  getLinkedUniverses(getRootUniverse(), linked_universe_names, linked_cell_names);
993 
994  // Iterate through all universes in universe list and check that they exist in universes linked
995  // to root universe
996  for (const CSGUniverse & univ : getAllUniverses())
997  if (std::find(linked_universe_names.begin(), linked_universe_names.end(), univ.getName()) ==
998  linked_universe_names.end())
999  mooseWarning("Universe with name ", univ.getName(), " is not linked to root universe.");
1000 
1001  // Iterate through all cells in cell list and check that they exist in cells linked
1002  // to root universe
1003  for (const CSGCell & cell : getAllCells())
1004  if (std::find(linked_cell_names.begin(), linked_cell_names.end(), cell.getName()) ==
1005  linked_cell_names.end())
1006  mooseWarning("Cell with name ", cell.getName(), " is not linked to root universe.");
1007 }
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
Definition: KokkosUtils.h:40
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all universe objects.
Definition: CSGBase.h:370
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:345
void getLinkedUniverses(const CSGUniverse &univ, std::vector< std::string > &linked_universe_names, std::vector< std::string > &linked_cell_names) const
Recursive method to retrieve all universes and cells linked to current universe.
Definition: CSGBase.C:1010
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all cell objects.
Definition: CSGBase.h:203

◆ clone()

std::unique_ptr<CSGBase> CSG::CSGBase::clone ( ) const
inline

Create a deep copy of this CSGBase instance.

Definition at line 70 of file CSGBase.h.

70 { return std::make_unique<CSGBase>(*this); }

◆ createCell() [1/4]

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.

Parameters
nameunique cell name
mat_namematerial name
regioncell region
add_to_univ(optional) universe to which this cell will be added (default is root universe)
Returns
reference to CSGCell that is created

Definition at line 199 of file CSGBase.C.

203 {
204  checkRegionSurfaces(region);
205  auto & cell = _cell_list.addMaterialCell(name, mat_name, region);
206  if (add_to_univ)
207  addCellToUniverse(*add_to_univ, cell);
208  else
210  return cell;
211 }
CSGCell & addMaterialCell(const std::string &name, const std::string &mat_name, const CSGRegion &region)
Add a Material Cell object to cell list.
Definition: CSGCellList.C:59
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:934
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ createCell() [2/4]

const CSGCell & CSG::CSGBase::createCell ( const std::string &  name,
const CSGRegion region,
const CSGUniverse add_to_univ = nullptr 
)

Create a Void Cell object.

Parameters
nameunique cell name
regioncell region
add_to_univ(optional) universe to which this cell will be added (default is root universe)
Returns
reference to CSGCell that is created

Definition at line 214 of file CSGBase.C.

217 {
218  checkRegionSurfaces(region);
219  auto & cell = _cell_list.addVoidCell(name, region);
220  if (add_to_univ)
221  addCellToUniverse(*add_to_univ, cell);
222  else
224  return cell;
225 }
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:53
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:934
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ createCell() [3/4]

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.

Parameters
nameunique cell name
fill_univuniverse that will fill the cell
regioncell region
add_to_univ(optional) universe to which this cell will be added (default is root universe)
Returns
reference to cell that is created

Definition at line 228 of file CSGBase.C.

232 {
233  checkRegionSurfaces(region);
234  if (add_to_univ && (&fill_univ == add_to_univ))
235  mooseError("Cell " + name +
236  " cannot be filled with the same universe to which it is being added.");
237 
238  auto & cell = _cell_list.addUniverseCell(name, fill_univ, region);
239  if (add_to_univ)
240  addCellToUniverse(*add_to_univ, cell);
241  else
243  return cell;
244 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:67
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:934
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ createCell() [4/4]

const CSGCell & CSG::CSGBase::createCell ( const std::string &  name,
const CSGLattice fill_lattice,
const CSGRegion region,
const CSGUniverse add_to_univ = nullptr 
)

Create a Lattice Cell object.

Parameters
nameunique cell name
fill_latticelattice that will fill the cell
regioncell region
add_to_univ(optional) universe to which this cell will be added (default is root universe)
Returns
reference to cell that is created

Definition at line 247 of file CSGBase.C.

251 {
252  checkRegionSurfaces(region);
253 
254  // check that cell is not being added to a universe that exists in the lattice itself
255  if (add_to_univ)
256  for (auto univ_list : fill_lattice.getUniverses())
257  for (const auto & univ_ref : univ_list)
258  {
259  const CSGUniverse & univ_in_lattice = univ_ref.get();
260  if (&univ_in_lattice == add_to_univ)
261  mooseError("Cell " + name +
262  " cannot be filled with a lattice containing the same universe to which it is "
263  "being added.");
264  }
265 
266  auto & cell = _cell_list.addLatticeCell(name, fill_lattice, region);
267  if (add_to_univ)
268  addCellToUniverse(*add_to_univ, cell);
269  else
271  return cell;
272 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
CSGCell & addLatticeCell(const std::string &name, const CSGLattice &lattice, const CSGRegion &region)
Add a Lattice Cell object to cell list.
Definition: CSGCellList.C:75
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:934
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ createUniverse() [1/2]

const CSGUniverse& CSG::CSGBase::createUniverse ( const std::string &  name)
inline

Create an empty Universe object.

Parameters
nameunique universe name
Returns
reference to CSGUniverse that is created

Definition at line 308 of file CSGBase.h.

Referenced by addUniverseToList(), and joinUniverseList().

309  {
310  return _universe_list.addUniverse(name);
311  }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGUniverse & addUniverse(const std::string &name)
create an empty universe

◆ createUniverse() [2/2]

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.

Parameters
nameunique universe name
cellslist of cells to add to universe
Returns
reference to CSGUniverse that is created

Definition at line 371 of file CSGBase.C.

373 {
374  auto & univ = _universe_list.addUniverse(name);
375  addCellsToUniverse(univ, cells); // performs a check that cells are a part of this base
376  return univ;
377 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void addCellsToUniverse(const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells)
Add a list of cells to an existing universe.
Definition: CSGBase.C:441
CSGUniverse & addUniverse(const std::string &name)
create an empty universe

◆ deleteCell()

void CSG::CSGBase::deleteCell ( const CSGCell cell)

Remove a Cell object passed in by reference from the stored cell list.

Any CSG components connected to cell will not be recursively removed.

Parameters
cellreference to cell to delete

Definition at line 275 of file CSGBase.C.

276 {
277  if (!checkCellInBase(cell))
278  mooseError("Cell with name ",
279  cell.getName(),
280  " cannot be deleted as it is different from the cell of the same name in the "
281  "CSGBase instance.");
282 
283  // Check if cell exists in any existing universes. Cell will be removed from these universes
284  for (const auto & univ_ref : _universe_list.getAllUniverses())
285  {
286  const auto & univ = univ_ref.get();
287  const auto & univ_cells = univ.getAllCells();
288  for (const auto & univ_cell : univ_cells)
289  if (cell == univ_cell.get() && univ != getRootUniverse())
290  {
291  mooseWarning("Removing cell ",
292  cell.getName(),
293  " from universe with name ",
294  univ.getName(),
295  " before cell deletion.");
296  auto & univ_to_modify = _universe_list.getUniverse(univ.getName());
297  univ_to_modify.removeCell(cell.getName());
298  }
299  }
300 
301  _cell_list.getCellListMap().erase(cell.getName());
302 }
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all the universes in CSGBase instance.
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unordered_map< std::string, std::unique_ptr< CSGCell > > & getCellListMap()
Get non-const map of all names to cells in cell list.
Definition: CSGCellList.h:92
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:345
void removeCell(const std::string &name)
remove a cell of the specified name from the universe
Definition: CSGUniverse.C:59
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ deleteLattice()

void CSG::CSGBase::deleteLattice ( const CSGLattice lattice)

Remove a Lattice object passed in by reference from the stored lattice list.

Any CSG components connected to lattice will not be recursively removed.

Parameters
latticereference to lattice to delete

Definition at line 176 of file CSGBase.C.

177 {
178  if (!checkLatticeInBase(lattice))
179  mooseError("Lattice with name ",
180  lattice.getName(),
181  " cannot be deleted as it is different from the lattice of the same name in the "
182  "CSGBase instance.");
183 
184  // Check if lattice is used as fill in existing cells
185  for (const auto & cell_ref : _cell_list.getAllCells())
186  {
187  const auto & cell = cell_ref.get();
188  if ((cell.getFillType() == "LATTICE") && (cell.getFillLattice() == lattice))
189  mooseError("Cannot delete lattice with name ",
190  lattice.getName(),
191  " as it is used as the fill of cell with name ",
192  cell.getName());
193  }
194 
195  _lattice_list.getLatticeListMap().erase(lattice.getName());
196 }
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:83
std::unordered_map< std::string, std::unique_ptr< CSGLattice > > & getLatticeListMap()
Get map of all names to lattices in lattice list.
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ deleteSurface()

void CSG::CSGBase::deleteSurface ( const CSGSurface surface)

Remove a Surface object passed in by reference from the stored surface list.

Any CSG components connected to surface will not be recursively removed.

Parameters
surfacereference to surface to delete

Definition at line 59 of file CSGBase.C.

60 {
61  if (!checkSurfaceInBase(surface))
62  mooseError("Surface with name ",
63  surface.getName(),
64  " cannot be deleted as it is different from the surface of the same name in the "
65  "CSGBase instance.");
66 
67  // Check if surface is used in region definition of existing cells
68  for (const auto & cell_ref : _cell_list.getAllCells())
69  {
70  const auto & cell = cell_ref.get();
71  const auto & cell_region = cell.getRegion();
72  const auto & region_surfaces = cell_region.getSurfaces();
73  for (const auto & region_surf : region_surfaces)
74  if (region_surf.get() == surface)
75  mooseError("Cannot delete surface with name ",
76  surface.getName(),
77  " as it is used in region definition of cell with name ",
78  cell.getName());
79  }
80 
81  _surface_list.getSurfaceListMap().erase(surface.getName());
82 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:83
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
bool checkSurfaceInBase(const CSGSurface &surface) const
Definition: CSGBase.C:946
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > & getSurfaceListMap()
Get non-const map of all names to surfaces in surface list.

◆ deleteUniverse()

void CSG::CSGBase::deleteUniverse ( const CSGUniverse univ)

Remove a Universe object passed in by reference from the stored universe list.

Any CSG components connected to universe will not be recursively removed.

Parameters
univreference to universe to delete

Definition at line 380 of file CSGBase.C.

381 {
382  if (!checkUniverseInBase(univ))
383  mooseError("Universe with name ",
384  univ.getName(),
385  " cannot be deleted as it is different from the universe of the same name in the "
386  "CSGBase instance.");
387 
388  // Check if universe is the root universe
389  if (univ == getRootUniverse())
390  mooseError("Cannot delete root universe from CSGBase instance");
391 
392  // Check if universe is used in any existing lattices
393  for (const auto & lat : _lattice_list.getAllLattices())
394  {
395  const auto & lattice_univs = lat.get().getUniqueUniverses();
396  for (const auto & lat_univ : lattice_univs)
397  if (univ == lat_univ.get())
398  mooseError("Cannot delete universe with name ",
399  univ.getName(),
400  " as it is used in lattice with name ",
401  lat.get().getName());
402  if ((lat.get().getOuterType() == "UNIVERSE") && (lat.get().getOuterUniverse() == univ))
403  mooseError("Cannot delete universe with name ",
404  univ.getName(),
405  " as it is used as the outer universe of lattice with name ",
406  lat.get().getName());
407  }
408 
409  // Check if universe is used as fill in existing cells
410  for (const auto & cell_ref : _cell_list.getAllCells())
411  {
412  const auto & cell = cell_ref.get();
413  if ((cell.getFillType() == "UNIVERSE") && (cell.getFillUniverse() == univ))
414  mooseError("Cannot delete universe with name ",
415  univ.getName(),
416  " as it is used as the fill of cell with name ",
417  cell.getName());
418  }
419 
420  _universe_list.getUniverseListMap().erase(univ.getName());
421 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:83
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all the lattices in CSGBase instance.
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > & getUniverseListMap()
Get non-const map of all names to universes in universe list.

◆ FRIEND_TEST() [1/3]

CSG::CSGBase::FRIEND_TEST ( CSGBaseTest  ,
testCheckRegionSurfaces   
)
private

Friends for unit testing.

◆ FRIEND_TEST() [2/3]

CSG::CSGBase::FRIEND_TEST ( CSGBaseTest  ,
testAddGetSurface   
)
private

◆ FRIEND_TEST() [3/3]

CSG::CSGBase::FRIEND_TEST ( CSGBaseTest  ,
testUniverseLinking   
)
private

◆ generateOutput()

nlohmann::json CSG::CSGBase::generateOutput ( ) const

generate the JSON representation output for the CSG object

Returns
nlohmann::json JSON object representing the CSG model

Definition at line 1041 of file CSGBase.C.

1042 {
1043  // Check that orphaned universes do not exist in universe list of CSGBase object
1045 
1046  nlohmann::json csg_json;
1047 
1048  csg_json["surfaces"] = {};
1049  csg_json["cells"] = {};
1050  csg_json["universes"] = {};
1051 
1052  // get all surfaces information
1053  auto all_surfs = getAllSurfaces();
1054  for (const CSGSurface & s : all_surfs)
1055  {
1056  const auto & surf_name = s.getName();
1057  const auto & coeffs = s.getCoeffs();
1058  csg_json["surfaces"][surf_name] = {{"type", s.getSurfaceType()}, {"coefficients", {}}};
1059  for (const auto & c : coeffs)
1060  csg_json["surfaces"][surf_name]["coefficients"][c.first] = c.second;
1061  // include any information about transformations if present
1062  if (s.getTransformations().size() > 0)
1063  csg_json["surfaces"][surf_name]["transformations"] = s.getTransformationsAsStrings();
1064  }
1065 
1066  // Print out cell information
1067  auto all_cells = getAllCells();
1068  for (const CSGCell & c : all_cells)
1069  {
1070  const auto & cell_name = c.getName();
1071  const auto & cell_region_infix = c.getRegion().toInfixJSON();
1072  const auto & cell_region_postfix = c.getRegion().toPostfixStringList();
1073  const auto & cell_filltype = c.getFillType();
1074  const auto & fill_name = c.getFillName();
1075  csg_json["cells"][cell_name]["filltype"] = cell_filltype;
1076  csg_json["cells"][cell_name]["region_infix"] = cell_region_infix;
1077  csg_json["cells"][cell_name]["region_postfix"] = cell_region_postfix;
1078  csg_json["cells"][cell_name]["fill"] = fill_name;
1079  // include any information about transformations if present
1080  if (c.getTransformations().size())
1081  csg_json["cells"][cell_name]["transformations"] = c.getTransformationsAsStrings();
1082  }
1083 
1084  // Print out universe information
1085  auto all_univs = getAllUniverses();
1086  for (const CSGUniverse & u : all_univs)
1087  {
1088  const auto & univ_name = u.getName();
1089  const auto & univ_cells = u.getAllCells();
1090  csg_json["universes"][univ_name]["cells"] = {};
1091  for (const CSGCell & c : univ_cells)
1092  csg_json["universes"][univ_name]["cells"].push_back(c.getName());
1093  if (u.isRoot())
1094  csg_json["universes"][univ_name]["root"] = u.isRoot();
1095  // include any information about transformations if present
1096  if (u.getTransformations().size())
1097  csg_json["universes"][univ_name]["transformations"] = u.getTransformationsAsStrings();
1098  }
1099 
1100  // print out lattice information if lattices exist
1101  auto all_lats = getAllLattices();
1102  if (all_lats.size())
1103  {
1104  csg_json["lattices"] = {};
1105  for (const CSGLattice & lat : all_lats)
1106  {
1107  const auto & lat_name = lat.getName();
1108  csg_json["lattices"][lat_name] = {};
1109  csg_json["lattices"][lat_name]["type"] = lat.getType();
1110  const auto & outer_type = lat.getOuterType();
1111  csg_json["lattices"][lat_name]["outertype"] = outer_type;
1112  if (outer_type == "UNIVERSE")
1113  csg_json["lattices"][lat_name]["outer"] = lat.getOuterUniverse().getName();
1114  else if (outer_type == "CSG_MATERIAL")
1115  csg_json["lattices"][lat_name]["outer"] = lat.getOuterMaterial();
1116  // write out any additional attributes
1117  csg_json["lattices"][lat_name]["attributes"] = {};
1118  const auto & lat_attrs = lat.getAttributes();
1119  for (const auto & attr : lat_attrs)
1120  csg_json["lattices"][lat_name]["attributes"][attr.first] = attr.second;
1121  // write the map of universe names: list of lists
1122  csg_json["lattices"][lat_name]["universes"] = lat.getUniverseNameMap();
1123  // include any information about transformations if present
1124  if (lat.getTransformations().size())
1125  csg_json["lattices"][lat_name]["transformations"] = lat.getTransformationsAsStrings();
1126  }
1127  }
1128 
1129  return csg_json;
1130 }
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all universe objects.
Definition: CSGBase.h:370
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all lattice objects.
Definition: CSGBase.h:496
void checkUniverseLinking() const
Check universes linked to root universe match universes defined in _universe_list.
Definition: CSGBase.C:986
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all cell objects.
Definition: CSGBase.h:203
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get all surface objects.
Definition: CSGBase.h:97

◆ getAllCells()

std::vector<std::reference_wrapper<const CSGCell> > CSG::CSGBase::getAllCells ( ) const
inline

Get all cell objects.

Returns
list of references to all CSGCell objects in CSGBase

Definition at line 203 of file CSGBase.h.

Referenced by checkUniverseLinking(), and generateOutput().

204  {
205  return _cell_list.getAllCells();
206  }
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:83
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ getAllLattices()

std::vector<std::reference_wrapper<const CSGLattice> > CSG::CSGBase::getAllLattices ( ) const
inline

Get all lattice objects.

Returns
list of references to CSGLattice objects in this CSGBase instance

Definition at line 496 of file CSGBase.h.

Referenced by generateOutput().

497  {
498  return _lattice_list.getAllLattices();
499  }
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all the lattices in CSGBase instance.
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ getAllSurfaces()

std::vector<std::reference_wrapper<const CSGSurface> > CSG::CSGBase::getAllSurfaces ( ) const
inline

Get all surface objects.

Returns
list of references to all CSGSurface objects in CSGBase

Definition at line 97 of file CSGBase.h.

Referenced by generateOutput().

98  {
100  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get list of references to all surfaces in surface list.

◆ getAllUniverses()

std::vector<std::reference_wrapper<const CSGUniverse> > CSG::CSGBase::getAllUniverses ( ) const
inline

Get all universe objects.

Returns
list of references to CSGUniverse objects in this CSGBase instance

Definition at line 370 of file CSGBase.h.

Referenced by checkUniverseLinking(), and generateOutput().

371  {
373  }
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all the universes in CSGBase instance.
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903

◆ getCellByName()

const CSGCell& CSG::CSGBase::getCellByName ( const std::string &  name) const
inline

Get a Cell object by name.

Parameters
namecell name
Returns
reference to CSGCell object

Definition at line 214 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

214 { return _cell_list.getCell(name); }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ getCellList() [1/2]

const CSGCellList& CSG::CSGBase::getCellList ( ) const
inlineprivate

Get a const reference to the CSGCellList object.

Returns
CSGCellList

Definition at line 692 of file CSGBase.h.

Referenced by CSGBase(), operator==(), replaceLatticeRefsByName(), replaceSurfaceRefsByName(), replaceUniverseRefsByName(), and updateIncomingCSGReferences().

692 { return _cell_list; }
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ getCellList() [2/2]

CSGCellList& CSG::CSGBase::getCellList ( )
inlineprivate

Get a non-const reference to the CSGCellList object.

Returns
CSGCellList

Definition at line 699 of file CSGBase.h.

699 { return _cell_list; }
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ getLatticeByName()

template<typename LatticeType = CSGLattice>
const LatticeType& CSG::CSGBase::getLatticeByName ( const std::string &  name)
inline

Get a lattice object of the specified type by name This is a templated method with a default type of CSGLattice.

If a specific lattice type is needed, it can be specified when calling. If the type is unknown or not specified, it will default to CSGLattice to get the base class reference. NOTE: if CSGLattice is used as the template type, any lattice type-specific attributes or methods may not be accessible, except using a reference cast.

Parameters
namelattice name
Returns
reference to CSGLattice object

Definition at line 513 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

514  {
515  const CSGLattice & lattice = _lattice_list.getLattice(name);
516  const LatticeType * typed_lattice = dynamic_cast<const LatticeType *>(&lattice);
517  if (!typed_lattice)
518  mooseError("Cannot get lattice " + name + ". Lattice is not of specified type " +
519  MooseUtils::prettyCppType<LatticeType>());
520  return *typed_lattice;
521  }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ getLatticeList() [1/2]

const CSGLatticeList& CSG::CSGBase::getLatticeList ( ) const
inlineprivate

Get a const reference to the CSGLatticeList object.

Returns
CSGLatticeList

Definition at line 720 of file CSGBase.h.

Referenced by CSGBase(), operator==(), replaceUniverseRefsByName(), and updateIncomingCSGReferences().

720 { return _lattice_list; }
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ getLatticeList() [2/2]

CSGLatticeList& CSG::CSGBase::getLatticeList ( )
inlineprivate

Get the CSGLatticeList object.

Returns
CSGLatticeList

Definition at line 727 of file CSGBase.h.

727 { return _lattice_list; }
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ getLinkedUniverses()

void CSG::CSGBase::getLinkedUniverses ( const CSGUniverse univ,
std::vector< std::string > &  linked_universe_names,
std::vector< std::string > &  linked_cell_names 
) const
private

Recursive method to retrieve all universes and cells linked to current universe.

Parameters
univReference to universe under consideration
linked_universe_namesList of universe names linked to current universe
linked_cell_namesList of cell names linked to current universe

Definition at line 1010 of file CSGBase.C.

Referenced by checkUniverseLinking().

1013 {
1014  linked_universe_names.push_back(univ.getName());
1015  const auto & univ_cells = univ.getAllCells();
1016  for (const CSGCell & cell : univ_cells)
1017  {
1018  linked_cell_names.push_back(cell.getName());
1019  if (cell.getFillType() == "UNIVERSE")
1020  getLinkedUniverses(cell.getFillUniverse(), linked_universe_names, linked_cell_names);
1021  else if (cell.getFillType() == "LATTICE")
1022  {
1023  const auto & lattice = cell.getFillLattice();
1024  for (const auto & univ_list : lattice.getUniverses())
1025  for (const auto & univ_ref : univ_list)
1026  {
1027  const CSGUniverse & lattice_univ = univ_ref.get();
1028  getLinkedUniverses(lattice_univ, linked_universe_names, linked_cell_names);
1029  }
1030 
1031  if (lattice.getOuterType() == "UNIVERSE")
1032  {
1033  const CSGUniverse & outer_univ = lattice.getOuterUniverse();
1034  getLinkedUniverses(outer_univ, linked_universe_names, linked_cell_names);
1035  }
1036  }
1037  }
1038 }
void getLinkedUniverses(const CSGUniverse &univ, std::vector< std::string > &linked_universe_names, std::vector< std::string > &linked_cell_names) const
Recursive method to retrieve all universes and cells linked to current universe.
Definition: CSGBase.C:1010

◆ getRootUniverse()

const CSGUniverse& CSG::CSGBase::getRootUniverse ( ) const
inline

Get the Root Universe object.

Returns
reference to root CSGUniverse

Definition at line 279 of file CSGBase.h.

Referenced by checkUniverseLinking(), createCell(), CSGBase(), deleteCell(), deleteUniverse(), and joinUniverseList().

279 { return _universe_list.getRoot(); }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
const CSGUniverse & getRoot() const
Get the root universe.

◆ getSurface()

CSGSurface& CSG::CSGBase::getSurface ( const std::string &  name)
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

Parameters
namesurface name
Returns
reference to CSGSurface object

Definition at line 657 of file CSGBase.h.

657 { return _surface_list.getSurface(name); }
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ getSurfaceByName()

const CSGSurface& CSG::CSGBase::getSurfaceByName ( const std::string &  name) const
inline

Get a Surface object by name.

Parameters
namesurface name
Returns
reference to CSGSurface object

Definition at line 108 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

109  {
110  return _surface_list.getSurface(name);
111  }
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ getSurfaceList() [1/2]

const CSGSurfaceList& CSG::CSGBase::getSurfaceList ( ) const
inlineprivate

Get a const reference to the CSGSurfaceList object.

Returns
CSGSurfaceList

Definition at line 678 of file CSGBase.h.

Referenced by operator==(), and updateIncomingCSGReferences().

678 { return _surface_list; }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ getSurfaceList() [2/2]

CSGSurfaceList& CSG::CSGBase::getSurfaceList ( )
inlineprivate

Get a non-const reference to the CSGSurfaceList object.

Returns
CSGSurfaceList

Definition at line 685 of file CSGBase.h.

685 { return _surface_list; }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ getUniverseByName()

const CSGUniverse& CSG::CSGBase::getUniverseByName ( const std::string &  name)
inline

Get a universe object by name.

Parameters
nameuniverse name
Returns
reference to CSGUniverse object

Definition at line 381 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

382  {
383  return _universe_list.getUniverse(name);
384  }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.

◆ getUniverseList() [1/2]

const CSGUniverseList& CSG::CSGBase::getUniverseList ( ) const
inlineprivate

Get a const reference to the CSGUniverseList object.

Returns
CSGUniverseList

Definition at line 706 of file CSGBase.h.

Referenced by CSGBase(), operator==(), replaceCellRefsByName(), and updateIncomingCSGReferences().

706 { return _universe_list; }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903

◆ getUniverseList() [2/2]

CSGUniverseList& CSG::CSGBase::getUniverseList ( )
inlineprivate

Get a non-const reference to the CSGUniverseList object.

Returns
CSGUniverseList

Definition at line 713 of file CSGBase.h.

713 { return _universe_list; }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903

◆ hasCell()

bool CSG::CSGBase::hasCell ( const std::string &  name) const
inline

Check if a cell with given name exists in CSGBase object.

Parameters
namecell name
Returns
true if cell with given name exists in CSGBase

Definition at line 222 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

222 { return _cell_list.hasCell(name); }
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
Definition: CSGCellList.h:85

◆ hasLattice()

bool CSG::CSGBase::hasLattice ( const std::string &  name) const
inline

Check if a lattice with given name exists in CSGBase object.

Parameters
namelattice name
Returns
true if lattice with given name exists in CSGBase

Definition at line 529 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

529 { return _lattice_list.hasLattice(name); }
bool hasLattice(const std::string &name) const
return whether lattice with given name exists in lattice list
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ hasSurface()

bool CSG::CSGBase::hasSurface ( const std::string &  name) const
inline

Check if a surface with given name exists in CSGBase object.

Parameters
namesurface name
Returns
true if surface with given name exists in CSGBase

Definition at line 119 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

119 { return _surface_list.hasSurface(name); }
bool hasSurface(const std::string &name) const
return whether surface with given name exists in surface list
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897

◆ hasUniverse()

bool CSG::CSGBase::hasUniverse ( const std::string &  name) const
inline

Check if a universe with given name exists in CSGBase object.

Parameters
nameuniverse name
Returns
true if universe with given name exists in CSGBase

Definition at line 392 of file CSGBase.h.

Referenced by updateIncomingCSGReferences().

392 { return _universe_list.hasUniverse(name); }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
bool hasUniverse(const std::string &name) const
return whether universe with given name exists in universe list

◆ joinCellList()

void CSG::CSGBase::joinCellList ( CSGCellList cell_list,
const bool  ignore_identical_cells 
)
private

join a separate CSGCellList object to this one

Parameters
cell_listCSGCellList from a separate CSGBase object
ignore_identical_cellsif true, will skip adding identical cells to the CSGBase object

Definition at line 847 of file CSGBase.C.

Referenced by joinOtherBase().

848 {
849  auto & cell_list_map = cell_list.getCellListMap();
850  for (auto & c : cell_list_map)
851  _cell_list.addCell(std::move(c.second), ignore_identical_cells);
852 }
CSGCell & addCell(std::unique_ptr< CSGCell > cell, const bool ignore_identical_cell=false)
add a cell to the CellList.
Definition: CSGCellList.C:18
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900

◆ joinLatticeList()

void CSG::CSGBase::joinLatticeList ( CSGLatticeList lattice_list,
const bool  ignore_identical_lattices 
)
private

join a separate CSGLatticeList object to this one

Parameters
lattice_listCSGLatticeList from a separate CSGBase object
ignore_identical_latticesif true, will skip adding identical lattices to the CSGBase object

Definition at line 855 of file CSGBase.C.

Referenced by joinOtherBase().

856 {
857  auto & lat_list_map = lattice_list.getLatticeListMap();
858  for (auto & lat : lat_list_map)
859  _lattice_list.addLattice(std::move(lat.second), ignore_identical_lattices);
860 }
CSGLattice & addLattice(std::unique_ptr< CSGLattice > lattice, const bool ignore_identical_lattice=false)
add an existing lattice to list.
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ joinOtherBase() [1/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base,
const bool  ignore_identical_components 
)

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.

Parameters
basepointer to a different CSGBase object
ignore_identical_componentsif true, will skip adding identical components (surfaces, cells, universes, lattices) to the CSGBase object

Definition at line 663 of file CSGBase.C.

664 {
665  // If we are ignoring identical incoming CSG components, we need to update any references
666  // stored by these components to point to the references of the pre-existing CSGBase object
667  if (ignore_identical_components)
669  joinSurfaceList(base->getSurfaceList(), ignore_identical_components);
670  joinCellList(base->getCellList(), ignore_identical_components);
671  joinLatticeList(base->getLatticeList(), ignore_identical_components);
672  joinUniverseList(base->getUniverseList(), ignore_identical_components);
673 }
void updateIncomingCSGReferences(CSGBase &incoming_base)
update references of incoming CSGbase to point to those of existing CSGBase object.
Definition: CSGBase.C:708
void joinSurfaceList(CSGSurfaceList &surf_list, const bool ignore_identical_surfaces)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:839
void joinLatticeList(CSGLatticeList &lattice_list, const bool ignore_identical_lattices)
join a separate CSGLatticeList object to this one
Definition: CSGBase.C:855
void joinCellList(CSGCellList &cell_list, const bool ignore_identical_cells)
join a separate CSGCellList object to this one
Definition: CSGBase.C:847
void joinUniverseList(CSGUniverseList &univ_list, const bool ignore_identical_universes)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:863

◆ joinOtherBase() [2/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base,
const bool  ignore_identical_components,
const 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.

Parameters
basepointer to a different CSGBase object
ignore_identical_componentsif true, will skip adding identical components (surfaces, cells, universes, lattices) to the CSGBase object
new_root_name_joinnew name for the universe generated from the incoming root universe

Definition at line 676 of file CSGBase.C.

679 {
680  // If we are ignoring identical incoming CSG components, we need to update any references
681  // stored by these components to point to the references of the pre-existing CSGBase object
682  if (ignore_identical_components)
684  joinSurfaceList(base->getSurfaceList(), ignore_identical_components);
685  joinCellList(base->getCellList(), ignore_identical_components);
686  joinLatticeList(base->getLatticeList(), ignore_identical_components);
687  joinUniverseList(base->getUniverseList(), ignore_identical_components, new_root_name_join);
688 }
void updateIncomingCSGReferences(CSGBase &incoming_base)
update references of incoming CSGbase to point to those of existing CSGBase object.
Definition: CSGBase.C:708
void joinSurfaceList(CSGSurfaceList &surf_list, const bool ignore_identical_surfaces)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:839
void joinLatticeList(CSGLatticeList &lattice_list, const bool ignore_identical_lattices)
join a separate CSGLatticeList object to this one
Definition: CSGBase.C:855
void joinCellList(CSGCellList &cell_list, const bool ignore_identical_cells)
join a separate CSGCellList object to this one
Definition: CSGBase.C:847
void joinUniverseList(CSGUniverseList &univ_list, const bool ignore_identical_universes)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:863

◆ joinOtherBase() [3/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base,
const bool  ignore_identical_components,
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.

Parameters
basepointer to a different CSGBase object
ignore_identical_componentsif true, will skip adding identical components (surfaces, cells, universes, lattices) to the CSGBase object
new_root_name_basenew name for universe generated from this root universe
new_root_name_joinnew name for the universe generated from the incoming root universe

Definition at line 691 of file CSGBase.C.

695 {
696  // If we are ignoring identical incoming CSG components, we need to update any references
697  // stored by these components to point to the references of the pre-existing CSGBase object
698  if (ignore_identical_components)
700  joinSurfaceList(base->getSurfaceList(), ignore_identical_components);
701  joinCellList(base->getCellList(), ignore_identical_components);
702  joinLatticeList(base->getLatticeList(), ignore_identical_components);
704  base->getUniverseList(), ignore_identical_components, new_root_name_base, new_root_name_join);
705 }
void updateIncomingCSGReferences(CSGBase &incoming_base)
update references of incoming CSGbase to point to those of existing CSGBase object.
Definition: CSGBase.C:708
void joinSurfaceList(CSGSurfaceList &surf_list, const bool ignore_identical_surfaces)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:839
void joinLatticeList(CSGLatticeList &lattice_list, const bool ignore_identical_lattices)
join a separate CSGLatticeList object to this one
Definition: CSGBase.C:855
void joinCellList(CSGCellList &cell_list, const bool ignore_identical_cells)
join a separate CSGCellList object to this one
Definition: CSGBase.C:847
void joinUniverseList(CSGUniverseList &univ_list, const bool ignore_identical_universes)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:863

◆ joinSurfaceList()

void CSG::CSGBase::joinSurfaceList ( CSGSurfaceList surf_list,
const bool  ignore_identical_surfaces 
)
private

join a separate CSGSurfaceList object to this one

Parameters
surf_listCSGSurfaceList from a separate CSGBase object
ignore_identical_surfacesif true, will skip adding identical surfaces to the CSGBase object

Definition at line 839 of file CSGBase.C.

Referenced by joinOtherBase().

840 {
841  auto & surf_list_map = surf_list.getSurfaceListMap();
842  for (auto & s : surf_list_map)
843  _surface_list.addSurface(std::move(s.second), ignore_identical_surfaces);
844 }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf, const bool ignore_identical_surface=false)
add a surface object to existing SurfaceList.

◆ joinUniverseList() [1/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list,
const bool  ignore_identical_universes 
)
private

join a separate CSGUniverseList object to this one; root universes from univ_list will be combined into this root universe

Parameters
univ_listCSGUniverseList from a separate CSGBase object
ignore_identical_universesif true, will skip adding identical universes to the CSGBase object

Definition at line 863 of file CSGBase.C.

Referenced by joinOtherBase().

864 {
865  // case 1: incoming root is joined into existing root; no new universes are created
866  auto & univ_list_map = univ_list.getUniverseListMap();
867  auto & root = getRootUniverse(); // this root universe
868  for (auto & u : univ_list_map)
869  {
870  if (u.second->isRoot())
871  {
872  // add existing cells to current root instead of creating new universe
873  auto all_cells = u.second->getAllCells();
874  for (auto & cell : all_cells)
875  addCellToUniverse(root, cell);
876  }
877  else // unique non-root universe to add to list
878  _universe_list.addUniverse(std::move(u.second), ignore_identical_universes);
879  }
880 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:424

◆ joinUniverseList() [2/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list,
const bool  ignore_identical_universes,
const std::string &  new_root_name_incoming 
)
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.

Parameters
univ_listCSGUniverseList from a separate CSGBase object
ignore_identical_universesif true, will skip adding identical universes to the CSGBase object
new_root_name_incomingnew name for the universe generated from the incoming root universe

Definition at line 883 of file CSGBase.C.

886 {
887  // case 2: incoming root is turned into new universe and existing root remains root
888 
889  // add incoming universes to current Base
890  auto & all_univs = univ_list.getUniverseListMap();
891  for (auto & u : all_univs)
892  {
893  if (u.second->isRoot())
894  {
895  // create new universe from incoming root universe
896  auto all_cells = u.second->getAllCells();
897  createUniverse(new_root_name_incoming, all_cells);
898  }
899  else // unique non-root universe to add to list
900  _universe_list.addUniverse(std::move(u.second), ignore_identical_universes);
901  }
902 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
const CSGUniverse & createUniverse(const std::string &name)
Create an empty Universe object.
Definition: CSGBase.h:308

◆ joinUniverseList() [3/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list,
const bool  ignore_identical_universes,
const std::string &  new_root_name_base,
const std::string &  new_root_name_incoming 
)
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.

Parameters
univ_listCSGUniverseList from a separate CSGBase object
ignore_identical_universesif true, will skip adding identical lattices to the CSGBase object
new_root_name_basenew name for universe generated from this root universe
new_root_name_incomingnew name for the universe generated from the incoming root universe

Definition at line 905 of file CSGBase.C.

909 {
910  // case 3: each root universe becomes a new universe and a new root is created
911 
912  // make a new universe from the existing root universe
913  auto & root = getRootUniverse();
914  auto root_cells = root.getAllCells();
915  createUniverse(new_root_name_base, root_cells);
916  removeCellsFromUniverse(root, root_cells);
917 
918  // add incoming universes to current Base
919  auto & all_univs = univ_list.getUniverseListMap();
920  for (auto & u : all_univs)
921  {
922  if (u.second->isRoot())
923  {
924  // create new universe from incoming root universe
925  auto all_cells = u.second->getAllCells();
926  createUniverse(new_root_name_incoming, all_cells);
927  }
928  else // unique non-root universe to add to list
929  _universe_list.addUniverse(std::move(u.second), ignore_identical_universes);
930  }
931 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:279
void removeCellsFromUniverse(const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells)
Remove a list of cells from an existing universe.
Definition: CSGBase.C:466
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
const CSGUniverse & createUniverse(const std::string &name)
Create an empty Universe object.
Definition: CSGBase.h:308

◆ operator!=()

bool CSG::CSGBase::operator!= ( const CSGBase other) const

Operator overload for checking if two CSGBase objects are not equal.

Definition at line 1148 of file CSGBase.C.

1149 {
1150  return !(*this == other);
1151 }

◆ operator==()

bool CSG::CSGBase::operator== ( const CSGBase other) const

Operator overload for checking if two CSGBase objects are equal.

Definition at line 1133 of file CSGBase.C.

1134 {
1135  const auto & surf_list = this->getSurfaceList();
1136  const auto & other_surf_list = other.getSurfaceList();
1137  const auto & cell_list = this->getCellList();
1138  const auto & other_cell_list = other.getCellList();
1139  const auto & univ_list = this->getUniverseList();
1140  const auto & other_univ_list = other.getUniverseList();
1141  const auto & lat_list = this->getLatticeList();
1142  const auto & other_lat_list = other.getLatticeList();
1143  return (surf_list == other_surf_list) && (cell_list == other_cell_list) &&
1144  (univ_list == other_univ_list) && (lat_list == other_lat_list);
1145 }
const CSGLatticeList & getLatticeList() const
Get a const reference to the CSGLatticeList object.
Definition: CSGBase.h:720
const CSGSurfaceList & getSurfaceList() const
Get a const reference to the CSGSurfaceList object.
Definition: CSGBase.h:678
const CSGCellList & getCellList() const
Get a const reference to the CSGCellList object.
Definition: CSGBase.h:692
const CSGUniverseList & getUniverseList() const
Get a const reference to the CSGUniverseList object.
Definition: CSGBase.h:706

◆ removeCellFromUniverse()

void CSG::CSGBase::removeCellFromUniverse ( const CSGUniverse universe,
const CSGCell cell 
)

Remove a cell from an existing universe.

Parameters
universeuniverse from which to remove the cell
cellcell to remove

Definition at line 449 of file CSGBase.C.

Referenced by removeCellsFromUniverse().

450 {
451  // make sure cell is a part of this CSGBase instance
452  if (!checkCellInBase(cell))
453  mooseError("A cell named " + cell.getName() + " is being removed from universe " +
454  universe.getName() +
455  " that is different from the cell of the same name in the CSGBase instance.");
456  // make sure universe is a part of this CSGBase instance
457  if (!checkUniverseInBase(universe))
458  mooseError("Cells are being removed from a universe named " + universe.getName() +
459  " that is different " +
460  "from the universe of the same name in the CSGBase instance.");
461  auto & univ = _universe_list.getUniverse(universe.getName());
462  univ.removeCell(cell.getName());
463 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void removeCell(const std::string &name)
remove a cell of the specified name from the universe
Definition: CSGUniverse.C:59
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ 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.

Parameters
universeuniverse from which to remove the cells
cellslist of references to cells to remove

Definition at line 466 of file CSGBase.C.

Referenced by joinUniverseList().

468 {
469  for (auto & c : cells)
470  removeCellFromUniverse(universe, c);
471 }
void removeCellFromUniverse(const CSGUniverse &universe, const CSGCell &cell)
Remove a cell from an existing universe.
Definition: CSGBase.C:449

◆ renameCell()

void CSG::CSGBase::renameCell ( const CSGCell cell,
const std::string &  name 
)
inline

rename the specified cell

Parameters
cellreference to CSGCell to rename
namenew name

Definition at line 230 of file CSGBase.h.

231  {
232  _cell_list.renameCell(cell, name);
233  }
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
void renameCell(const CSGCell &cell, const std::string &name)
rename the specified cell
Definition: CSGCellList.C:92

◆ renameLattice()

void CSG::CSGBase::renameLattice ( const CSGLattice lattice,
const std::string &  name 
)
inline

rename the lattice

Parameters
latticelattice to rename
namenew name

Definition at line 461 of file CSGBase.h.

462  {
463  _lattice_list.renameLattice(lattice, name);
464  }
void renameLattice(const CSGLattice &lattice, const std::string &name)
rename the specified lattice
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906

◆ renameRootUniverse()

void CSG::CSGBase::renameRootUniverse ( const std::string &  name)
inline

rename the root universe for this instance (default is ROOT_UNIVERSE)

Parameters
namenew name for the root universe

Definition at line 286 of file CSGBase.h.

287  {
289  }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
const CSGUniverse & getRoot() const
Get the root universe.
void renameUniverse(const CSGUniverse &universe, const std::string &name)
rename the specified universe

◆ renameSurface()

void CSG::CSGBase::renameSurface ( const CSGSurface surface,
const std::string &  name 
)
inline

rename the specified surface

Parameters
surfaceCSGSurface to rename
namenew name

Definition at line 127 of file CSGBase.h.

128  {
129  _surface_list.renameSurface(surface, name);
130  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:897
void renameSurface(const CSGSurface &surface, const std::string &name)
rename the specified surface

◆ renameUniverse()

void CSG::CSGBase::renameUniverse ( const CSGUniverse universe,
const std::string &  name 
)
inline

rename the specified universe

Parameters
universereference to CSGUniverse to rename
namenew name

Definition at line 297 of file CSGBase.h.

298  {
299  _universe_list.renameUniverse(universe, name);
300  }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:903
void renameUniverse(const CSGUniverse &universe, const std::string &name)
rename the specified universe

◆ replaceCellRefsByName()

void CSG::CSGBase::replaceCellRefsByName ( std::map< std::string, std::reference_wrapper< const CSGCell >> &  identical_cell_refs,
CSGBase base 
)
private

update cell references of incoming CSGbase to point to those of existing CSGBase object based on CSGCell name.

This involves updating the cell references of universes.

Parameters
identical_cell_refsmap of cell names to cell references that will be used for replacement
baseCSGBase object that contains references that should be updated

Definition at line 768 of file CSGBase.C.

Referenced by updateIncomingCSGReferences().

771 {
772  // Update cell references of universes to those of this base
773  for (auto & [univ_name, univ_ptr] : base.getUniverseList().getUniverseListMap())
774  for (auto & [cell_name, cell_ref] : identical_cell_refs)
775  if (univ_ptr->hasCell(cell_name))
776  {
777  univ_ptr->removeCell(cell_name);
778  univ_ptr->addCell(cell_ref);
779  }
780 }

◆ replaceLatticeRefsByName()

void CSG::CSGBase::replaceLatticeRefsByName ( std::map< std::string, std::reference_wrapper< const CSGLattice >> &  identical_lattice_refs,
CSGBase base 
)
private

update lattice references of incoming CSGbase to point to those of existing CSGBase object based on CSGLattice name.

This involves updating the lattice references of cells.

Parameters
identical_lattice_refsmap of lattice names to lattice references that will be used for replacement
baseCSGBase object that contains references that should be updated

Definition at line 820 of file CSGBase.C.

Referenced by updateIncomingCSGReferences().

823 {
824  // Update lattice references of cells to those of this base
825  for (auto & [cell_name, cell_ptr] : base.getCellList().getCellListMap())
826  {
827  const auto fill_type = cell_ptr->getFillType();
828  const auto fill_name = cell_ptr->getFillName();
829  if ((fill_type == "LATTICE") &&
830  (identical_lattice_refs.find(fill_name) != identical_lattice_refs.end()))
831  {
832  const CSGLattice * lat_ptr = &identical_lattice_refs.at(fill_name).get();
833  cell_ptr->updateCellFill(lat_ptr);
834  }
835  }
836 }

◆ replaceSurfaceRefsByName()

void CSG::CSGBase::replaceSurfaceRefsByName ( std::map< std::string, std::reference_wrapper< const CSGSurface >> &  identical_surface_refs,
CSGBase base 
)
private

update surface references of incoming CSGBase to point to those of existing CSGBase object based on CSGSurface name.

This involves updating the surface references of cell regions.

Parameters
identical_surface_refsmap of surface names to surface references that will be used for replacement
baseCSGBase object that contains references that should be updated

Definition at line 758 of file CSGBase.C.

Referenced by updateIncomingCSGReferences().

761 {
762  // Update surface references of cell regions to those of this base
763  for (auto & [cell_name, cell_ptr] : base.getCellList().getCellListMap())
764  cell_ptr->updateCellRegionSurfaces(identical_surface_refs);
765 }

◆ replaceUniverseRefsByName()

void CSG::CSGBase::replaceUniverseRefsByName ( std::map< std::string, std::reference_wrapper< const CSGUniverse >> &  identical_universe_refs,
CSGBase base 
)
private

update universe references of incoming CSGbase to point to those of existing CSGBase object based on CSGUniverse name.

This involves updating the universe references of cells and universe references of lattices.

Parameters
identical_universe_refsmap of universe names to universe references that will be used for replacement
baseCSGBase object that contains references that should be updated

Definition at line 783 of file CSGBase.C.

Referenced by updateIncomingCSGReferences().

786 {
787  // Update universe references of cells to those of this base
788  for (auto & [cell_name, cell_ptr] : base.getCellList().getCellListMap())
789  {
790  const auto fill_type = cell_ptr->getFillType();
791  const auto fill_name = cell_ptr->getFillName();
792  if ((fill_type == "UNIVERSE") &&
793  (identical_universe_refs.find(fill_name) != identical_universe_refs.end()))
794  {
795  const CSGUniverse * univ_ptr = &identical_universe_refs.at(fill_name).get();
796  cell_ptr->updateCellFill(univ_ptr);
797  }
798  }
799 
800  // Update universe references of lattices to those of this base
801  for (auto & [lat_name, lat_ptr] : base.getLatticeList().getLatticeListMap())
802  for (auto & [univ_name, univ_ref] : identical_universe_refs)
803  {
804  // Check if universe belongs to lattice
805  if (lat_ptr->hasUniverse(univ_name))
806  {
807  // If so, replace all instances of this universe in the lattice
808  const auto univ_indices = lat_ptr->getUniverseIndices(univ_name);
809  for (const auto & index : univ_indices)
810  lat_ptr->setUniverseAtIndex(univ_ref, index);
811  }
812  // Check if universe belongs to lattice outer
813  if ((lat_ptr->getOuterType() == "UNIVERSE") &&
814  (lat_ptr->getOuterUniverse().getName() == univ_name))
815  lat_ptr->updateOuter(univ_ref);
816  }
817 }

◆ resetCellFill()

void CSG::CSGBase::resetCellFill ( const CSGCell cell)

reset the fill of the specified cell to void

Parameters
cellcell to update the fill for

Definition at line 317 of file CSGBase.C.

318 {
319  if (!checkCellInBase(cell))
320  mooseError("The fill of cell with name " + cell.getName() +
321  " that is being updated is different " +
322  "from the cell of the same name in the CSGBase instance.");
323  auto & list_cell = _cell_list.getCell(cell.getName());
324  list_cell.resetCellFill();
325 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void resetCellFill()
Reset the cell fill to void.
Definition: CSGCell.C:85
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ resetLatticeOuter()

void CSG::CSGBase::resetLatticeOuter ( const CSGLattice lattice)

reset the outer fill for the lattice to VOID

Parameters
latticelattice to update

Definition at line 499 of file CSGBase.C.

500 {
501  auto name = lattice.getName();
502  if (!checkLatticeInBase(lattice))
503  mooseError("Cannot reset outer for lattice " + name +
504  ". Lattice is different from the lattice of the same name in the "
505  "CSGBase instance.");
507 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void resetOuter()
reset the outer fill around the lattice elements to be VOID
Definition: CSGLattice.C:145
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ setLatticeOuter() [1/2]

void CSG::CSGBase::setLatticeOuter ( const CSGLattice lattice,
const std::string &  outer_name 
)

Set the outer fill for the lattice to the material name provided.

This will set the outer type to CSG_MATERIAL regardless of its previous outer type.

Parameters
latticelattice to update
outer_namename of material to use as outer fill between lattice elements

Definition at line 474 of file CSGBase.C.

475 {
476  auto name = lattice.getName();
477  if (!checkLatticeInBase(lattice))
478  mooseError("Cannot set outer for lattice " + name +
479  ". Lattice is different from the lattice of the same name in the "
480  "CSGBase instance.");
481  _lattice_list.getLattice(name).updateOuter(outer_name);
482 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void updateOuter(const std::string &outer_name)
Update the outer of the lattice to be the provided material name.
Definition: CSGLattice.C:137
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ setLatticeOuter() [2/2]

void CSG::CSGBase::setLatticeOuter ( const CSGLattice lattice,
const CSGUniverse outer_univ 
)

Set the outer fill for the lattice to the universe provided.

This will set the outer type to UNIVERSE regardless of its previous outer type.

Parameters
latticelattice to update
outer_univuniverse to use as outer fill between lattice elements

Definition at line 485 of file CSGBase.C.

486 {
487  auto name = lattice.getName();
488  if (!checkLatticeInBase(lattice))
489  mooseError("Cannot set outer universe for lattice " + name +
490  ". Lattice is different from the lattice of the same name in the "
491  "CSGBase instance.");
492  if (!checkUniverseInBase(outer_univ))
493  mooseError("Cannot set outer universe for lattice " + name + ". Outer universe " +
494  outer_univ.getName() + " is not in the CSGBase instance.");
495  _lattice_list.getLattice(name).updateOuter(outer_univ);
496 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void updateOuter(const std::string &outer_name)
Update the outer of the lattice to be the provided material name.
Definition: CSGLattice.C:137
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ setLatticeUniverses()

void CSG::CSGBase::setLatticeUniverses ( const CSGLattice lattice,
std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> &  universes 
)

Set provided universes as the layout of the lattice.

Parameters
latticelattice to add universes to
universeslist of list of universes in the proper layout for the lattice type and dimensions

Definition at line 526 of file CSGBase.C.

529 {
530  auto name = lattice.getName();
531  if (!checkLatticeInBase(lattice))
532  mooseError("Cannot set universes for lattice " + name +
533  ". Lattice is different from the lattice of the same name in the "
534  "CSGBase instance.");
535  // make sure all universes are a part of this base instance
536  for (auto univ_list : universes)
537  for (const CSGUniverse & univ : univ_list)
538  if (!checkUniverseInBase(univ))
539  mooseError("Cannot set universes for lattice " + name + ". Universe " + univ.getName() +
540  " is not in the CSGBase instance.");
541  _lattice_list.getLattice(name).setUniverses(universes);
542 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes)=0
assign the vectors of universes as the lattice elements
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ setUniverseAtLatticeIndex()

void CSG::CSGBase::setUniverseAtLatticeIndex ( const CSGLattice lattice,
const CSGUniverse universe,
std::pair< int, int index 
)

set location in the lattice to be the provided universe

Parameters
latticelattice to update
universeuniverse to set at the location
indexindex of the lattice element (int, int)

Definition at line 510 of file CSGBase.C.

513 {
514  auto name = lattice.getName();
515  if (!checkLatticeInBase(lattice))
516  mooseError("Cannot set universe at index for lattice " + name +
517  ". Lattice is different from the lattice of the same name in the "
518  "CSGBase instance.");
519  if (!checkUniverseInBase(universe))
520  mooseError("Cannot add universe " + universe.getName() + " to lattice " + lattice.getName() +
521  ". Universe is not in the CSGBase instance.");
522  _lattice_list.getLattice(name).setUniverseAtIndex(universe, index);
523 }
std::string name(const ElemQuality q)
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void setUniverseAtIndex(const CSGUniverse &universe, const std::pair< int, int > index)
replace the element at specified index in the lattice with the provided CSGUniverse.
Definition: CSGLattice.C:30
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
Definition: CSGBase.h:906
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.

◆ updateCellFill() [1/3]

void CSG::CSGBase::updateCellFill ( const CSGCell cell,
const std::string &  mat_name 
)

change the fill of the specified cell to a material fill

Parameters
cellcell to update the fill for
mat_namename of material fill

Definition at line 328 of file CSGBase.C.

329 {
330  if (!checkCellInBase(cell))
331  mooseError("The region of cell with name " + cell.getName() +
332  " that is being updated is different " +
333  "from the cell of the same name in the CSGBase instance.");
334  auto & list_cell = _cell_list.getCell(cell.getName());
335  list_cell.updateCellFill(mat_name);
336 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
Definition: CSGCell.C:94
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ updateCellFill() [2/3]

void CSG::CSGBase::updateCellFill ( const CSGCell cell,
const CSGUniverse univ 
)

change the fill of the specified cell to a universe fill

Parameters
cellcell to update the fill for
univpointer to universe fill

Definition at line 339 of file CSGBase.C.

340 {
341  if (!checkUniverseInBase(*univ))
342  mooseError("Universe with name ",
343  univ->getName(),
344  " is being used as a cell fill that is different from the universe of the same name "
345  "in the CSGBase instance.");
346  if (!checkCellInBase(cell))
347  mooseError("The fill of cell with name " + cell.getName() +
348  " that is being updated is different " +
349  "from the cell of the same name in the CSGBase instance.");
350  auto & list_cell = _cell_list.getCell(cell.getName());
351  list_cell.updateCellFill(univ);
352 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
Definition: CSGCell.C:94
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
bool checkUniverseInBase(const CSGUniverse &universe) const
Definition: CSGBase.C:966
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ updateCellFill() [3/3]

void CSG::CSGBase::updateCellFill ( const CSGCell cell,
const CSGLattice lattice 
)

change the fill of the specified cell to a lattice fill

Parameters
cellcell to update the fill for
latticepointer to lattice fill

Definition at line 355 of file CSGBase.C.

356 {
357  if (!checkLatticeInBase(*lattice))
358  mooseError("Lattice with name ",
359  lattice->getName(),
360  " is being used as a cell fill that is different from the lattice of the same name "
361  "in the CSGBase instance.");
362  if (!checkCellInBase(cell))
363  mooseError("The fill of cell with name " + cell.getName() +
364  " that is being updated is different " +
365  "from the cell of the same name in the CSGBase instance.");
366  auto & list_cell = _cell_list.getCell(cell.getName());
367  list_cell.updateCellFill(lattice);
368 }
bool checkLatticeInBase(const CSGLattice &lattice) const
Definition: CSGBase.C:976
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
Definition: CSGCell.C:94
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ updateCellRegion()

void CSG::CSGBase::updateCellRegion ( const CSGCell cell,
const CSGRegion region 
)

change the region of the specified cell

Parameters
cellcell to update the region for
regionnew region to assign to cell

Definition at line 305 of file CSGBase.C.

306 {
307  checkRegionSurfaces(region);
308  if (!checkCellInBase(cell))
309  mooseError("The region of cell with name " + cell.getName() +
310  " that is being updated is different " +
311  "from the cell of the same name in the CSGBase instance.");
312  auto & list_cell = _cell_list.getCell(cell.getName());
313  list_cell.updateRegion(region);
314 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:44
void updateRegion(const CSGRegion &region)
Definition: CSGCell.h:170
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:934
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:900
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:956

◆ updateIncomingCSGReferences()

void CSG::CSGBase::updateIncomingCSGReferences ( CSGBase incoming_base)
private

update references of incoming CSGbase to point to those of existing CSGBase object.

This includes updating the surface references of cell regions, universe/lattice references of cell fills, cell references of universes, and universe references of lattices

Parameters
incoming_baseCSGBase object that contains references that should be updated

Definition at line 708 of file CSGBase.C.

Referenced by joinOtherBase().

709 {
710  // Iterate through all incoming surfaces and track which ones have names already
711  // defined within this CSGSurfaceList object
712  std::map<std::string, std::reference_wrapper<const CSGSurface>> identical_surface_refs;
713  auto & surf_list_map = incoming_base.getSurfaceList().getSurfaceListMap();
714  for (const auto & [surf_name, surf_ptr] : surf_list_map)
715  if (hasSurface(surf_name))
716  identical_surface_refs.insert({surf_name, getSurfaceByName(surf_name)});
717 
718  // Iterate through all incoming cells and track which ones have names already
719  // defined within this CSGCellList object
720  std::map<std::string, std::reference_wrapper<const CSGCell>> identical_cell_refs;
721  auto & cell_list_map = incoming_base.getCellList().getCellListMap();
722  for (const auto & [cell_name, cell_ptr] : cell_list_map)
723  if (hasCell(cell_name))
724  identical_cell_refs.insert({cell_name, getCellByName(cell_name)});
725 
726  // Iterate through all incoming universes and track which ones have names already
727  // defined within this CSGUniverseList object
728  std::map<std::string, std::reference_wrapper<const CSGUniverse>> identical_universe_refs;
729  auto & universe_list_map = incoming_base.getUniverseList().getUniverseListMap();
730  for (const auto & [univ_name, univ_ptr] : universe_list_map)
731  if (hasUniverse(univ_name))
732  identical_universe_refs.insert({univ_name, getUniverseByName(univ_name)});
733 
734  // Iterate through all incoming lattices and track which ones have names already
735  // defined within this CSGLatticeList object
736  std::map<std::string, std::reference_wrapper<const CSGLattice>> identical_lattice_refs;
737  auto & lattice_list_map = incoming_base.getLatticeList().getLatticeListMap();
738  for (const auto & [lat_name, lat_ptr] : lattice_list_map)
739  if (hasLattice(lat_name))
740  identical_lattice_refs.insert({lat_name, getLatticeByName(lat_name)});
741 
742  // Update all surface, cell, universe, and lattice references of incoming base to those of this
743  // base
744  if (!identical_surface_refs.empty())
745  replaceSurfaceRefsByName(identical_surface_refs, incoming_base);
746 
747  if (!identical_cell_refs.empty())
748  replaceCellRefsByName(identical_cell_refs, incoming_base);
749 
750  if (!identical_universe_refs.empty())
751  replaceUniverseRefsByName(identical_universe_refs, incoming_base);
752 
753  if (!identical_lattice_refs.empty())
754  replaceLatticeRefsByName(identical_lattice_refs, incoming_base);
755 }
bool hasUniverse(const std::string &name) const
Check if a universe with given name exists in CSGBase object.
Definition: CSGBase.h:392
void replaceUniverseRefsByName(std::map< std::string, std::reference_wrapper< const CSGUniverse >> &identical_universe_refs, CSGBase &base)
update universe references of incoming CSGbase to point to those of existing CSGBase object based on ...
Definition: CSGBase.C:783
const CSGSurface & getSurfaceByName(const std::string &name) const
Get a Surface object by name.
Definition: CSGBase.h:108
void replaceLatticeRefsByName(std::map< std::string, std::reference_wrapper< const CSGLattice >> &identical_lattice_refs, CSGBase &base)
update lattice references of incoming CSGbase to point to those of existing CSGBase object based on C...
Definition: CSGBase.C:820
void replaceSurfaceRefsByName(std::map< std::string, std::reference_wrapper< const CSGSurface >> &identical_surface_refs, CSGBase &base)
update surface references of incoming CSGBase to point to those of existing CSGBase object based on C...
Definition: CSGBase.C:758
bool hasSurface(const std::string &name) const
Check if a surface with given name exists in CSGBase object.
Definition: CSGBase.h:119
bool hasCell(const std::string &name) const
Check if a cell with given name exists in CSGBase object.
Definition: CSGBase.h:222
bool hasLattice(const std::string &name) const
Check if a lattice with given name exists in CSGBase object.
Definition: CSGBase.h:529
const CSGCell & getCellByName(const std::string &name) const
Get a Cell object by name.
Definition: CSGBase.h:214
const LatticeType & getLatticeByName(const std::string &name)
Get a lattice object of the specified type by name This is a templated method with a default type of ...
Definition: CSGBase.h:513
void replaceCellRefsByName(std::map< std::string, std::reference_wrapper< const CSGCell >> &identical_cell_refs, CSGBase &base)
update cell references of incoming CSGbase to point to those of existing CSGBase object based on CSGC...
Definition: CSGBase.C:768
const CSGUniverse & getUniverseByName(const std::string &name)
Get a universe object by name.
Definition: CSGBase.h:381

Member Data Documentation

◆ _cell_list

CSGCellList CSG::CSGBase::_cell_list
private

◆ _lattice_list

CSGLatticeList CSG::CSGBase::_lattice_list
private

◆ _surface_list

CSGSurfaceList CSG::CSGBase::_surface_list
private

◆ _universe_list

CSGUniverseList CSG::CSGBase::_universe_list
private

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