26 : _surface_list(other_base.getSurfaceList()),
64 " cannot be deleted as it is different from the surface of the same name in the " 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)
77 " as it is used in region definition of cell with name ",
95 if (fill_type ==
"VOID")
97 else if (fill_type ==
"CSG_MATERIAL")
102 else if (fill_type ==
"LATTICE")
110 else if (fill_type ==
"UNIVERSE")
116 mooseError(
"Cell " +
name +
" has unrecognized fill type " + fill_type);
131 std::vector<std::reference_wrapper<const CSGCell>> current_univ_cells;
132 for (
const auto & univ_cell : univ_cells)
146 auto cloned_lattice = lattice.
clone();
151 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> current_univ_map;
154 std::vector<std::reference_wrapper<const CSGUniverse>> current_univ_list;
155 for (
const auto & univ_ref : univ_list)
157 current_univ_map.push_back(current_univ_list);
161 if (current_univ_map.size() > 0)
162 cloned_lattice->setUniverses(current_univ_map);
168 cloned_lattice->updateOuter(outer_univ_ref);
181 " cannot be deleted as it is different from the lattice of the same name in the " 182 "CSGBase instance.");
187 const auto & cell = cell_ref.get();
188 if ((cell.getFillType() ==
"LATTICE") && (cell.getFillLattice() == lattice))
189 mooseError(
"Cannot delete lattice with name ",
191 " as it is used as the fill of cell with name ",
200 const std::string & mat_name,
234 if (add_to_univ && (&fill_univ == add_to_univ))
236 " cannot be filled with the same universe to which it is being added.");
257 for (
const auto & univ_ref : univ_list)
259 const CSGUniverse & univ_in_lattice = univ_ref.get();
260 if (&univ_in_lattice == add_to_univ)
262 " cannot be filled with a lattice containing the same universe to which it is " 280 " cannot be deleted as it is different from the cell of the same name in the " 281 "CSGBase instance.");
286 const auto & univ = univ_ref.get();
287 const auto & univ_cells = univ.getAllCells();
288 for (
const auto & univ_cell : univ_cells)
293 " from universe with name ",
295 " before cell deletion.");
310 " that is being updated is different " +
311 "from the cell of the same name in the CSGBase instance.");
321 " that is being updated is different " +
322 "from the cell of the same name in the CSGBase instance.");
332 " that is being updated is different " +
333 "from the cell of the same name in the CSGBase instance.");
344 " is being used as a cell fill that is different from the universe of the same name " 345 "in the CSGBase instance.");
348 " that is being updated is different " +
349 "from the cell of the same name in the CSGBase instance.");
360 " is being used as a cell fill that is different from the lattice of the same name " 361 "in the CSGBase instance.");
364 " that is being updated is different " +
365 "from the cell of the same name in the CSGBase instance.");
372 std::vector<std::reference_wrapper<const CSGCell>> & cells)
385 " cannot be deleted as it is different from the universe of the same name in the " 386 "CSGBase instance.");
390 mooseError(
"Cannot delete root universe from CSGBase instance");
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 ",
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 ",
405 " as it is used as the outer universe of lattice with name ",
406 lat.get().getName());
412 const auto & cell = cell_ref.get();
413 if ((cell.getFillType() ==
"UNIVERSE") && (cell.getFillUniverse() == univ))
414 mooseError(
"Cannot delete universe with name ",
416 " as it is used as the fill of cell with name ",
430 " that is different from the cell of the same name in the CSGBase instance.");
434 " that is different " +
435 "from the universe of the same name in the CSGBase instance.");
442 std::vector<std::reference_wrapper<const CSGCell>> & cells)
444 for (
auto & c : cells)
453 mooseError(
"A cell named " + cell.
getName() +
" is being removed from universe " +
455 " that is different from the cell of the same name in the CSGBase instance.");
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.");
467 std::vector<std::reference_wrapper<const CSGCell>> & cells)
469 for (
auto & c : cells)
479 ". Lattice is different from the lattice of the same name in the " 480 "CSGBase instance.");
490 ". Lattice is different from the lattice of the same name in the " 491 "CSGBase instance.");
493 mooseError(
"Cannot set outer universe for lattice " +
name +
". Outer universe " +
494 outer_univ.
getName() +
" is not in the CSGBase instance.");
504 ". Lattice is different from the lattice of the same name in the " 505 "CSGBase instance.");
512 std::pair<int, int> index)
517 ". Lattice is different from the lattice of the same name in the " 518 "CSGBase instance.");
521 ". Universe is not in the CSGBase instance.");
528 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> & universes)
533 ". Lattice is different from the lattice of the same name in the " 534 "CSGBase instance.");
536 for (
auto univ_list : universes)
539 mooseError(
"Cannot set universes for lattice " +
name +
". Universe " + univ.getName() +
540 " is not in the CSGBase instance.");
547 const std::tuple<Real, Real, Real> & values)
551 [&](
const auto & obj)
553 using T = std::decay_t<decltype(obj.get())>;
557 if constexpr (std::is_same_v<T, CSGCell>)
559 const CSGCell & cell = obj.get();
561 mooseError(
"Cannot apply transformation to cell ",
563 " that is not in this CSGBase instance.");
567 mooseAssert(mutable_cell == cell,
"Mutable cell does not match const cell passed in.");
568 mutable_cell.addTransformation(type, values);
570 else if constexpr (std::is_same_v<T, CSGSurface>)
574 mooseError(
"Cannot apply transformation to surface ",
576 " that is not in this CSGBase instance.");
580 mooseAssert(mutable_surface == surface,
581 "Mutable surface does not match const surface passed in.");
582 mutable_surface.addTransformation(type, values);
584 else if constexpr (std::is_same_v<T, CSGUniverse>)
588 mooseError(
"Cannot apply transformation to universe ",
590 " that is not in this CSGBase instance.");
594 mooseAssert(mutable_universe == universe,
595 "Mutable universe does not match const universe passed in.");
596 mutable_universe.addTransformation(type, values);
598 else if constexpr (std::is_same_v<T, CSGLattice>)
602 mooseError(
"Cannot apply transformation to lattice ",
604 " that is not in this CSGBase instance.");
608 mooseAssert(mutable_lattice == lattice,
609 "Mutable lattice does not match const lattice passed in.");
610 mutable_lattice.addTransformation(type, values);
612 else if constexpr (std::is_same_v<T, CSGRegion>)
620 mooseError(
"Cannot apply transformation to region with surface ",
622 " that is not in this CSGBase instance.");
627 mooseError(
"Transformation not implemented for this object type: ",
typeid(T).
name());
656 mooseError(
"Invalid axis type provided for axis rotation.");
667 if (ignore_identical_components)
670 joinCellList(base->getCellList(), ignore_identical_components);
677 const bool ignore_identical_components,
678 const std::string & new_root_name_join)
682 if (ignore_identical_components)
685 joinCellList(base->getCellList(), ignore_identical_components);
687 joinUniverseList(base->getUniverseList(), ignore_identical_components, new_root_name_join);
692 const bool ignore_identical_components,
693 const std::string & new_root_name_base,
694 const std::string & new_root_name_join)
698 if (ignore_identical_components)
701 joinCellList(base->getCellList(), ignore_identical_components);
704 base->getUniverseList(), ignore_identical_components, new_root_name_base, new_root_name_join);
712 std::map<std::string, std::reference_wrapper<const CSGSurface>> identical_surface_refs;
714 for (
const auto & [surf_name, surf_ptr] : surf_list_map)
720 std::map<std::string, std::reference_wrapper<const CSGCell>> identical_cell_refs;
722 for (
const auto & [cell_name, cell_ptr] : cell_list_map)
724 identical_cell_refs.insert({cell_name,
getCellByName(cell_name)});
728 std::map<std::string, std::reference_wrapper<const CSGUniverse>> identical_universe_refs;
730 for (
const auto & [univ_name, univ_ptr] : universe_list_map)
736 std::map<std::string, std::reference_wrapper<const CSGLattice>> identical_lattice_refs;
738 for (
const auto & [lat_name, lat_ptr] : lattice_list_map)
744 if (!identical_surface_refs.empty())
747 if (!identical_cell_refs.empty())
750 if (!identical_universe_refs.empty())
753 if (!identical_lattice_refs.empty())
759 std::map<std::string, std::reference_wrapper<const CSGSurface>> & identical_surface_refs,
764 cell_ptr->updateCellRegionSurfaces(identical_surface_refs);
769 std::map<std::string, std::reference_wrapper<const CSGCell>> & identical_cell_refs,
774 for (
auto & [cell_name, cell_ref] : identical_cell_refs)
775 if (univ_ptr->hasCell(cell_name))
777 univ_ptr->removeCell(cell_name);
778 univ_ptr->addCell(cell_ref);
784 std::map<std::string, std::reference_wrapper<const CSGUniverse>> & identical_universe_refs,
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()))
795 const CSGUniverse * univ_ptr = &identical_universe_refs.at(fill_name).get();
796 cell_ptr->updateCellFill(univ_ptr);
802 for (
auto & [univ_name, univ_ref] : identical_universe_refs)
805 if (lat_ptr->hasUniverse(univ_name))
808 const auto univ_indices = lat_ptr->getUniverseIndices(univ_name);
809 for (
const auto & index : univ_indices)
810 lat_ptr->setUniverseAtIndex(univ_ref, index);
813 if ((lat_ptr->getOuterType() ==
"UNIVERSE") &&
814 (lat_ptr->getOuterUniverse().getName() == univ_name))
815 lat_ptr->updateOuter(univ_ref);
821 std::map<std::string, std::reference_wrapper<const CSGLattice>> & identical_lattice_refs,
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()))
832 const CSGLattice * lat_ptr = &identical_lattice_refs.at(fill_name).get();
833 cell_ptr->updateCellFill(lat_ptr);
842 for (
auto & s : surf_list_map)
850 for (
auto & c : cell_list_map)
858 for (
auto & lat : lat_list_map)
868 for (
auto & u : univ_list_map)
870 if (u.second->isRoot())
873 auto all_cells = u.second->getAllCells();
874 for (
auto & cell : all_cells)
884 const bool ignore_identical_universes,
885 const std::string & new_root_name_incoming)
891 for (
auto & u : all_univs)
893 if (u.second->isRoot())
896 auto all_cells = u.second->getAllCells();
906 const bool ignore_identical_universes,
907 const std::string & new_root_name_base,
908 const std::string & new_root_name_incoming)
914 auto root_cells = root.getAllCells();
920 for (
auto & u : all_univs)
922 if (u.second->isRoot())
925 auto all_cells = u.second->getAllCells();
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.");
952 return &surface == &list_surf;
962 return &cell == &list_cell;
972 return &universe == &list_univ;
982 return &lattice == &list_lattice;
988 std::vector<std::string> linked_universe_names;
989 std::vector<std::string> linked_cell_names;
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.");
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.");
1011 std::vector<std::string> & linked_universe_names,
1012 std::vector<std::string> & linked_cell_names)
const 1014 linked_universe_names.push_back(univ.
getName());
1016 for (
const CSGCell & cell : univ_cells)
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")
1023 const auto & lattice = cell.getFillLattice();
1024 for (
const auto & univ_list : lattice.getUniverses())
1025 for (
const auto & univ_ref : univ_list)
1027 const CSGUniverse & lattice_univ = univ_ref.get();
1031 if (lattice.getOuterType() ==
"UNIVERSE")
1033 const CSGUniverse & outer_univ = lattice.getOuterUniverse();
1046 nlohmann::json csg_json;
1048 csg_json[
"surfaces"] = {};
1049 csg_json[
"cells"] = {};
1050 csg_json[
"universes"] = {};
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;
1062 if (s.getTransformations().size() > 0)
1063 csg_json[
"surfaces"][surf_name][
"transformations"] = s.getTransformationsAsStrings();
1068 for (
const CSGCell & c : all_cells)
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;
1080 if (c.getTransformations().size())
1081 csg_json[
"cells"][cell_name][
"transformations"] = c.getTransformationsAsStrings();
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());
1094 csg_json[
"universes"][univ_name][
"root"] = u.isRoot();
1096 if (u.getTransformations().size())
1097 csg_json[
"universes"][univ_name][
"transformations"] = u.getTransformationsAsStrings();
1102 if (all_lats.size())
1104 csg_json[
"lattices"] = {};
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();
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;
1122 csg_json[
"lattices"][lat_name][
"universes"] = lat.getUniverseNameMap();
1124 if (lat.getTransformations().size())
1125 csg_json[
"lattices"][lat_name][
"transformations"] = lat.getTransformationsAsStrings();
1138 const auto & other_cell_list = other.
getCellList();
1143 return (surf_list == other_surf_list) && (cell_list == other_cell_list) &&
1144 (univ_list == other_univ_list) && (lat_list == other_lat_list);
1150 return !(*
this == other);
std::string name(const ElemQuality q)
void updateIncomingCSGReferences(CSGBase &incoming_base)
update references of incoming CSGbase to point to those of existing CSGBase object.
const std::string & getName() const
Get the name of surface.
bool hasUniverse(const std::string &name) const
Check if a universe with given name exists in CSGBase object.
const CSGLattice & getFillLattice() const
Get the cell fill if fill type is LATTICE.
bool checkLatticeInBase(const CSGLattice &lattice) const
void setUniverseAtLatticeIndex(const CSGLattice &lattice, const CSGUniverse &universe, std::pair< int, int > index)
set location in the lattice to be the provided universe
CSGLattice & addLattice(std::unique_ptr< CSGLattice > lattice, const bool ignore_identical_lattice=false)
add an existing lattice to list.
KOKKOS_INLINE_FUNCTION const T * find(const T &target, const T *const begin, const T *const end)
Find a value in an array.
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
CSGCell & getCell(const std::string &name) const
Get the CSGCell by name.
const std::string & getName() const
Get the cell name.
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all the universes in CSGBase instance.
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all universe objects.
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 ...
CSGUniverseList _universe_list
List of universes associated with CSG object.
const std::string getFillType() const
Get the type of fill for the cell.
void updateRegion(const CSGRegion ®ion)
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
CSGCellList creates a container for CSGCell objects to pass to CSGBase object.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
std::unordered_map< std::string, std::unique_ptr< CSGCell > > & getCellListMap()
Get non-const map of all names to cells in cell list.
void mooseWarning(Args &&... args)
Emit a warning message with the given stringified, concatenated args.
const CSGLatticeList & getLatticeList() const
Get a const reference to the CSGLatticeList object.
const CSGCell & createCell(const std::string &name, const std::string &mat_name, const CSGRegion ®ion, const CSGUniverse *add_to_univ=nullptr)
Create a Material Cell object.
void setLatticeOuter(const CSGLattice &lattice, const std::string &outer_name)
Set the outer fill for the lattice to the material name provided.
const CSGUniverse & getOuterUniverse() const
Get the outer universe if outer type is UNIVERSE.
void joinSurfaceList(CSGSurfaceList &surf_list, const bool ignore_identical_surfaces)
join a separate CSGSurfaceList object to this one
void deleteLattice(const CSGLattice &lattice)
Remove a Lattice object passed in by reference from the stored lattice list.
void setUniverseAtIndex(const CSGUniverse &universe, const std::pair< int, int > index)
replace the element at specified index in the lattice with the provided CSGUniverse.
const CSGSurface & getSurfaceByName(const std::string &name) const
Get a Surface object by name.
CSGCell & addVoidCell(const std::string &name, const CSGRegion ®ion)
Add a Void Cell object cell list.
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all the cells in CSGBase instance.
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all lattice objects.
bool operator==(const CSGBase &other) const
Operator overload for checking if two CSGBase objects are equal.
const std::vector< std::reference_wrapper< const CSGCell > > & getAllCells() const
Get list of the all cells in the universe.
std::vector< std::reference_wrapper< const CSGLattice > > getAllLattices() const
Get all the lattices in CSGBase instance.
const std::string & getName() const
Get the name of lattice.
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
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).
CSGSurfaceList _surface_list
List of surfaces associated with CSG object.
TransformationType
Enumeration of transformation types that can be applied to CSG objects.
void addTransformation(const CSGObjectVariant &csg_object, TransformationType type, const std::tuple< Real, Real, Real > &values)
Apply a transformation to a CSG object.
void resetCellFill()
Reset the cell fill to void.
nlohmann::json generateOutput() const
generate the JSON representation output for the CSG object
CSGLatticeList creates a container for CSGLattice objects to pass to CSGBase.
void updateCellFill(const CSGCell &cell, const std::string &mat_name)
change the fill of the specified cell to a material fill
std::vector< std::reference_wrapper< const CSGSurface > > getSurfaces() const
Get the list of surfaces associated with the region.
CSGCell & addMaterialCell(const std::string &name, const std::string &mat_name, const CSGRegion ®ion)
Add a Material Cell object to cell list.
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.
void joinLatticeList(CSGLatticeList &lattice_list, const bool ignore_identical_lattices)
join a separate CSGLatticeList object to this one
void removeCell(const std::string &name)
remove a cell of the specified name from the universe
CSGCell & addUniverseCell(const std::string &name, const CSGUniverse &univ, const CSGRegion ®ion)
Add a Universe Cell object to cell list.
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
CSGLattice is the abstract class for defining lattices.
bool hasLattice(const std::string &name) const
return whether lattice with given name exists in lattice list
const std::string & getName() const
Get the name of the universe.
void addCellsToUniverse(const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells)
Add a list of cells to an existing universe.
const CSGUniverse & getRootUniverse() const
Get the Root Universe object.
void updateCellRegion(const CSGCell &cell, const CSGRegion ®ion)
change the region of the specified cell
CSGUniverseList creates a container for CSGUniverse objects to pass to CSGBase.
std::unordered_map< std::string, std::unique_ptr< CSGLattice > > & getLatticeListMap()
Get map of all names to lattices in lattice list.
void resetOuter()
reset the outer fill around the lattice elements to be VOID
void joinOtherBase(std::unique_ptr< CSGBase > base, const bool ignore_identical_components)
Join another CSGBase object to this one.
CSGCell & addLatticeCell(const std::string &name, const CSGLattice &lattice, const CSGRegion ®ion)
Add a Lattice Cell object to cell list.
void joinCellList(CSGCellList &cell_list, const bool ignore_identical_cells)
join a separate CSGCellList object to this one
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...
const CSGUniverse & addUniverseToList(const CSGUniverse &univ)
Add a new universe to the universe list based on a universe reference.
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf, const bool ignore_identical_surface=false)
add a surface object to existing SurfaceList.
CSGCell & addCell(std::unique_ptr< CSGCell > cell, const bool ignore_identical_cell=false)
add a cell to the CellList.
void removeCellsFromUniverse(const CSGUniverse &universe, std::vector< std::reference_wrapper< const CSGCell >> &cells)
Remove a list of cells from an existing universe.
void setLatticeUniverses(const CSGLattice &lattice, std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> &universes)
Set provided universes as the layout of the lattice.
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...
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...
bool hasSurface(const std::string &name) const
Check if a surface with given name exists in CSGBase object.
void updateOuter(const std::string &outer_name)
Update the outer of the lattice to be the provided material name.
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...
bool hasCell(const std::string &name) const
Check if a cell with given name exists in CSGBase object.
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
bool checkUniverseInBase(const CSGUniverse &universe) const
bool hasLattice(const std::string &name) const
Check if a lattice with given name exists in CSGBase object.
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
bool operator!=(const CSGBase &other) const
Operator overload for checking if two CSGBase objects are not equal.
void checkRegionSurfaces(const CSGRegion ®ion) const
std::variant< std::reference_wrapper< const CSGSurface >, std::reference_wrapper< const CSGCell >, std::reference_wrapper< const CSGUniverse >, std::reference_wrapper< const CSGRegion >, std::reference_wrapper< const CSGLattice > > CSGObjectVariant
Define a variant type that can hold references to different CSG object types.
bool checkSurfaceInBase(const CSGSurface &surface) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CSGCellList _cell_list
List of cells associated with CSG object.
void deleteUniverse(const CSGUniverse &univ)
Remove a Universe object passed in by reference from the stored universe list.
CSGLatticeList _lattice_list
List of lattices associated with CSG object.
const CSGCell & getCellByName(const std::string &name) const
Get a Cell object by name.
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > & getSurfaceListMap()
Get non-const map of all names to surfaces in surface list.
void resetLatticeOuter(const CSGLattice &lattice)
reset the outer fill for the lattice to VOID
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 ...
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > getUniverses() const
Get the arrangement of CSGUniverses in the lattice.
const CSGSurfaceList & getSurfaceList() const
Get a const reference to the CSGSurfaceList object.
bool checkCellInBase(const CSGCell &cell) const
CSGSurfaceList is a container for storing CSGSurface objects in the CSGBase object.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...
const CSGRegion & getRegion() const
Get the cell region.
bool hasUniverse(const std::string &name) const
return whether universe with given name exists in universe list
CSGBase()
Default constructor.
const CSGCell & addCellToList(const CSGCell &cell)
Add a new cell to the cell list based on a cell reference.
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes)=0
assign the vectors of universes as the lattice elements
const CSGUniverse & createUniverse(const std::string &name)
Create an empty Universe object.
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...
const CSGCellList & getCellList() const
Get a const reference to the CSGCellList object.
void deleteCell(const CSGCell &cell)
Remove a Cell object passed in by reference from the stored cell list.
void addCellToUniverse(const CSGUniverse &universe, const CSGCell &cell)
Add a cell to an existing universe.
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
const CSGLattice & addLatticeToList(const CSGLattice &lattice)
Add a new lattice to the lattice list based on a lattice reference.
void checkUniverseLinking() const
Check universes linked to root universe match universes defined in _universe_list.
std::vector< std::reference_wrapper< const CSGCell > > getAllCells() const
Get all cell objects.
const std::string getOuterType() const
Get the type of outer that fills the space around the lattice elements.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
void deleteSurface(const CSGSurface &surface)
Remove a Surface object passed in by reference from the stored surface list.
const CSGUniverseList & getUniverseList() const
Get a const reference to the CSGUniverseList object.
virtual std::unique_ptr< CSGLattice > clone() const =0
bool hasCell(const std::string &name) const
return whether cell with given name exists in cell list
void resetCellFill(const CSGCell &cell)
reset the fill of the specified cell to void
const CSGUniverse & getUniverseByName(const std::string &name)
Get a universe object by name.
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.
RotationAxisType
Enumeration of axis types for rotations.
void removeCellFromUniverse(const CSGUniverse &universe, const CSGCell &cell)
Remove a cell from an existing universe.
void addCell(const CSGCell &cell)
add cell to universe
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get all surface objects.
std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > & getUniverseListMap()
Get non-const map of all names to universes in universe list.