32 const std::string & region_type)
40 " cannot be performed on an empty region.");
77 if (
this != &other_region)
78 *
this =
CSGRegion(*
this, other_region,
"INTERSECTION");
85 if (
this != &other_region)
86 *
this =
CSGRegion(*
this, other_region,
"UNION");
99 std::vector<std::string> ops_list = {
" | ",
" & ",
"~"};
100 if (op.compare(
" | ") && op.compare(
" & "))
103 "Region string can only be simplified based on intersection (&) and union (|) operations.");
108 bool remove_par =
true;
109 for (
auto opi : ops_list)
112 if (region_str.find(opi) != std::string::npos)
119 region_str.erase(std::remove_if(region_str.begin(),
121 [](
char c) {
return c ==
'(' || c ==
')'; }),
146 return CSGRegion(region_a, region_b,
"INTERSECTION");
153 return CSGRegion(region_a, region_b,
"UNION");
168 if (region_type_eq && region_str_eq)
172 const bool num_cells_eq = all_surfs.size() == other_surfs.size();
176 if (all_surfs[i].
get() != other_surfs[i].
get())
190 return !(*
this == other);
std::string _region_str
String representation of region - defaults to empty string.
const std::string & getName() const
Get the name of surface.
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
CSGRegion()
Default Constructor.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const std::string & toString() const
gets the string representation of the region
Halfspace
Enum for the sign of the half-space being represented by a point and surface.
const CSGRegion operator|(const CSGRegion ®ion_a, const CSGRegion ®ion_b)
Overload for creating a region from the union (|) of two regions.
bool operator!=(const CSGRegion &other) const
Operator overload for checking if two CSGRegion objects are not equal.
const CSGRegion operator+(const CSGSurface &surf)
Operation overloads for operation based region construction.
CSGRegion & operator|=(const CSGRegion &other_region)
Operator overload for |= which creates a union of the current region with the other_region.
bool operator==(const CSGRegion &other) const
Operator overload for checking if two CSGRegion objects are equal.
const CSGRegion operator &(const CSGRegion ®ion_a, const CSGRegion ®ion_b)
Overload for creating a region from the the intersection (&) of two regions.
RegionType getRegionType() const
Get the region type.
CSGRegion & operator &=(const CSGRegion &other_region)
Operator overload for &= which creates an intersection between the current region and the other_regio...
const std::vector< std::reference_wrapper< const CSGSurface > > & getSurfaces() const
Get the list of surfaces associated with the region.
MooseEnum _region_type
An enum for type of type of operation that defines region.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...
std::vector< std::reference_wrapper< const CSGSurface > > _surfaces
Surface list associated with the region.
const CSGRegion operator~(const CSGRegion ®ion)
Overload for creating a region from the complement (~) of another region.
auto index_range(const T &sizable)
const std::string stripRegionString(std::string region_str, std::string op)
strip the leading and trailing parentheses from the string if only the specified operator is present ...
const std::string getRegionTypeString() const
Get the region type as a string.
const CSGRegion operator-(const CSGSurface &surf)
Overload for creating a region from the negative half-space (-) of a surface.