https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
CSG::CSGSurfaceEngUnit Class Referenceabstract

CSGSurfaceEngUnit is an abstract base class for "engineering units" that can be used as surfaces in cell region definitions. More...

#include <CSGSurfaceEngUnit.h>

Inheritance diagram for CSG::CSGSurfaceEngUnit:
[legend]

Public Types

enum  Halfspace { Halfspace::POSITIVE, Halfspace::NEGATIVE }
 Enum for the sign of the half-space being represented by a point and surface. More...
 

Public Member Functions

 CSGSurfaceEngUnit (const std::string &name)
 Construct a new CSGSurfaceEngUnit. More...
 
std::unordered_map< std::string, RealgetCoeffs () const override
 Always throws – coefficients are not defined for a surface engineering unit. More...
 
Real evaluateSurfaceEquationAtPoint (const Point &p) const override=0
 Evaluate the surface equation at the given point. More...
 
const std::string & getName () const override
 Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName() More...
 
bool isEngUnit () const override
 Engineering units report true so comparisons can skip the dynamic_cast fast path. More...
 
bool operator== (const CSGSurfaceEngUnit &other) const
 Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison) More...
 
bool operator!= (const CSGSurfaceEngUnit &other) const
 
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations () const override
 Delegate to CSGSurface (CSGTransformationHelper) More...
 
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings () const override
 Delegate to CSGSurface (CSGTransformationHelper) More...
 
const std::string getSurfaceType () const
 Get the Surface Type. More...
 
CSGSurface::Halfspace getHalfspaceFromPoint (const Point &p) const
 given a point, determine if it is in the positive or negative half-space for the surface More...
 
bool operator== (const CSGSurface &other) const
 Operator overload for checking if two CSGSurface objects are equal. More...
 
bool operator!= (const CSGSurface &other) const
 Operator overload for checking if two CSGSurface objects are not equal. More...
 
const std::string getBehavior () const
 Get the behavior of this engineering unit (surface (i.e. More...
 
const std::string getUnitType () const
 Get the type name of this engineering unit. More...
 
virtual std::unordered_map< std::string, AttributeVariantgetAttributes () const =0
 Get the attributes that define this engineering unit. More...
 
bool operator== (const CSGEngUnit &other) const
 Operator overload for checking if two CSGEngUnit objects are equal. More...
 
bool operator!= (const CSGEngUnit &other) const
 Operator overload for checking if two CSGEngUnit objects are not equal. More...
 

Static Public Member Functions

static bool isValidTransformationValue (TransformationType type, const std::tuple< Real, Real, Real > &values)
 Check if the transformation value is valid for the given type. More...
 
static std::string getTransformationTypeString (TransformationType type)
 Get the string representation of the transformation type. More...
 

Protected Member Functions

void expandUnit () override=0
 Create and add the concrete CSGSurface(s) in _internal_base. More...
 
CSGRegion getExpandedRegion () const
 Return the CSGRegion formed by the expanded CSGSurfaces. More...
 
std::unique_ptr< CSGSurfaceclone () const override=0
 clone() is pure virtual – derived classes must implement More...
 
void setName (const std::string &name)
 
void addTransformation (TransformationType type, const std::tuple< Real, Real, Real > &values)
 Add a transformation to the list of transformations. More...
 
Point applyReverseTransformsToPoint (Point p) const
 update the value of point p by applying the inverse of the list of transformations to the point More...
 
CSGBasegetBase ()
 Get the internal CSGBase owned by this engineering unit. More...
 
std::unique_ptr< CSGBasereleaseBase ()
 Transfer ownership of the internal CSGBase out of this unit. More...
 
 FRIEND_TEST (CSGEngUnitTest, testSurfUnit)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGSurfaceTest, testSetName)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGSurfaceTest, testSurfaceEquality)
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithTransform)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithNullTransform)
 
 FRIEND_TEST (CSGEngUnitTest, testEngUnitEqual)
 

Protected Attributes

CSGRegion _expanded_region
 Stores the result of expandUnit(); EMPTY until then. More...
 
std::string _name
 Name of surface. More...
 
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
 List of transformations applied to this object. More...
 
std::unique_ptr< CSGBase_internal_base
 CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() More...
 
MooseEnum _behavior {"SURFACE CELL UNIVERSE"}
 The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE". More...
 

Friends

class CSGBase
 

Detailed Description

CSGSurfaceEngUnit is an abstract base class for "engineering units" that can be used as surfaces in cell region definitions.

