33 mooseError(
"No surface by name " +
name +
" exists in the geometry.");
35 return *(surf->second);
38 std::vector<std::reference_wrapper<const CSGSurface>>
41 std::vector<std::reference_wrapper<const CSGSurface>> surfaces;
43 surfaces.push_back(*(it->second));
50 auto surf_name = surf->
getName();
51 if (ignore_identical_surface)
55 if (*surf == *it->second)
60 " has the same name as an existing surface in CSGBase instance but cannot be " 61 "discarded as it is not an identical surface.");
66 auto [it, inserted] =
_surfaces.emplace(surf_name, std::move(surf));
68 mooseError(
"Surface with name " + surf_name +
" already exists in geometry.");
77 auto prev_name = surface.
getName();
79 if (it ==
_surfaces.end() || it->second.get() != &surface)
80 mooseError(
"Surface " + prev_name +
" cannot be renamed to " +
name +
81 " as it does not exist in this CSGBase instance.");
83 auto existing_surface = std::move(it->second);
84 existing_surface->setName(
name);
96 if (all_surfs.size() != other_surfs.size())
101 for (
const auto & surf : all_surfs)
103 const auto & surf_name = surf.get().getName();
106 const auto & other_surf = other.
getSurface(surf_name);
107 if (surf.get() != other_surf)
116 return !(*
this == other);
bool operator!=(const CSGSurfaceList &other) const
Operator overload for checking if two CSGSurfaceList objects are not equal.
std::string name(const ElemQuality q)
const std::string & getName() const
Get the name of surface.
bool hasSurface(const std::string &name) const
return whether surface with given name exists in surface list
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
CSGSurface & getSurface(const std::string &name) const
Get a surface by name.
std::vector< std::reference_wrapper< const CSGSurface > > getAllSurfaces() const
Get list of references to all surfaces in surface list.
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > _surfaces
Mapping of surface names to pointers of stored surface objects.
void renameSurface(const CSGSurface &surface, const std::string &name)
rename the specified surface
bool operator==(const CSGSurfaceList &other) const
Operator overload for checking if two CSGSurfaceList objects are equal.
CSGSurface & addSurface(std::unique_ptr< CSGSurface > surf, const bool ignore_identical_surface=false)
add a surface object to existing SurfaceList.
std::unordered_map< std::string, std::unique_ptr< CSGSurface > > & getSurfaceListMap()
Get non-const map of all names to surfaces in surface list.
CSGSurfaceList()
Default constructor.
CSGSurfaceList is a container for storing CSGSurface objects in the CSGBase object.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...