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...
 
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...
 
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...
 
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...
 
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...
 
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 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...
 
void joinOtherBase (std::unique_ptr< CSGBase > base)
 Join another CSGBase object to this one. More...
 
void joinOtherBase (std::unique_ptr< CSGBase > base, std::string &new_root_name_join)
 Join another CSGBase object to this one. More...
 
void joinOtherBase (std::unique_ptr< CSGBase > base, const std::string &new_root_name_base, const std::string &new_root_name_join)
 Join another CSGBase object to this one. More...
 
nlohmann::json generateOutput () const
 generate the JSON representation output for the CSG object More...
 
bool operator== (const CSGBase &other) const
 Operator overload for checking if two CSGBase objects are equal. More...
 
bool operator!= (const CSGBase &other) const
 Operator overload for checking if two CSGBase objects are not equal. More...
 

Private Member Functions

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) const
 Recursive method to retrieve all universes 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...
 
void joinSurfaceList (CSGSurfaceList &surf_list)
 join a separate CSGSurfaceList object to this one More...
 
void joinCellList (CSGCellList &cell_list)
 join a separate CSGCellList object to this one More...
 
void joinUniverseList (CSGUniverseList &univ_list)
 join a separate CSGUniverseList object to this one; root universes from univ_list will be combined into this root universe More...
 
void joinUniverseList (CSGUniverseList &univ_list, const std::string &new_root_name_incoming)
 join a separate CSGUniverseList object to this one; the incoming root universe will be moved to a new universe of the new name specified. More...
 
void joinUniverseList (CSGUniverseList &univ_list, const std::string &new_root_name_base, const std::string &new_root_name_incoming)
 join a separate CSGUniverseList object to this one; both this root universe and the incoming root universe will be maintained as separate universes of the specified names. More...
 
void checkRegionSurfaces (const CSGRegion &region) const
 
bool checkCellInBase (const CSGCell &cell) const
 
bool checkUniverseInBase (const CSGUniverse &universe) 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...
 
 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...
 

Detailed Description

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

Definition at line 29 of file CSGBase.h.

Constructor & Destructor Documentation

◆ CSGBase() [1/2]

CSG::CSGBase::CSGBase ( )

Default constructor.

Definition at line 15 of file CSGBase.C.