Derived classes define domain-specific surface attributes and implement expandUnit() and expandedRegion() methods to produce the equivalent representation using the basic CSGSurface components.

Derived classes must implement:

Definition at line 42 of file CSGSurfaceEngUnit.h.

Member Enumeration Documentation

◆ Halfspace

enum CSG::CSGSurface::Halfspace
stronginherited

Enum for the sign of the half-space being represented by a point and surface.

Enumerator
POSITIVE 
NEGATIVE 

Definition at line 30 of file CSGSurface.h.

31  {
32  POSITIVE,
33  NEGATIVE
34  };

Constructor & Destructor Documentation

◆ CSGSurfaceEngUnit()

CSG::CSGSurfaceEngUnit::CSGSurfaceEngUnit ( const std::string &  name)

Construct a new CSGSurfaceEngUnit.

Parameters
nameunique name of surface (will be preserved on the registered surface)

Definition at line 15 of file CSGSurfaceEngUnit.C.

16  : CSGSurface(name), CSGEngUnit("SURFACE")
17 {
18 }
CSGEngUnit(const std::string &behavior)
Constructor for intermediate EngUnit abstract classes.
Definition: CSGEngUnit.C:18
CSGSurface(const std::string &name)
Default constructor.
Definition: CSGSurface.C:17

Member Function Documentation

◆ addTransformation()

void CSG::CSGTransformationHelper::addTransformation ( TransformationType  type,
const std::tuple< Real, Real, Real > &  values 
)
protectedinherited

Add a transformation to the list of transformations.

Parameters
typeThe type of transformation
valuesThe values for the transformation

Definition at line 16 of file CSGTransformationHelper.C.

Referenced by CSG::CSGBase::expandEngUnit().

18 {
20  mooseError("Invalid transformation values provided for transformation type " +
22  _transformations.emplace_back(type, values);
23 }
static bool isValidTransformationValue(TransformationType type, const std::tuple< Real, Real, Real > &values)
Check if the transformation value is valid for the given type.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
static std::string getTransformationTypeString(TransformationType type)
Get the string representation of the transformation type.
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
List of transformations applied to this object.
std::array< Real, 2 > values
Definition: MortarUtils.C:52

◆ applyReverseTransformsToPoint()

Point CSG::CSGTransformationHelper::applyReverseTransformsToPoint ( Point  p) const
protectedinherited

update the value of point p by applying the inverse of the list of transformations to the point

Parameters
ppoint to transform
Returns
transformed point

Definition at line 74 of file CSGTransformationHelper.C.

Referenced by CSG::CSGSurface::getHalfspaceFromPoint().

75 {
76  // iterate list of transformations in reverse and apply the inverse operation
77  for (auto it = _transformations.rbegin(); it != _transformations.rend(); ++it)
78  {
79  auto trans_type = it->first;
80  auto val = it->second;
81 
82  if (trans_type == TransformationType::TRANSLATION)
83  {
84  Point offset(std::get<0>(val), std::get<1>(val), std::get<2>(val));
85  p -= offset;
86  }
87  else if (trans_type == TransformationType::SCALE)
88  {
89  Point scale(std::get<0>(val), std::get<1>(val), std::get<2>(val));
90  for (int i = 0; i < 3; ++i)
91  p(i) /= scale(i);
92  }
93  else if (trans_type == TransformationType::ROTATION)
94  {
95  // get the transpose of the original rotation matrix and apply to point p
96  const auto rot_matrix = RealTensorValue::intrinsic_rotation_matrix(
97  std::get<0>(val), std::get<1>(val), std::get<2>(val));
98  const auto rot_transpose = rot_matrix.transpose();
99  p = rot_transpose * p;
100  }
101  else
102  mooseError("Transformation type is not recognized.");
103  }
104  return p;
105 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
Real scale
Definition: MortarUtils.C:62
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
List of transformations applied to this object.
static TensorValue< Real > intrinsic_rotation_matrix(Real phi, Real theta, Real psi)

◆ clone()

std::unique_ptr<CSGSurface> CSG::CSGSurfaceEngUnit::clone ( ) const
overrideprotectedpure virtual

clone() is pure virtual – derived classes must implement

Implements CSG::CSGSurface.

Implemented in CSG::CSGNPolygonUnit.

◆ evaluateSurfaceEquationAtPoint()

Real CSG::CSGSurfaceEngUnit::evaluateSurfaceEquationAtPoint ( const Point &  p) const
overridepure virtual

Evaluate the surface equation at the given point.

Derived classes must implement this to allow callers to determine whether a point lies in the negative or positive half-space of the engineering unit without requiring prior expansion.

Parameters
ppoint to evaluate
Returns
negative value if the point is in the negative half-space, positive if in the positive half-space, zero if on the surface

Implements CSG::CSGSurface.

Implemented in CSG::CSGNPolygonUnit.

◆ expandUnit()

void CSG::CSGSurfaceEngUnit::expandUnit ( )
overrideprotectedpure virtual

Create and add the concrete CSGSurface(s) in _internal_base.

Called exclusively by CSGBase. The implementation must:

  1. Construct the concrete surface (e.g., std::make_unique<CSGZCylinder>(...))
  2. Add it via _internal_base->addSurface(std::move(surf)).
  3. Assign _expanded_region from the resulting surface half-spaces.

Implements CSG::CSGEngUnit.

Implemented in CSG::CSGNPolygonUnit.

Referenced by CSG::CSGBase::expandEngUnit().

◆ FRIEND_TEST() [1/6]

CSG::CSGTransformationHelper::FRIEND_TEST ( CSGSurfaceTest  ,
testHalfspaceWithTransform   
)
protectedinherited

Friends for unit testing.

◆ FRIEND_TEST() [2/6]

CSG::CSGTransformationHelper::FRIEND_TEST ( CSGSurfaceTest  ,
testHalfspaceWithNullTransform   
)
protectedinherited

◆ FRIEND_TEST() [3/6]

CSG::CSGTransformationHelper::FRIEND_TEST ( CSGEngUnitTest  ,
testEngUnitEqual   
)
protectedinherited

◆ FRIEND_TEST() [4/6]

CSG::CSGSurface::FRIEND_TEST ( CSGSurfaceTest  ,
testSetName   
)
protectedinherited

Friends for unit testing.

◆ FRIEND_TEST() [5/6]

CSG::CSGSurface::FRIEND_TEST ( CSGSurfaceTest  ,
testSurfaceEquality   
)
protectedinherited

◆ FRIEND_TEST() [6/6]

CSG::CSGSurfaceEngUnit::FRIEND_TEST ( CSGEngUnitTest  ,
testSurfUnit   
)
protected

Friends for unit testing.

◆ getAttributes()

virtual std::unordered_map<std::string, AttributeVariant> CSG::CSGEngUnit::getAttributes ( ) const
pure virtualinherited

Get the attributes that define this engineering unit.

Returns a map of domain-specific parameter names to their values, describing the EngUnit in meaningful engineering terms.

Returns
map of attribute name to AttributeVariant value

Implemented in CSG::CSGNPolygonUnit.

Referenced by CSG::CSGEngUnit::operator==().

◆ getBase()

CSGBase& CSG::CSGEngUnit::getBase ( )
inlineprotectedinherited

Get the internal CSGBase owned by this engineering unit.

Returns
reference to the internal CSGBase

Definition at line 117 of file CSGEngUnit.h.

117 { return *_internal_base; }
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130

◆ getBehavior()

const std::string CSG::CSGEngUnit::getBehavior ( ) const
inlineinherited

Get the behavior of this engineering unit (surface (i.e.

region), cell, or universe).

Returns "SURFACE", "CELL", or "UNIVERSE" depending on which intermediate EngUnit class the concrete type derives from. Set automatically at construction.

Returns
the behavior string

Definition at line 56 of file CSGEngUnit.h.

Referenced by CSG::CSGEngUnit::operator==().

56 { return _behavior; }
MooseEnum _behavior
The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE".
Definition: CSGEngUnit.h:133

◆ getCoeffs()

std::unordered_map< std::string, Real > CSG::CSGSurfaceEngUnit::getCoeffs ( ) const
overridevirtual

Always throws – coefficients are not defined for a surface engineering unit.

A surface engineering unit is described by its attributes (see getAttributes()), not by surface-equation coefficients, so this inherited CSGSurface method has no meaningful value on a unit. Expansion does not make it callable either: CSGBase::expandEngUnit() replaces the unit with plain CSGSurface object(s), and getCoeffs() is valid on those resulting surfaces, never on the unit itself.

The override exists only to satisfy the pure-virtual CSGSurface::getCoeffs()

Returns
never returns; always raises an error

Implements CSG::CSGSurface.

Definition at line 21 of file CSGSurfaceEngUnit.C.

22 {
23  mooseError("CSGSurfaceEngUnit '",
24  getName(),
25  "' cannot getCoeffs(). Coefficients are only callable on CSGSurface(s) generated by "
26  "expandUnit().");
27 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const std::string & getName() const override
Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()

◆ getExpandedRegion()

CSGRegion CSG::CSGSurfaceEngUnit::getExpandedRegion ( ) const
protected

Return the CSGRegion formed by the expanded CSGSurfaces.

Checks that expandUnit() has already been called (via _expanded_region) before returning the stored result. Throws if called before expansion.

Returns
CSGRegion representing the negative halfspace of the surface engineering unit

Definition at line 30 of file CSGSurfaceEngUnit.C.

31 {
32  // check if unit has been expanded first to define the region
34  mooseError("getExpandedRegion() cannot be called on CSGSurfaceEngUnit '",
35  getName(),
36  "' before expandUnit() has been called.");
37  return _expanded_region;
38 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGRegion _expanded_region
Stores the result of expandUnit(); EMPTY until then.
const std::string & getName() const override
Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()
RegionType getRegionType() const
Get the region type.
Definition: CSGRegion.h:123

◆ getHalfspaceFromPoint()

CSGSurface::Halfspace CSG::CSGSurface::getHalfspaceFromPoint ( const Point &  p) const
inherited

given a point, determine if it is in the positive or negative half-space for the surface

Parameters
ppoint
Returns
sign of the half-space

Definition at line 23 of file CSGSurface.C.

24 {
25  // if transformations are present on the surface, apply them in reverse to the point and pass that
26  // new point to the evaluation to ensure transformations are considered.
27 
28  // Create a local transformed copy - the original p in the calling scope is NOT modified
29  const Point p_trans = getTransformations().size() ? applyReverseTransformsToPoint(p) : p;
30 
31  auto eval = evaluateSurfaceEquationAtPoint(p_trans);
32  if (MooseUtils::absoluteFuzzyGreaterThan(eval, 0))
33  return Halfspace::POSITIVE;
34  else if (MooseUtils::absoluteFuzzyLessThan(eval, 0))
35  return Halfspace::NEGATIVE;
36  else
37  mooseError("Point ",
38  p,
39  " used to determine halfspace evaluation lies on the surface ",
40  _name,
41  ", leading to an ambiguously defined halfspace.");
42 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual Real evaluateSurfaceEquationAtPoint(const Point &p) const =0
given a point, determine its evaluation based on the surface equation.
Point applyReverseTransformsToPoint(Point p) const
update the value of point p by applying the inverse of the list of transformations to the point ...
std::string _name
Name of surface.
Definition: CSGSurface.h:122
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.

◆ getName()

const std::string& CSG::CSGSurfaceEngUnit::getName ( ) const
inlineoverridevirtual

Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()

Implements CSG::CSGEngUnit.

Definition at line 81 of file CSGSurfaceEngUnit.h.

Referenced by CSG::CSGBase::expandEngUnit(), CSG::CSGNPolygonUnit::expandUnit(), getCoeffs(), and getExpandedRegion().

81 { return CSGSurface::getName(); }
const std::string & getName() const
Get the name of surface.
Definition: CSGSurface.h:90

◆ getSurfaceType()

const std::string CSG::CSGSurface::getSurfaceType ( ) const
inlineinherited

Get the Surface Type.

Returns
type of surface

Definition at line 53 of file CSGSurface.h.

Referenced by CSG::CSGSurface::operator==().

54  {
55  return MooseUtils::prettyCppType(libMesh::demangle(typeid(*this).name()));
56  }
std::string demangle(const char *name)
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1151

◆ getTransformations()

const std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real> > >& CSG::CSGSurfaceEngUnit::getTransformations ( ) const
inlineoverridevirtual

Delegate to CSGSurface (CSGTransformationHelper)

Implements CSG::CSGEngUnit.

Definition at line 92 of file CSGSurfaceEngUnit.h.

93  {
95  }
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.

◆ getTransformationsAsStrings()

std::vector<std::pair<std::string, std::tuple<Real, Real, Real> > > CSG::CSGSurfaceEngUnit::getTransformationsAsStrings ( ) const
inlineoverridevirtual

Delegate to CSGSurface (CSGTransformationHelper)

Implements CSG::CSGEngUnit.

Definition at line 99 of file CSGSurfaceEngUnit.h.

100  {
102  }
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const
Get the transformations of this object with string representations for types.

◆ getTransformationTypeString()

std::string CSG::CSGTransformationHelper::getTransformationTypeString ( TransformationType  type)
staticinherited

Get the string representation of the transformation type.

Parameters
typeThe transformation type
Returns
String name of the transformation type

Definition at line 56 of file CSGTransformationHelper.C.

Referenced by CSG::CSGTransformationHelper::addTransformation(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().

57 {
58  // Set the enum to the value and convert it to string
60  enum_copy = static_cast<int>(type);
61  return std::string(enum_copy);
62 }
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
static const MooseEnum transformation_type_enum
MooseEnum for transformation types, matching the TransformationType enum values.

◆ getUnitType()

const std::string CSG::CSGEngUnit::getUnitType ( ) const
inlineinherited

Get the type name of this engineering unit.

Returns
the unit type string

Definition at line 63 of file CSGEngUnit.h.

Referenced by CSG::CSGCellEngUnit::getExpandedCell(), CSG::CSGUniverseEngUnit::getExpandedUniverse(), and CSG::CSGEngUnit::operator==().

64  {
65  return MooseUtils::prettyCppType(libMesh::demangle(typeid(*this).name()));
66  }
std::string demangle(const char *name)
std::string prettyCppType(const std::string &cpp_type)
Definition: MooseUtils.C:1151

◆ isEngUnit()

bool CSG::CSGSurfaceEngUnit::isEngUnit ( ) const
inlineoverridevirtual

Engineering units report true so comparisons can skip the dynamic_cast fast path.

Reimplemented from CSG::CSGSurface.

Definition at line 84 of file CSGSurfaceEngUnit.h.

84 { return true; }

◆ isValidTransformationValue()

bool CSG::CSGTransformationHelper::isValidTransformationValue ( TransformationType  type,
const std::tuple< Real, Real, Real > &  values 
)
staticinherited

Check if the transformation value is valid for the given type.

Parameters
typeThe type of transformation
valuesThe values for the transformation
Returns
True if the values are valid for the type

Definition at line 26 of file CSGTransformationHelper.C.

Referenced by CSG::CSGTransformationHelper::addTransformation().

28 {
29  // Additional validation specific to each transformation type could be added here
30  switch (type)
31  {
33  // All translation values are inherently valid
34  return true;
35 
37  // Rotation uses euler notation; values are angles in degrees (phi, theta, psi)
38  // For consistency with TransformGenerator, there are no restrictions on the angles
39  // phi: rotation around Z-axis
40  // theta: rotation around new X-axis
41  // psi: rotation around new Z-axis
42  return true;
43 
45  // Scaling factors should be non-zero
46  if (std::get<0>(values) == 0.0 || std::get<1>(values) == 0.0 || std::get<2>(values) == 0.0)
47  return false;
48  return true;
49 
50  default:
51  mooseError("Unknown transformation type");
52  }
53 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::array< Real, 2 > values
Definition: MortarUtils.C:52

◆ operator!=() [1/3]

bool CSG::CSGSurfaceEngUnit::operator!= ( const CSGSurfaceEngUnit other) const
inline

Definition at line 88 of file CSGSurfaceEngUnit.h.

88 { return CSGEngUnit::operator!=(other); }
bool operator!=(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are not equal.
Definition: CSGEngUnit.C:50

◆ operator!=() [2/3]

bool CSG::CSGEngUnit::operator!= ( const CSGEngUnit other) const
inherited

Operator overload for checking if two CSGEngUnit objects are not equal.

Definition at line 50 of file CSGEngUnit.C.

Referenced by CSG::CSGCellEngUnit::operator!=(), CSG::CSGUniverseEngUnit::operator!=(), and operator!=().

51 {
52  return !(*this == other);
53 }

◆ operator!=() [3/3]

bool CSG::CSGSurface::operator!= ( const CSGSurface other) const
inherited

Operator overload for checking if two CSGSurface objects are not equal.

Definition at line 65 of file CSGSurface.C.

66 {
67  return !(*this == other);
68 }

◆ operator==() [1/3]

bool CSG::CSGEngUnit::operator== ( const CSGEngUnit other) const
inherited

Operator overload for checking if two CSGEngUnit objects are equal.

Definition at line 34 of file CSGEngUnit.C.

Referenced by CSG::CSGCellEngUnit::operator==(), CSG::CSGUniverseEngUnit::operator==(), and operator==().

35 {
36  if (getName() != other.getName())
37  return false;
38  if (getBehavior() != other.getBehavior())
39  return false;
40  if (getUnitType() != other.getUnitType())
41  return false;
42  if (getAttributes() != other.getAttributes())
43  return false;
44  if (getTransformations() != other.getTransformations())
45  return false;
46  return true;
47 }
virtual const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const =0
Get the list of transformations applied to this engineering unit.
const std::string getUnitType() const
Get the type name of this engineering unit.
Definition: CSGEngUnit.h:63
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get the attributes that define this engineering unit.
const std::string getBehavior() const
Get the behavior of this engineering unit (surface (i.e.
Definition: CSGEngUnit.h:56
virtual const std::string & getName() const =0
Get the unique instance name of this engineering unit.

◆ operator==() [2/3]

bool CSG::CSGSurfaceEngUnit::operator== ( const CSGSurfaceEngUnit other) const
inline

Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison)

Definition at line 87 of file CSGSurfaceEngUnit.h.

87 { return CSGEngUnit::operator==(other); }
bool operator==(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are equal.
Definition: CSGEngUnit.C:34

◆ operator==() [3/3]

bool CSG::CSGSurface::operator== ( const CSGSurface other) const
inherited

Operator overload for checking if two CSGSurface objects are equal.

Definition at line 45 of file CSGSurface.C.

46 {
47  // If both objects are engineering units, delegate to CSGEngUnit::operator== to avoid
48  // calling getCoeffs(), which is not supported on engineering unit types. The isEngUnit()
49  // check keeps the common plain-surface path free of any dynamic_cast; the casts below
50  // only run once we know the objects are engineering units.
51  if (isEngUnit())
52  {
53  if (other.isEngUnit())
54  return *dynamic_cast<const CSGEngUnit *>(this) == *dynamic_cast<const CSGEngUnit *>(&other);
55  return false; // an engineering unit cannot equal a plain surface
56  }
57 
58  return (this->getName() == other.getName()) &&
59  (this->getSurfaceType() == other.getSurfaceType()) &&
60  (this->getCoeffs() == other.getCoeffs()) &&
61  (this->getTransformations() == other.getTransformations());
62 }
const std::string & getName() const
Get the name of surface.
Definition: CSGSurface.h:90
const std::string getSurfaceType() const
Get the Surface Type.
Definition: CSGSurface.h:53
virtual std::unordered_map< std::string, Real > getCoeffs() const =0
Get the coefficients that define the surface.
virtual bool isEngUnit() const
Whether this surface is an engineering unit.
Definition: CSGSurface.h:101
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.

◆ releaseBase()

std::unique_ptr< CSGBase > CSG::CSGEngUnit::releaseBase ( )
protectedinherited

Transfer ownership of the internal CSGBase out of this unit.

Called once by CSGBase::expandEngUnit() to join the internal base into the parent. After this call _internal_base is null.

Returns
unique_ptr to the internal CSGBase

Definition at line 28 of file CSGEngUnit.C.

29 {
30  return std::move(_internal_base);
31 }
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130

◆ setName()

void CSG::CSGSurface::setName ( const std::string &  name)
inlineprotectedinherited

Definition at line 119 of file CSGSurface.h.

119 { _name = name; }
std::string name(const ElemQuality q)
std::string _name
Name of surface.
Definition: CSGSurface.h:122

Friends And Related Function Documentation

◆ CSGBase

friend class CSGBase
friend

Definition at line 133 of file CSGSurfaceEngUnit.h.

Member Data Documentation

◆ _behavior

MooseEnum CSG::CSGEngUnit::_behavior {"SURFACE CELL UNIVERSE"}
protectedinherited

The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE".

Definition at line 133 of file CSGEngUnit.h.

Referenced by CSG::CSGEngUnit::CSGEngUnit(), and CSG::CSGEngUnit::getBehavior().

◆ _expanded_region

CSGRegion CSG::CSGSurfaceEngUnit::_expanded_region
protected

Stores the result of expandUnit(); EMPTY until then.

Definition at line 129 of file CSGSurfaceEngUnit.h.

Referenced by CSG::CSGNPolygonUnit::expandUnit(), and getExpandedRegion().

◆ _internal_base

std::unique_ptr<CSGBase> CSG::CSGEngUnit::_internal_base
protectedinherited

◆ _name

std::string CSG::CSGSurface::_name
protectedinherited

◆ _transformations

std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real> > > CSG::CSGTransformationHelper::_transformations
protectedinherited

The documentation for this class was generated from the following files: