CSGRegions creates an internal representation of a CSG region, which can refer to an intersection, union, complement, or half-space. More...
#include <CSGRegion.h>
Public Types | |
| enum | RegionType { RegionType::EMPTY, RegionType::HALFSPACE, RegionType::COMPLEMENT, RegionType::INTERSECTION, RegionType::UNION } |
| Enum for representing region types, defined to match _region_type MooseEnum. More... | |
| typedef std::variant< std::reference_wrapper< const CSGSurface >, RegionType, CSGSurface::Halfspace > | PostfixTokenVariant |
| Type definition for a variant that represents the datatypes for entries within the list that represents the region in postfix notation. More... | |
Public Member Functions | |
| CSGRegion () | |
| Default Constructor. More... | |
| CSGRegion (const CSGSurface &surf, const CSGSurface::Halfspace halfspace) | |
| Constructor for half-space of a surface. More... | |
| CSGRegion (const CSGRegion ®ion_a, const CSGRegion ®ion_b, const std::string ®ion_type) | |
| Constructor for union and intersection. More... | |
| CSGRegion (const CSGRegion ®ion, const std::string ®ion_type) | |
| Constructor for complement or empty region (clear the region) More... | |
| virtual | ~CSGRegion ()=default |
| Destructor. More... | |
| nlohmann::json | toInfixJSON () const |
| gets the infix JSON representation of the region, which involves converting region representation from postfix to infix notation More... | |
| std::vector< std::string > | toPostfixStringList () const |
| gets the list of postfix tokens of the region in string representation More... | |
| std::string | postfixTokenToString (const PostfixTokenVariant &token) const |
| converts postfix token from PostfixTokenVariant to string representation More... | |
| RegionType | getRegionType () const |
| Get the region type. More... | |
| const std::string | getRegionTypeString () const |
| Get the region type as a string. More... | |
| std::vector< std::reference_wrapper< const CSGSurface > > | getSurfaces () const |
| Get the list of surfaces associated with the region. More... | |
| void | updateSurfaceReferences (std::map< std::string, std::reference_wrapper< const CSGSurface >> &identical_surface_refs) |
| Update surface references of region based on map of input surface references. More... | |
| CSGRegion & | operator &= (const CSGRegion &other_region) |
| Operator overload for &= which creates an intersection between the current region and the other_region. More... | |
| CSGRegion & | operator|= (const CSGRegion &other_region) |
| Operator overload for |= which creates a union of the current region with the other_region. More... | |
| bool | operator== (const CSGRegion &other) const |
| Operator overload for checking if two CSGRegion objects are equal. More... | |
| bool | operator!= (const CSGRegion &other) const |
| Operator overload for checking if two CSGRegion objects are not equal. More... | |
Static Public Member Functions | |
| static char | regionSymbol (const RegionType region_type) |
| static char | halfspaceSymbol (const CSGSurface::Halfspace halfspace) |
Protected Member Functions | |
| const std::vector< PostfixTokenVariant > & | getPostfixTokens () const |
| Get the list of postfix tokens associated with the region. More... | |
| bool | nextRegionOpIsIdentical (const RegionType region, const std::size_t postfix_token_index) const |
| Iterate through postfix tokens and check if next region operator matches the given operator. More... | |
| bool | checkRegionEquality (const std::vector< PostfixTokenVariant > &other_tokens) const |
| Loop through postfix tokens and check equality with another list of postfix tokens. More... | |
Protected Attributes | |
| MooseEnum | _region_type {"EMPTY=0 HALFSPACE=1 COMPLEMENT=2 INTERSECTION=3 UNION=4"} |
| An enum for type of type of operation that defines region. More... | |
| std::vector< PostfixTokenVariant > | _postfix_tokens |
| List of tokens representing the region in postfix notation. More... | |
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection, union, complement, or half-space.
Definition at line 22 of file CSGRegion.h.
| typedef std::variant<std::reference_wrapper<const CSGSurface>, RegionType, CSGSurface::Halfspace> CSG::CSGRegion::PostfixTokenVariant |
Type definition for a variant that represents the datatypes for entries within the list that represents the region in postfix notation.
This can be a surface reference, a region type, or halfspace
Definition at line 41 of file CSGRegion.h.
|
strong |
Enum for representing region types, defined to match _region_type MooseEnum.
| Enumerator | |
|---|---|
| EMPTY | |
| HALFSPACE | |
| COMPLEMENT | |
| INTERSECTION | |
| UNION | |
Definition at line 26 of file CSGRegion.h.
| CSG::CSGRegion::CSGRegion | ( | ) |
Default Constructor.
Definition at line 90 of file CSGRegion.C.
Referenced by operator|=().
| CSG::CSGRegion::CSGRegion | ( | const CSGSurface & | surf, |
| const CSGSurface::Halfspace | halfspace | ||
| ) |
Constructor for half-space of a surface.
| surf | referance to surface used to define the half-space |
| halfspace | half-space to apply to surface (POSITIVE or NEGATIVE) |
Definition at line 97 of file CSGRegion.C.
| CSG::CSGRegion::CSGRegion | ( | const CSGRegion & | region_a, |
| const CSGRegion & | region_b, | ||
| const std::string & | region_type | ||
| ) |
Constructor for union and intersection.
| region_a | reference to first region to union or intersect |
| region_b | reference to second region to union or intersect |
| region_type | type of region operation (UNION or INTERSECTION) |
Definition at line 107 of file CSGRegion.C.
| CSG::CSGRegion::CSGRegion | ( | const CSGRegion & | region, |
| const std::string & | region_type | ||
| ) |
Constructor for complement or empty region (clear the region)
| region | reference to region to apply complement |
| region_type | type of region to apply (COMPLEMENT or EMPTY) |
Definition at line 130 of file CSGRegion.C.
|
virtualdefault |
Destructor.
|
protected |
Loop through postfix tokens and check equality with another list of postfix tokens.
| other_tokens | list of postfix tokens to compare to |
Definition at line 54 of file CSGRegion.C.
Referenced by operator==().
|
inlineprotected |
Get the list of postfix tokens associated with the region.
Definition at line 160 of file CSGRegion.h.
Referenced by checkRegionEquality(), CSGRegion(), and operator==().
|
inline |
Get the region type.
Definition at line 117 of file CSGRegion.h.
Referenced by CSGRegion(), CSGUtils::getInnerRegion(), and operator==().
|
inline |
Get the region type as a string.
Definition at line 124 of file CSGRegion.h.
Referenced by CSGRegion().
| std::vector< std::reference_wrapper< const CSGSurface > > CSG::CSGRegion::getSurfaces | ( | ) | const |
Get the list of surfaces associated with the region.
Definition at line 266 of file CSGRegion.C.
Referenced by CSG::CSGBase::addTransformation(), and CSG::CSGBase::checkRegionSurfaces().
|
static |
Definition at line 37 of file CSGRegion.C.
Referenced by postfixTokenToString(), and toInfixJSON().
|
protected |
Iterate through postfix tokens and check if next region operator matches the given operator.
| region | the region type |
| postfix_token_index | index in _postfix_tokens to start region operator comparisons |
Definition at line 242 of file CSGRegion.C.
Referenced by toInfixJSON().
Operator overload for &= which creates an intersection between the current region and the other_region.
| bool CSG::CSGRegion::operator!= | ( | const CSGRegion & | other | ) | const |
Operator overload for checking if two CSGRegion objects are not equal.
Definition at line 337 of file CSGRegion.C.
| bool CSG::CSGRegion::operator== | ( | const CSGRegion & | other | ) | const |
Operator overload for checking if two CSGRegion objects are equal.
Definition at line 330 of file CSGRegion.C.
Operator overload for |= which creates a union of the current region with the other_region.
Definition at line 285 of file CSGRegion.C.
| std::string CSG::CSGRegion::postfixTokenToString | ( | const PostfixTokenVariant & | token | ) | const |
converts postfix token from PostfixTokenVariant to string representation
| token | postfix token of type PostfixTokenVariant |
Definition at line 224 of file CSGRegion.C.
Referenced by checkRegionEquality(), and toPostfixStringList().
|
static |
Definition at line 16 of file CSGRegion.C.
Referenced by postfixTokenToString(), and toInfixJSON().
| nlohmann::json CSG::CSGRegion::toInfixJSON | ( | ) | const |
gets the infix JSON representation of the region, which involves converting region representation from postfix to infix notation
Definition at line 147 of file CSGRegion.C.
| std::vector< std::string > CSG::CSGRegion::toPostfixStringList | ( | ) | const |
gets the list of postfix tokens of the region in string representation
Definition at line 214 of file CSGRegion.C.
| void CSG::CSGRegion::updateSurfaceReferences | ( | std::map< std::string, std::reference_wrapper< const CSGSurface >> & | identical_surface_refs | ) |
Update surface references of region based on map of input surface references.
| identical_surface_refs | map of surface name to surface references that region should be defined with |
Definition at line 252 of file CSGRegion.C.
Referenced by CSG::CSGCell::updateCellRegionSurfaces().
|
protected |
List of tokens representing the region in postfix notation.
Definition at line 186 of file CSGRegion.h.
Referenced by CSGRegion(), getPostfixTokens(), getSurfaces(), nextRegionOpIsIdentical(), toInfixJSON(), toPostfixStringList(), and updateSurfaceReferences().
|
protected |
An enum for type of type of operation that defines region.
Definition at line 183 of file CSGRegion.h.
Referenced by CSGRegion(), getRegionType(), and getRegionTypeString().
1.8.14