16  : _surface_list(CSGSurfaceList()), _cell_list(CSGCellList()), _universe_list(CSGUniverseList())
17 {
18 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470

◆ CSGBase() [2/2]

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

Copy constructor.

Definition at line 20 of file CSGBase.C.

21  : _surface_list(other_base.getSurfaceList()),
22  _cell_list(CSGCellList()),
23  _universe_list(CSGUniverseList())
24 {
25  // Iterate through all cell references from the other CSGBase instance and
26  // create new CSGCell pointers based on these references. This is done
27  // recursively to properly handle cells with universe fills
28  for (const auto & [name, cell] : other_base.getCellList().getCellListMap())
29  addCellToList(*cell);
30 
31  // Link all cells in other_base root universe to current root universe
32  for (auto & root_cell : other_base.getRootUniverse().getAllCells())
33  {
34  const auto & list_cell = _cell_list.getCell(root_cell.get().getName());
35  addCellToUniverse(getRootUniverse(), list_cell);
36  }
37 
38  // Iterate through all universe references from the other CSGBase instance and
39  // create new CSGUniverse pointers based on these references. This is done in case
40  // any universe exist in the universe list that are not connected to the cell list.
41  for (const auto & [name, univ] : other_base.getUniverseList().getUniverseListMap())
42  addUniverseToList(*univ);
43 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:28
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
Definition: CSGBase.C:75
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
const CSGCell & addCellToList(const CSGCell &cell)
Add a new cell to the cell list based on a cell reference.
Definition: CSGBase.C:48
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:162

◆ ~CSGBase()

CSG::CSGBase::~CSGBase ( )

Destructor.

Definition at line 45 of file CSGBase.C.

45 {}

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 179 of file CSGBase.C.

Referenced by createUniverse().

181 {
182  for (auto & c : cells)
183  addCellToUniverse(universe, c);
184 }
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:162

◆ 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 48 of file CSGBase.C.

Referenced by addUniverseToList(), and CSGBase().

49 {
50  // If cell has already been created, we just return a reference to it
51  const auto name = cell.getName();
52  if (_cell_list.hasCell(name))
53  return _cell_list.getCell(name);
54 
55  // Otherwise if the cell has material or void cell, we can create it directly
56  const auto fill_type = cell.getFillType();
57  const auto region = cell.getRegion();
58  if (fill_type == "VOID")
59  return _cell_list.addVoidCell(name, region);
60  else if (fill_type == "CSG_MATERIAL")
61  {
62  const auto mat_name = cell.getFillMaterial();
63  return _cell_list.addMaterialCell(name, mat_name, region);
64  }
65  // Otherwise if the cell has a universe fill, we need to recursively define
66  // all linked universes and cells first before defining this cell
67  else
68  {
69  const auto & univ = addUniverseToList(cell.getFillUniverse());
70  return _cell_list.addUniverseCell(name, univ, region);
71  }
72 }
std::string name(const ElemQuality q)
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:28
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:66
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:37
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:43
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:51
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
Definition: CSGBase.C:75
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:43
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
Definition: CSGCellList.h:73

◆ 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 162 of file CSGBase.C.

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

163 {
164  // make sure cell is a part of this CSGBase instance
165  if (!checkCellInBase(cell))
166  mooseError("A cell named " + cell.getName() + " is being added to universe " +
167  universe.getName() +
168  " that is different from the cell of the same name in the CSGBase instance.");
169  // make sure universe is a part of this CSGBase instance
170  if (!checkUniverseInBase(universe))
171  mooseError("Cells are being added to a universe named " + universe.getName() +
172  " that is different " +
173  "from the universe of the same name in the CSGBase instance.");
174  auto & univ = _universe_list.getUniverse(universe.getName());
175  univ.addCell(cell);
176 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
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:352
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:342
void addCell(const CSGCell &cell)
add cell to universe
Definition: CSGUniverse.C:25

◆ 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 57 of file CSGBase.h.

58  {
59  return _surface_list.addSurface(std::move(surf));
60  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf)
add a surface object to existing SurfaceList.

◆ 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 75 of file CSGBase.C.

Referenced by addCellToList(), and CSGBase().

76 {
77  // If universe has already been created, we just return a reference to it
78  const auto name = univ.getName();
79  if (_universe_list.hasUniverse(name))
80  return _universe_list.getUniverse(name);
81 
82  // Otherwise we create a new universe based on its associated cells.
83  // addCellToList is called recursively in case associated cells have not
84  // been added to the cell list yet.
85  const auto univ_cells = univ.getAllCells();
86  std::vector<std::reference_wrapper<const CSGCell>> current_univ_cells;
87  for (const auto & univ_cell : univ_cells)
88  current_univ_cells.push_back(addCellToList(univ_cell));
89  return createUniverse(name, current_univ_cells);
90 }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
const std::vector< std::reference_wrapper< const CSGCell > > & getAllCells() const
Get list of the all cells in the universe.
Definition: CSGUniverse.h:72
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:48
const CSGUniverse & createUniverse(const std::string &name)
Create an empty Universe object.
Definition: CSGBase.h:208

◆ checkCellInBase()

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

Definition at line 342 of file CSGBase.C.

Referenced by addCellToUniverse(), removeCellFromUniverse(), and updateCellRegion().

343 {
344  auto name = cell.getName();
345  // if no cell by this name exists, an error will be produced by getCell
346  auto & list_cell = _cell_list.getCell(name);
347  // return whether that the cell in the list is the same as the cell provided (in memory)
348  return &cell == &list_cell;
349 }
std::string name(const ElemQuality q)
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:28
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470

◆ checkRegionSurfaces()

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

Definition at line 325 of file CSGBase.C.

Referenced by createCell(), and updateCellRegion().

326 {
327  auto & surfs = region.getSurfaces();
328  for (const CSGSurface & s : surfs)
329  {
330  auto sname = s.getName();
331  // if there is no surface by this name at all, there will be an error from getSurface
332  const auto & list_surf = _surface_list.getSurface(s.getName());
333  // if there is a surface by the same name, check that it is actually the surface being used
334  // (ie same surface points to same location in memory)
335  if (&s != &list_surf)
336  mooseError("Region is being set with a surface named " + sname +
337  " that is different from the surface of the same name in the CSGBase instance.");
338  }
339 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
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:467

◆ checkUniverseInBase()

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

Definition at line 352 of file CSGBase.C.

Referenced by addCellToUniverse(), and removeCellFromUniverse().

353 {
354  auto name = universe.getName();
355  // if no universe by this name exists, an error will be produced by getUniverse
356  auto & list_univ = _universe_list.getUniverse(name);
357  // return whether that the cell in the list is the same as the cell provided (in memory)
358  return &universe == &list_univ;
359 }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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 362 of file CSGBase.C.

Referenced by generateOutput().

363 {
364  std::vector<std::string> linked_universe_names;
365 
366  // Recursively figure out which universe names are linked to root universe
367  getLinkedUniverses(getRootUniverse(), linked_universe_names);
368 
369  // Iterate through all universes in universe list and check that they exist in universes linked
370  // to root universe list
371  for (const CSGUniverse & univ : getAllUniverses())
372  if (std::find(linked_universe_names.begin(), linked_universe_names.end(), univ.getName()) ==
373  linked_universe_names.end())
374  mooseWarning("Universe with name ", univ.getName(), " is not linked to root universe.");
375 }
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:42
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all universe objects.
Definition: CSGBase.h:262
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
Definition: MooseError.h:357
void getLinkedUniverses(const CSGUniverse &univ, std::vector< std::string > &linked_universe_names) const
Recursive method to retrieve all universes linked to current universe.
Definition: CSGBase.C:378
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179

◆ clone()

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

Create a deep copy of this CSGBase instance.

Definition at line 48 of file CSGBase.h.

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

◆ createCell() [1/3]

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 93 of file CSGBase.C.

97 {
98  checkRegionSurfaces(region);
99  auto & cell = _cell_list.addMaterialCell(name, mat_name, region);
100  if (add_to_univ)
101  addCellToUniverse(*add_to_univ, cell);
102  else
104  return cell;
105 }
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:43
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:325
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:162

◆ createCell() [2/3]

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 108 of file CSGBase.C.

111 {
112  checkRegionSurfaces(region);
113  auto & cell = _cell_list.addVoidCell(name, region);
114  if (add_to_univ)
115  addCellToUniverse(*add_to_univ, cell);
116  else
118  return cell;
119 }
CSGCell & addVoidCell(const std::string &name, const CSGRegion &region)
Add a Void Cell object cell list.
Definition: CSGCellList.C:37
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:325
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:162

◆ createCell() [3/3]

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 122 of file CSGBase.C.

126 {
127  checkRegionSurfaces(region);
128  if (add_to_univ && (&fill_univ == add_to_univ))
129  mooseError("Cell " + name +
130  " cannot be filled with the same universe to which it is being added.");
131 
132  auto & cell = _cell_list.addUniverseCell(name, fill_univ, region);
133  if (add_to_univ)
134  addCellToUniverse(*add_to_univ, cell);
135  else
137  return cell;
138 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion &region)
Add a Universe Cell object to cell list.
Definition: CSGCellList.C:51
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:325
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
Definition: CSGBase.C:162

◆ 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 208 of file CSGBase.h.

Referenced by addUniverseToList(), and joinUniverseList().

209  {
210  return _universe_list.addUniverse(name);
211  }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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 153 of file CSGBase.C.

155 {
156  auto & univ = _universe_list.addUniverse(name);
157  addCellsToUniverse(univ, cells); // performs a check that cells are a part of this base
158  return univ;
159 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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:179
CSGUniverse & addUniverse(const std::string &name)
create an empty universe

◆ 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

Definition at line 389 of file CSGBase.C.

390 {
391  // Check that orphaned universes do not exist in universe list of CSGBase object
393 
394  nlohmann::json csg_json;
395 
396  csg_json["surfaces"] = {};
397  csg_json["cells"] = {};
398  csg_json["universes"] = {};
399 
400  // get all surfaces information
401  auto all_surfs = getAllSurfaces();
402  for (const CSGSurface & s : all_surfs)
403  {
404  const auto & surf_name = s.getName();
405  const auto & coeffs = s.getCoeffs();
406  csg_json["surfaces"][surf_name] = {{"type", s.getSurfaceType()}, {"coefficients", {}}};
407  for (const auto & c : coeffs)
408  csg_json["surfaces"][surf_name]["coefficients"][c.first] = c.second;
409  }
410 
411  // Print out cell information
412  auto all_cells = getAllCells();
413  for (const CSGCell & c : all_cells)
414  {
415  const auto & cell_name = c.getName();
416  const auto & cell_region = c.getRegionAsString();
417  const auto & cell_filltype = c.getFillType();
418  const auto & fill_name = c.getFillName();
419  csg_json["cells"][cell_name]["filltype"] = cell_filltype;
420  csg_json["cells"][cell_name]["region"] = cell_region;
421  csg_json["cells"][cell_name]["fill"] = fill_name;
422  }
423 
424  // Print out universe information
425  auto all_univs = getAllUniverses();
426  for (const CSGUniverse & u : all_univs)
427  {
428  const auto & univ_name = u.getName();
429  const auto & univ_cells = u.getAllCells();
430  csg_json["universes"][univ_name]["cells"] = {};
431  for (const CSGCell & c : univ_cells)
432  csg_json["universes"][univ_name]["cells"].push_back(c.getName());
433  if (u.isRoot())
434  csg_json["universes"][univ_name]["root"] = u.isRoot();
435  }
436 
437  return csg_json;
438 }
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all universe objects.
Definition: CSGBase.h:262
void checkUniverseLinking() const
Check universes linked to root universe match universes defined in _universe_list.
Definition: CSGBase.C:362
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all cell objects.
Definition: CSGBase.h:142
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get all surface objects.
Definition: CSGBase.h:67

◆ 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 142 of file CSGBase.h.

Referenced by generateOutput().

143  {
144  return _cell_list.getAllCells();
145  }
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
Definition: CSGCellList.C:59
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470

◆ 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 67 of file CSGBase.h.

Referenced by generateOutput().

68  {
70  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
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 262 of file CSGBase.h.

Referenced by checkUniverseLinking(), and generateOutput().

263  {
265  }
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:473

◆ 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 153 of file CSGBase.h.

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

◆ getCellList() [1/2]

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

Get a const reference to the CSGCellList object.

Returns
CSGCellList

Definition at line 370 of file CSGBase.h.

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

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

◆ getCellList() [2/2]

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

Get a non-const reference to the CSGCellList object.

Returns
CSGCellList

Definition at line 377 of file CSGBase.h.

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

◆ getLinkedUniverses()

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

Recursive method to retrieve all universes linked to current universe.

Parameters
univReference to universe under consideration
linked_universe_nameList of universe names linked to current universe

Definition at line 378 of file CSGBase.C.

Referenced by checkUniverseLinking().

380 {
381  linked_universe_names.push_back(univ.getName());
382  const auto & univ_cells = univ.getAllCells();
383  for (const CSGCell & cell : univ_cells)
384  if (cell.getFillType() == "UNIVERSE")
385  getLinkedUniverses(cell.getFillUniverse(), linked_universe_names);
386 }
void getLinkedUniverses(const CSGUniverse &univ, std::vector< std::string > &linked_universe_names) const
Recursive method to retrieve all universes linked to current universe.
Definition: CSGBase.C:378

◆ getRootUniverse()

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

Get the Root Universe object.

Returns
reference to root CSGUniverse

Definition at line 179 of file CSGBase.h.

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

179 { return _universe_list.getRoot(); }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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 337 of file CSGBase.h.

337 { 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:467

◆ 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 78 of file CSGBase.h.

79  {
80  return _surface_list.getSurface(name);
81  }
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:467

◆ getSurfaceList() [1/2]

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

Get a const reference to the CSGSurfaceList object.

Returns
CSGSurfaceList

Definition at line 356 of file CSGBase.h.

Referenced by operator==().

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

◆ getSurfaceList() [2/2]

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

Get a non-const reference to the CSGSurfaceList object.

Returns
CSGSurfaceList

Definition at line 363 of file CSGBase.h.

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

◆ 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 273 of file CSGBase.h.

274  {
275  return _universe_list.getUniverse(name);
276  }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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 384 of file CSGBase.h.

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

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

◆ getUniverseList() [2/2]

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

Get a non-const reference to the CSGUniverseList object.

Returns
CSGUniverseList

Definition at line 391 of file CSGBase.h.

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

◆ joinCellList()

void CSG::CSGBase::joinCellList ( CSGCellList cell_list)
private

join a separate CSGCellList object to this one

Parameters
cell_listCSGCellList from a separate CSGBase object

Definition at line 249 of file CSGBase.C.

Referenced by joinOtherBase().

250 {
251  auto & cell_list_map = cell_list.getCellListMap();
252  for (auto & c : cell_list_map)
253  _cell_list.addCell(std::move(c.second));
254 }
CSGCell & addCell(std::unique_ptr< CSGCell > cell)
add a cell to the CellList.
Definition: CSGCellList.C:18
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470

◆ joinOtherBase() [1/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base)

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

Definition at line 212 of file CSGBase.C.

213 {
214  joinSurfaceList(base->getSurfaceList());
215  joinCellList(base->getCellList());
216  joinUniverseList(base->getUniverseList());
217 }
void joinCellList(CSGCellList &cell_list)
join a separate CSGCellList object to this one
Definition: CSGBase.C:249
void joinUniverseList(CSGUniverseList &univ_list)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:257
void joinSurfaceList(CSGSurfaceList &surf_list)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:238

◆ joinOtherBase() [2/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base,
std::string &  new_root_name_join 
)

Join another CSGBase object to this one.

For the incoming CSGBase object, the root universe is added to this CSGBase object as a new non-root universe with the specified new name. Note: this newly created universe will not be connected to the root universe of this CSGBase object by default.

Parameters
basepointer to a different CSGBase object
new_root_name_joinnew name for the universe generated from the incoming root universe

Definition at line 220 of file CSGBase.C.

221 {
222  joinSurfaceList(base->getSurfaceList());
223  joinCellList(base->getCellList());
224  joinUniverseList(base->getUniverseList(), new_root_name_join);
225 }
void joinCellList(CSGCellList &cell_list)
join a separate CSGCellList object to this one
Definition: CSGBase.C:249
void joinUniverseList(CSGUniverseList &univ_list)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:257
void joinSurfaceList(CSGSurfaceList &surf_list)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:238

◆ joinOtherBase() [3/3]

void CSG::CSGBase::joinOtherBase ( std::unique_ptr< CSGBase base,
const std::string &  new_root_name_base,
const std::string &  new_root_name_join 
)

Join another CSGBase object to this one.

The root universe for the incoming CSGBase object is added to this CSGBase object as a non-root universe with a new name. The root universe of this CSGBase object will be renamed and designated as non-root. Note: upon completion of this join method, the root universe of this CSGBase object will be empty. Neither of the new non-root universes will be connected to the new root universe by default.

Parameters
basepointer to a different 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 228 of file CSGBase.C.

231 {
232  joinSurfaceList(base->getSurfaceList());
233  joinCellList(base->getCellList());
234  joinUniverseList(base->getUniverseList(), new_root_name_base, new_root_name_join);
235 }
void joinCellList(CSGCellList &cell_list)
join a separate CSGCellList object to this one
Definition: CSGBase.C:249
void joinUniverseList(CSGUniverseList &univ_list)
join a separate CSGUniverseList object to this one; root universes from univ_list will be combined in...
Definition: CSGBase.C:257
void joinSurfaceList(CSGSurfaceList &surf_list)
join a separate CSGSurfaceList object to this one
Definition: CSGBase.C:238

◆ joinSurfaceList()

void CSG::CSGBase::joinSurfaceList ( CSGSurfaceList surf_list)
private

join a separate CSGSurfaceList object to this one

Parameters
surf_listCSGSurfaceList from a separate CSGBase object

Definition at line 238 of file CSGBase.C.

Referenced by joinOtherBase().

239 {
240  // TODO: check if surface is a duplicate (by definition) and skip
241  // adding if duplicate; must update references to the surface in cell
242  // region definitions.
243  auto & surf_list_map = surf_list.getSurfaceListMap();
244  for (auto & s : surf_list_map)
245  _surface_list.addSurface(std::move(s.second));
246 }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf)
add a surface object to existing SurfaceList.

◆ joinUniverseList() [1/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list)
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

Definition at line 257 of file CSGBase.C.

Referenced by joinOtherBase().

258 {
259  // case 1: incoming root is joined into existing root; no new universes are created
260  auto & univ_list_map = univ_list.getUniverseListMap();
261  auto & root = getRootUniverse(); // this root universe
262  for (auto & u : univ_list_map)
263  {
264  if (u.second->isRoot())
265  {
266  // add existing cells to current root instead of creating new universe
267  auto all_cells = u.second->getAllCells();
268  for (auto & cell : all_cells)
269  addCellToUniverse(root, cell);
270  }
271  else // unique non-root universe to add to list
272  _universe_list.addUniverse(std::move(u.second));
273  }
274 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
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:162

◆ joinUniverseList() [2/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list,
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
new_root_name_incomingnew name for the universe generated from the incoming root universe

Definition at line 277 of file CSGBase.C.

278 {
279  // case 2: incoming root is turned into new universe and existing root remains root
280 
281  // add incoming universes to current Base
282  auto & all_univs = univ_list.getUniverseListMap();
283  for (auto & u : all_univs)
284  {
285  if (u.second->isRoot())
286  {
287  // create new universe from incoming root universe
288  auto all_cells = u.second->getAllCells();
289  createUniverse(new_root_name_incoming, all_cells);
290  }
291  else // unique non-root universe to add to list
292  _universe_list.addUniverse(std::move(u.second));
293  }
294 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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:208

◆ joinUniverseList() [3/3]

void CSG::CSGBase::joinUniverseList ( CSGUniverseList univ_list,
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
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 297 of file CSGBase.C.

300 {
301  // case 3: each root universe becomes a new universe and a new root is created
302 
303  // make a new universe from the existing root universe
304  auto & root = getRootUniverse();
305  auto root_cells = root.getAllCells();
306  createUniverse(new_root_name_base, root_cells);
307  removeCellsFromUniverse(root, root_cells);
308 
309  // add incoming universes to current Base
310  auto & all_univs = univ_list.getUniverseListMap();
311  for (auto & u : all_univs)
312  {
313  if (u.second->isRoot())
314  {
315  // create new universe from incoming root universe
316  auto all_cells = u.second->getAllCells();
317  createUniverse(new_root_name_incoming, all_cells);
318  }
319  else // unique non-root universe to add to list
320  _universe_list.addUniverse(std::move(u.second));
321  }
322 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
Definition: CSGBase.h:179
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:204
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:208

◆ operator!=()

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

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

Definition at line 454 of file CSGBase.C.

455 {
456  return !(*this == other);
457 }

◆ operator==()

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

Operator overload for checking if two CSGBase objects are equal.

Definition at line 441 of file CSGBase.C.

442 {
443  const auto & surf_list = this->getSurfaceList();
444  const auto & other_surf_list = other.getSurfaceList();
445  const auto & cell_list = this->getCellList();
446  const auto & other_cell_list = other.getCellList();
447  const auto & univ_list = this->getUniverseList();
448  const auto & other_univ_list = other.getUniverseList();
449  return (surf_list == other_surf_list) && (cell_list == other_cell_list) &&
450  (univ_list == other_univ_list);
451 }
const CSGSurfaceList & getSurfaceList() const
Get a const reference to the CSGSurfaceList object.
Definition: CSGBase.h:356
const CSGCellList & getCellList() const
Get a const reference to the CSGCellList object.
Definition: CSGBase.h:370
const CSGUniverseList & getUniverseList() const
Get a const reference to the CSGUniverseList object.
Definition: CSGBase.h:384

◆ 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 187 of file CSGBase.C.

Referenced by removeCellsFromUniverse().

188 {
189  // make sure cell is a part of this CSGBase instance
190  if (!checkCellInBase(cell))
191  mooseError("A cell named " + cell.getName() + " is being removed from universe " +
192  universe.getName() +
193  " that is different from the cell of the same name in the CSGBase instance.");
194  // make sure universe is a part of this CSGBase instance
195  if (!checkUniverseInBase(universe))
196  mooseError("Cells are being removed from a universe named " + universe.getName() +
197  " that is different " +
198  "from the universe of the same name in the CSGBase instance.");
199  auto & univ = _universe_list.getUniverse(universe.getName());
200  univ.removeCell(cell.getName());
201 }
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
void removeCell(const std::string &name)
remove a cell of the specified name from the universe
Definition: CSGUniverse.C:56
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:352
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:342

◆ 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 204 of file CSGBase.C.

Referenced by joinUniverseList().

206 {
207  for (auto & c : cells)
208  removeCellFromUniverse(universe, c);
209 }
void removeCellFromUniverse(const CSGUniverse &universe, const CSGCell &cell)
Remove a cell from an existing universe.
Definition: CSGBase.C:187

◆ 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 161 of file CSGBase.h.

162  {
163  _cell_list.renameCell(cell, name);
164  }
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
void renameCell(const CSGCell &cell, const std::string &name)
rename the specified cell
Definition: CSGCellList.C:68

◆ 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 186 of file CSGBase.h.

187  {
189  }
std::string name(const ElemQuality q)
CSGUniverseList _universe_list
List of universes associated with CSG object.
Definition: CSGBase.h:473
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 89 of file CSGBase.h.

90  {
91  _surface_list.renameSurface(surface, name);
92  }
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
Definition: CSGBase.h:467
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 197 of file CSGBase.h.

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

◆ 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 141 of file CSGBase.C.

142 {
143  checkRegionSurfaces(region);
144  if (!checkCellInBase(cell))
145  mooseError("The region of cell with name " + cell.getName() +
146  " is being updated that is different " +
147  "from the cell of the same name in the CSGBase instance.");
148  auto & list_cell = _cell_list.getCell(cell.getName());
149  list_cell.updateRegion(region);
150 }
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
Definition: CSGCellList.C:28
void updateRegion(const CSGRegion &region)
Definition: CSGCell.h:123
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
void checkRegionSurfaces(const CSGRegion &region) const
Definition: CSGBase.C:325
CSGCellList _cell_list
List of cells associated with CSG object.
Definition: CSGBase.h:470
bool checkCellInBase(const CSGCell &cell) const
Definition: CSGBase.C:342

Member Data Documentation

◆ _cell_list

CSGCellList CSG::CSGBase::_cell_list
private

List of cells associated with CSG object.

Definition at line 470 of file CSGBase.h.

Referenced by addCellToList(), checkCellInBase(), createCell(), CSGBase(), getAllCells(), getCellByName(), getCellList(), joinCellList(), renameCell(), and updateCellRegion().

◆ _surface_list

CSGSurfaceList CSG::CSGBase::_surface_list
private

List of surfaces associated with CSG object.

Definition at line 467 of file CSGBase.h.

Referenced by addSurface(), checkRegionSurfaces(), getAllSurfaces(), getSurface(), getSurfaceByName(), getSurfaceList(), joinSurfaceList(), and renameSurface().

◆ _universe_list

CSGUniverseList CSG::CSGBase::_universe_list
private

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