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

CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system. More...

#include <CSGEngUnit.h>

Inheritance diagram for CSG::CSGEngUnit:
[legend]

Public Member Functions

virtual ~CSGEngUnit ()
 
virtual const std::string & getName () const =0
 Get the unique instance name of this engineering unit. 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...
 
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. More...
 
virtual std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings () const =0
 Get the transformations with string representations for types. 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...
 

Protected Member Functions

 CSGEngUnit (const std::string &behavior)
 Constructor for intermediate EngUnit abstract classes. More...
 
virtual void expandUnit ()=0
 Expand this engineering unit into basic CSG objects stored in _internal_base. 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...
 

Protected Attributes

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

CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system.

It captures the interface shared by CSGSurfaceEngUnit, CSGCellEngUnit, and CSGUniverseEngUnit: a name, a domain-specific attribute map, and a protected expandUnit() method that is called exclusively by CSGBase to convert the EngUnit into equivalent basic CSG objects.

Derived classes (CSGSurfaceEngUnit, CSGCellEngUnit, CSGUniverseEngUnit) further specialise the expansion contract for their respective CSG object types and allow the units to act as those basic types during CSGBase object creation.

Definition at line 32 of file CSGEngUnit.h.

Constructor & Destructor Documentation

◆ ~CSGEngUnit()

CSG::CSGEngUnit::~CSGEngUnit ( )
virtualdefault

◆ CSGEngUnit()

CSG::CSGEngUnit::CSGEngUnit ( const std::string &  behavior)
protected

Constructor for intermediate EngUnit abstract classes.

Parameters
behaviorthe basic CSG type this unit produces. Must be "SURFACE", "CELL", or "UNIVERSE"; set by the intermediate class, not the concrete derived class

Definition at line 18 of file CSGEngUnit.C.

18  : _internal_base(std::make_unique<CSGBase>())
19 {
20  _behavior = behavior;
21 }
std::unique_ptr< CSGBase > _internal_base
CSGBase populated by expandUnit(); joined into the parent CSGBase by expandEngUnit() ...
Definition: CSGEngUnit.h:130
MooseEnum _behavior
The basic CSG type this unit produces: "SURFACE", "CELL", or "UNIVERSE".
Definition: CSGEngUnit.h:133

Member Function Documentation

◆ expandUnit()

virtual void CSG::CSGEngUnit::expandUnit ( )
protectedpure virtual

Expand this engineering unit into basic CSG objects stored in _internal_base.

Called exclusively by CSGBase via the typed expandEngUnit() overloads. The implementation must create all necessary basic CSG objects by calling the appropriate methods on _internal_base (e.g., _internal_base->addSurface(...), _internal_base->createCell(...)). CSGBase::expandEngUnit() then joins _internal_base into the parent CSGBase after this method returns.

Implemented in CSG::CSGNPolygonUnit, CSG::CSGSurfaceEngUnit, CSG::CSGCellEngUnit, and CSG::CSGUniverseEngUnit.

◆ getAttributes()

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

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 operator==().

◆ getBase()

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

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
inline

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 operator==().

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

◆ getName()

virtual const std::string& CSG::CSGEngUnit::getName ( ) const
pure virtual

Get the unique instance name of this engineering unit.

Satisfied by the getName() inherited from the corresponding CSG base class (CSGSurface, CSGCell, or CSGUniverse) via the disambiguation override in each intermediate EngUnit class.

Returns
const reference to the instance name string

Implemented in CSG::CSGSurfaceEngUnit, CSG::CSGCellEngUnit, and CSG::CSGUniverseEngUnit.

Referenced by CSG::CSGEngUnitList::addEngUnit(), CSG::CSGBase::addTransformation(), CSG::CSGBase::checkEngUnitInBase(), CSG::CSGBase::deleteEngUnit(), operator==(), and CSG::CSGBase::renameEngUnit().

◆ getTransformations()

virtual const std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real> > >& CSG::CSGEngUnit::getTransformations ( ) const
pure virtual

Get the list of transformations applied to this engineering unit.

Implemented in CSG::CSGSurfaceEngUnit, CSG::CSGUniverseEngUnit, and CSG::CSGCellEngUnit.

Referenced by operator==().

◆ getTransformationsAsStrings()

virtual std::vector<std::pair<std::string, std::tuple<Real, Real, Real> > > CSG::CSGEngUnit::getTransformationsAsStrings ( ) const
pure virtual

Get the transformations with string representations for types.

Implemented in CSG::CSGSurfaceEngUnit, CSG::CSGUniverseEngUnit, and CSG::CSGCellEngUnit.

◆ getUnitType()

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

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

◆ operator!=()

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

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 CSG::CSGSurfaceEngUnit::operator!=().

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

◆ operator==()

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

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 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.

◆ releaseBase()

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

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

Friends And Related Function Documentation

◆ CSGBase

friend class CSGBase
friend

Definition at line 135 of file CSGEngUnit.h.

Member Data Documentation

◆ _behavior

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

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

Definition at line 133 of file CSGEngUnit.h.

Referenced by CSGEngUnit(), and getBehavior().

◆ _internal_base

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

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