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

CSGCellEngUnit is an abstract base class for "engineering units" that are cell-like. More...

#include <CSGCellEngUnit.h>

Inheritance diagram for CSG::CSGCellEngUnit:
[legend]

Public Member Functions

const std::string & getName () const override
 Satisfy CSGEngUnit::getName() (resolved via CSGCell::getName()) More...
 
bool isEngUnit () const override
 Engineering units report true so comparisons can skip the dynamic_cast fast path. More...
 
bool operator== (const CSGCellEngUnit &other) const
 Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison) More...
 
bool operator!= (const CSGCellEngUnit &other) const
 
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations () const override
 Delegate to CSGCell (CSGTransformationHelper) More...
 
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings () const override
 Delegate to CSGCell (CSGTransformationHelper) More...
 
const std::string getFillType () const
 Get the type of fill for the cell. More...
 
const CSGUniversegetFillUniverse () const
 Get the cell fill if fill type is UNIVERSE. More...
 
const std::string & getFillMaterial () const
 Get the cell fill material name if fill fype is CSG_MATERIAL. More...
 
const CSGLatticegetFillLattice () const
 Get the cell fill if fill type is LATTICE. More...
 
const std::string & getFillName () const
 Get the name of the fill, regardless of its type. More...
 
const CSGRegiongetRegion () const
 Get the cell region. More...
 
bool operator== (const CSGCell &other) const
 Operator overload for checking if two CSGCell objects are equal. More...
 
bool operator!= (const CSGCell &other) const
 Operator overload for checking if two CSGCell 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

 CSGCellEngUnit (const std::string &name)
 Constructor for derived classes. More...
 
virtual std::unique_ptr< CSGCellEngUnitclone () const =0
 Create a deep copy of this engineering unit for use in a different CSGBase instance. More...
 
void expandUnit () override=0
 Create the CSGCell and any other necessary components in _internal_base. More...
 
const CSGCellgetExpandedCell () const
 Return the single cell in _internal_base's root, which IS the expanded cell. More...
 
void setName (const std::string &name)
 
void updateCellRegionSurfaces (std::map< std::string, std::reference_wrapper< const CSGSurface >> &identical_surface_refs)
 Update surface references of cell region based on map of input surface references. More...
 
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...
 
void resetCellFill ()=delete
 Cell fill and region updates are not permitted on engineering units. More...
 
void updateCellFill (const std::string &)=delete
 
void updateCellFill (const CSGUniverse *)=delete
 
void updateCellFill (const CSGLattice *)=delete
 
void updateRegion (const CSGRegion &)=delete
 
 FRIEND_TEST (CSGCellTest, testSetName)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGCellTest, testUpdateRegion)
 
 FRIEND_TEST (CSGCellTest, testCellEquality)
 
 FRIEND_TEST (CSGCellTest, testUpdateFill)
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithTransform)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithNullTransform)
 
 FRIEND_TEST (CSGEngUnitTest, testEngUnitEqual)
 

Protected Attributes

std::string _name
 Name of surface. More...
 
MooseEnum _fill_type {"VOID CSG_MATERIAL UNIVERSE LATTICE"}
 An enum for type of fill for cell region. More...
 
std::string _fill_name
 name of the fill object for CSG_MATERIAL fills More...
 
CSGRegion _region
 Cell region, represented as a CSGRegion object. More...
 
const CSGUniverse_fill_universe
 Fill object if fill is CSGUniverse. More...
 
const CSGLattice_fill_lattice
 Fill object if fill is CSGLattice. 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

CSGCellEngUnit is an abstract base class for "engineering units" that are cell-like.

Derived classes define domain-specific attributes and implement expandUnit() to produce the equivalent CSGCell representation using basic CSG components.

Derived classes must implement:

Definition at line 38 of file CSGCellEngUnit.h.

Constructor & Destructor Documentation

◆ CSGCellEngUnit()

CSG::CSGCellEngUnit::CSGCellEngUnit ( const std::string &  name)
protected

Constructor for derived classes.

Initializes the base CSGCell with a placeholder empty CSGRegion.

Parameters
namename of the cell (will be preserved on the plain CSGCell after expansion)

Definition at line 17 of file CSGCellEngUnit.C.

18  : CSGCell(name, CSGRegion()), CSGEngUnit("CELL")
19 {
20 }
CSGEngUnit(const std::string &behavior)
Constructor for intermediate EngUnit abstract classes.
Definition: CSGEngUnit.C:18
CSGCell(const std::string &name, const CSGRegion &region)
Constructor for void cell.
Definition: CSGCell.C:19

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()

virtual std::unique_ptr<CSGCellEngUnit> CSG::CSGCellEngUnit::clone ( ) const
protectedpure virtual

