22 mooseError(
"No lattice by name " +
name +
" exists in the geometry.");
24 return *(lat->second);
27 std::vector<std::reference_wrapper<const CSGLattice>>
30 std::vector<std::reference_wrapper<const CSGLattice>> lattices;
32 lattices.push_back(*(it->second.get()));
39 auto lattice_name = lattice->
getName();
40 if (ignore_identical_lattice)
44 if (*lattice == *it->second)
49 " has the same name as an existing lattice in CSGBase instance but cannot be " 50 "discarded as it is not an identical lattice.");
55 auto [it, inserted] =
_lattices.emplace(lattice_name, std::move(lattice));
57 mooseError(
"Lattice with name " + lattice_name +
" already exists in geometry.");
65 auto prev_name = lattice.
getName();
67 if (it ==
_lattices.end() || it->second.get() != &lattice)
68 mooseError(
"Lattice " + prev_name +
" cannot be renamed to " +
name +
69 " as it does not exist in this CSGBase instance.");
71 auto existing_lat = std::move(it->second);
72 existing_lat->setName(
name);
84 if (all_lats.size() != other_lats.size())
89 for (
const auto & lat : all_lats)
91 const auto & lat_name = lat.get().getName();
94 const auto & other_lat = other.
getLattice(lat_name);
95 if (lat.get() != other_lat)
104 return !(*
this == other);
std::string name(const ElemQuality q)
CSGLattice & addLattice(std::unique_ptr< CSGLattice > lattice, const bool ignore_identical_lattice=false)
add an existing lattice to list.
bool operator!=(const CSGLatticeList &other) const
Operator overload for checking if two CSGLatticeList objects are not equal.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
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.
void renameLattice(const CSGLattice &lattice, const std::string &name)
rename the specified lattice
CSGLatticeList creates a container for CSGLattice objects to pass to CSGBase.
std::unordered_map< std::string, std::unique_ptr< CSGLattice > > _lattices
Mapping of lattice names to pointers of stored lattice objects.
CSGLattice is the abstract class for defining lattices.
CSGLatticeList()
Default constructor.
bool hasLattice(const std::string &name) const
return whether lattice with given name exists in lattice list
bool operator==(const CSGLatticeList &other) const
Operator overload for checking if two CSGLatticeList objects are equal.
CSGLattice & getLattice(const std::string &name) const
Get a Lattice from the list by its name.