18 std::string root_name =
"ROOT_UNIVERSE";
19 auto root_universe = std::make_unique<CSGUniverse>(root_name,
true);
21 _universes.insert(std::make_pair(root_name, std::move(root_universe)));
29 mooseError(
"No universe by name " +
name +
" exists in the geometry.");
31 return *(univ->second);
34 std::vector<std::reference_wrapper<const CSGUniverse>>
37 std::vector<std::reference_wrapper<const CSGUniverse>> univs;
39 univs.push_back(*(it->second.get()));
52 auto name = universe->getName();
53 auto [it, inserted] =
_universes.emplace(
name, std::move(universe));
55 mooseError(
"Universe with name " +
name +
" already exists in geometry.");
64 auto prev_name = universe.
getName();
66 if (it ==
_universes.end() || it->second.get() != &universe)
67 mooseError(
"Universe " + prev_name +
" cannot be renamed to " +
name +
68 " as it does not exist in this CSGBase instance.");
70 auto existing_univ = std::move(it->second);
71 existing_univ->setName(
name);
std::string name(const ElemQuality q)
std::vector< std::reference_wrapper< const CSGUniverse > > getAllUniverses() const
Get all the universes in CSGBase instance.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const CSGUniverse * _root_universe
root universe for the CSGBase instance
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
CSGUniverse & getUniverse(const std::string &name) const
Get a Universe from the list by its name.
const std::string & getName() const
Get the name of the universe.
CSGUniverse & addUniverse(const std::string &name)
create an empty universe
void renameUniverse(const CSGUniverse &universe, const std::string &name)
rename the specified universe
std::unordered_map< std::string, std::unique_ptr< CSGUniverse > > _universes
Mapping of universe names to pointers of stored universe objects.
CSGUniverseList()
Default constructor.