Create a deep copy of this engineering unit for use in a different CSGBase instance.

Derived classes must implement this and return a fully-constructed copy with the same attributes.

Returns
unique_ptr to a fresh copy of this engineering unit

◆ expandUnit()

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

Create the CSGCell and any other necessary components in _internal_base.

Called exclusively by CSGBase. The implementation should:

  1. Create any needed CSGSurfaces via _internal_base->addSurface(...)
  2. Create a CSGRegion from those surfaces
  3. Create any fill universe if necessary via _internal_base->createUniverse(...)
  4. Register exactly one CSGCell via _internal_base->createCell(...) to go into root.

Implements CSG::CSGEngUnit.

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

◆ FRIEND_TEST() [1/7]

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

Friends for unit testing.

◆ FRIEND_TEST() [2/7]

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

◆ FRIEND_TEST() [3/7]

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

◆ FRIEND_TEST() [4/7]

CSG::CSGCell::FRIEND_TEST ( CSGCellTest  ,
testSetName   
)
protectedinherited

Friends for unit testing.

◆ FRIEND_TEST() [5/7]

CSG::CSGCell::FRIEND_TEST ( CSGCellTest  ,
testUpdateRegion   
)
protectedinherited

◆ FRIEND_TEST() [6/7]

CSG::CSGCell::FRIEND_TEST ( CSGCellTest  ,
testCellEquality   
)
protectedinherited

◆ FRIEND_TEST() [7/7]

CSG::CSGCell::FRIEND_TEST ( CSGCellTest  ,
testUpdateFill   
)
protectedinherited

◆ 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

◆ getExpandedCell()

const CSGCell & CSG::CSGCellEngUnit::getExpandedCell ( ) const
protected

Return the single cell in _internal_base's root, which IS the expanded cell.

Enforces that exactly one cell is in the root (errors otherwise). Valid after expandUnit() has been called. Not valid after CSGBase::expandEngUnit() has consumed the internal base.

Returns
const reference to the expanded CSGCell

Definition at line 23 of file CSGCellEngUnit.C.

24 {
25  // must contain exactly one cell in the root universe to be considered a correct implementation
26  // and be expanded properly. Additional cells can exist in _internal_base through universe/cell
27  // nesting.
28  const auto & cells = _internal_base->getRootUniverse().getAllCells();
29  if (cells.size() == 0)
30  mooseError("The root universe of CSGCellEngUnit ",
31  getName(),
32  " contains no cells. ",
33  "Either getExpandedCell() was called before expandUnit() or expandUnit() is not "
34  "implemented correctly");
35  if (cells.size() > 1)
36  mooseError("CSGCellEngUnit '",
37  getName(),
38  "' expandUnit() must create exactly one cell in _internal_base's root universe "
39  "(found ",
40  cells.size(),
41  ").");
42  // Check that all universes and cells in _internal_base are reachable from root.
43  if (!_internal_base->areUniversesLinked())
44  mooseError("CSGCellEngUnit '",
45  getName(),
46  "' of type '",
47  getUnitType(),
48  "' contains unlinked universes or cells. All objects created in expandUnit() must "
49  "be reachable from root. Check implementation of expandUnit().");
50 
51  return cells[0];
52 }
const std::string & getName() const override
Satisfy CSGEngUnit::getName() (resolved via CSGCell::getName())
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130
const std::string getUnitType() const
Get the type name of this engineering unit.
Definition: CSGEngUnit.h:63

◆ getFillLattice()

const CSGLattice & CSG::CSGCell::getFillLattice ( ) const
inherited

Get the cell fill if fill type is LATTICE.

Returns
Reference to CSGLattice fill

Definition at line 77 of file CSGCell.C.

Referenced by CSG::CSGBase::addCellToList(), and CSG::CSGCell::operator==().

78 {
79  if (getFillType() != "LATTICE")
80  mooseError("Cell '" + getName() + "' has " + getFillType() + " fill, not LATTICE.");
81  else
82  return *_fill_lattice;
83 }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const CSGLattice * _fill_lattice
Fill object if fill is CSGLattice.
Definition: CSGCell.h:199

◆ getFillMaterial()

const std::string & CSG::CSGCell::getFillMaterial ( ) const
inherited

Get the cell fill material name if fill fype is CSG_MATERIAL.

Returns
name of the cell's CSG material fill

Definition at line 68 of file CSGCell.C.

Referenced by CSG::CSGBase::addCellToList(), and CSG::CSGCell::operator==().

69 {
70  if (getFillType() != "CSG_MATERIAL")
71  mooseError("Cell '" + getName() + "' has " + getFillType() + " fill, not CSG_MATERIAL.");
72  else
73  return _fill_name;
74 }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
std::string _fill_name
name of the fill object for CSG_MATERIAL fills
Definition: CSGCell.h:190

◆ getFillName()

const std::string & CSG::CSGCell::getFillName ( ) const
inherited

Get the name of the fill, regardless of its type.

Returns
std::string fill name

Definition at line 48 of file CSGCell.C.

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

49 {
50  if (getFillType() == "UNIVERSE")
51  return _fill_universe->getName();
52  else if (getFillType() == "LATTICE")
53  return _fill_lattice->getName();
54  else
55  return _fill_name;
56 }
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:60
const std::string & getName() const
Get the name of the universe.
Definition: CSGUniverse.h:80
const CSGLattice * _fill_lattice
Fill object if fill is CSGLattice.
Definition: CSGCell.h:199
std::string _fill_name
name of the fill object for CSG_MATERIAL fills
Definition: CSGCell.h:190
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:196

◆ getFillType()

const std::string CSG::CSGCell::getFillType ( ) const
inlineinherited

Get the type of fill for the cell.

Returns
fill type

Definition at line 77 of file CSGCell.h.

Referenced by CSG::CSGBase::addCellToList(), CSG::CSGCell::getFillLattice(), CSG::CSGCell::getFillMaterial(), CSG::CSGCell::getFillName(), CSG::CSGCell::getFillUniverse(), CSG::CSGCell::operator==(), and CSG::CSGBase::replaceUniverseRefs().

77 { return _fill_type; }
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:187

◆ getFillUniverse()

const CSGUniverse & CSG::CSGCell::getFillUniverse ( ) const
inherited

Get the cell fill if fill type is UNIVERSE.

Returns
Reference to CSGUniverse fill

Definition at line 59 of file CSGCell.C.

Referenced by CSG::CSGBase::addCellToList(), CSG::CSGCell::operator==(), and CSG::CSGBase::replaceUniverseRefs().

60 {
61  if (getFillType() != "UNIVERSE")
62  mooseError("Cell '" + getName() + "' has " + getFillType() + " fill, not UNIVERSE.");
63  else
64  return *_fill_universe;
65 }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:196

◆ getName()

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

Satisfy CSGEngUnit::getName() (resolved via CSGCell::getName())

Implements CSG::CSGEngUnit.

Definition at line 42 of file CSGCellEngUnit.h.

Referenced by CSG::CSGBase::expandEngUnit(), and getExpandedCell().

42 { return CSGCell::getName(); }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112

◆ getRegion()

const CSGRegion& CSG::CSGCell::getRegion ( ) const
inlineinherited

Get the cell region.

Returns
const CSGRegion& region of the cell

Definition at line 119 of file CSGCell.h.

Referenced by CSG::CSGBase::addCellToList(), CSG::CSGCell::operator==(), and CSG::CSGBase::replaceSurfaceRefsWithRegion().

119 { return _region; }
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:193

◆ getTransformations()

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

Delegate to CSGCell (CSGTransformationHelper)

Implements CSG::CSGEngUnit.

Definition at line 52 of file CSGCellEngUnit.h.

53  {
55  }
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::CSGCellEngUnit::getTransformationsAsStrings ( ) const
inlineoverridevirtual

Delegate to CSGCell (CSGTransformationHelper)

Implements CSG::CSGEngUnit.

Definition at line 59 of file CSGCellEngUnit.h.

60  {
62  }
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 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::CSGCellEngUnit::isEngUnit ( ) const
inlineoverridevirtual

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

Reimplemented from CSG::CSGCell.

Definition at line 45 of file CSGCellEngUnit.h.

45 { 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::CSGCellEngUnit::operator!= ( const CSGCellEngUnit other) const
inline

Definition at line 49 of file CSGCellEngUnit.h.

49 { 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 operator!=(), CSG::CSGUniverseEngUnit::operator!=(), and CSG::CSGSurfaceEngUnit::operator!=().

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

◆ operator!=() [3/3]

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

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

Definition at line 159 of file CSGCell.C.

160 {
161  return !(*this == other);
162 }

◆ operator==() [1/3]

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

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

Definition at line 48 of file CSGCellEngUnit.h.

48 { 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==() [2/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 operator==(), CSG::CSGUniverseEngUnit::operator==(), and CSG::CSGSurfaceEngUnit::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==() [3/3]

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

Operator overload for checking if two CSGCell objects are equal.

Definition at line 126 of file CSGCell.C.

127 {
128  // If both objects are engineering units, delegate to CSGEngUnit::operator==. The
129  // isEngUnit() check keeps the common plain-cell path free of any dynamic_cast;
130  // the casts below only run once we know the objects are engineering units.
131  if (isEngUnit())
132  {
133  if (other.isEngUnit())
134  return *dynamic_cast<const CSGEngUnit *>(this) == *dynamic_cast<const CSGEngUnit *>(&other);
135  return false; // an engineering unit cannot equal a plain cell
136  }
137 
138  const auto name_eq = this->getName() == other.getName();
139  const auto region_eq = this->getRegion() == other.getRegion();
140  const auto fill_type_eq =
141  (this->getFillType() == other.getFillType()) && (this->getFillName() == other.getFillName());
142  const auto transformations_eq = this->getTransformations() == other.getTransformations();
143  if (name_eq && region_eq && fill_type_eq && transformations_eq)
144  {
145  if (this->getFillType() == "CSG_MATERIAL")
146  return this->getFillMaterial() == other.getFillMaterial();
147  else if (this->getFillType() == "UNIVERSE")
148  return this->getFillUniverse() == other.getFillUniverse();
149  else if (this->getFillType() == "LATTICE")
150  return this->getFillLattice() == other.getFillLattice();
151  else
152  return true;
153  }
154  else
155  return false;
156 }
const CSGLattice & getFillLattice() const
Get the cell fill if fill type is LATTICE.
Definition: CSGCell.C:77
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
Definition: CSGCell.C:59
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
const std::string & getFillName() const
Get the name of the fill, regardless of its type.
Definition: CSGCell.C:48
const CSGRegion & getRegion() const
Get the cell region.
Definition: CSGCell.h:119
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:68
virtual bool isEngUnit() const
Whether this cell is an engineering unit.
Definition: CSGCell.h:136
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

◆ resetCellFill()

void CSG::CSGCellEngUnit::resetCellFill ( )
protecteddelete

Cell fill and region updates are not permitted on engineering units.

The geometry is defined by the derived class and produced only via expandUnit().

◆ setName()

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

Definition at line 147 of file CSGCell.h.

147 { _name = name; }
std::string name(const ElemQuality q)
std::string _name
Name of surface.
Definition: CSGCell.h:184

◆ updateCellFill() [1/3]

void CSG::CSGCellEngUnit::updateCellFill ( const std::string &  )
protecteddelete

◆ updateCellFill() [2/3]

void CSG::CSGCellEngUnit::updateCellFill ( const CSGUniverse )
protecteddelete

◆ updateCellFill() [3/3]

void CSG::CSGCellEngUnit::updateCellFill ( const CSGLattice )
protecteddelete

◆ updateCellRegionSurfaces()

void CSG::CSGCell::updateCellRegionSurfaces ( std::map< std::string, std::reference_wrapper< const CSGSurface >> &  identical_surface_refs)
protectedinherited

Update surface references of cell region based on map of input surface references.

Parameters
identical_surface_refsmap of surface name to surface references that region should be defined with

Definition at line 119 of file CSGCell.C.

121 {
122  _region.updateSurfaceReferences(identical_surface_refs);
123 }
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:193
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.
Definition: CSGRegion.C:275

◆ updateRegion()

void CSG::CSGCellEngUnit::updateRegion ( const CSGRegion )
protecteddelete

Friends And Related Function Documentation

◆ CSGBase

friend class CSGBase
friend

Definition at line 117 of file CSGCellEngUnit.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().

◆ _fill_lattice

const CSGLattice* CSG::CSGCell::_fill_lattice
protectedinherited

◆ _fill_name

std::string CSG::CSGCell::_fill_name
protectedinherited

name of the fill object for CSG_MATERIAL fills

Definition at line 190 of file CSGCell.h.

Referenced by CSG::CSGCell::getFillMaterial(), CSG::CSGCell::getFillName(), CSG::CSGCell::resetCellFill(), and CSG::CSGCell::updateCellFill().

◆ _fill_type

MooseEnum CSG::CSGCell::_fill_type {"VOID CSG_MATERIAL UNIVERSE LATTICE"}
protectedinherited

An enum for type of fill for cell region.

Definition at line 187 of file CSGCell.h.

Referenced by CSG::CSGCell::CSGCell(), CSG::CSGCell::getFillType(), CSG::CSGCell::resetCellFill(), and CSG::CSGCell::updateCellFill().

◆ _fill_universe

const CSGUniverse* CSG::CSGCell::_fill_universe
protectedinherited

◆ _internal_base

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

◆ _name

std::string CSG::CSGCell::_name
protectedinherited

Name of surface.

Definition at line 184 of file CSGCell.h.

Referenced by CSG::CSGCell::getName(), and CSG::CSGCell::setName().

◆ _region

CSGRegion CSG::CSGCell::_region
protectedinherited

Cell region, represented as a CSGRegion object.

Definition at line 193 of file CSGCell.h.

Referenced by CSG::CSGCell::getRegion(), CSG::CSGCell::updateCellRegionSurfaces(), and CSG::CSGCell::updateRegion().

◆ _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: