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

CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell, which represents a region of space filled by a material or void. More...

#include <CSGCell.h>

Public Member Functions

 CSGCell (const std::string &name, const CSGRegion &region)
 Constructor for void cell. More...
 
 CSGCell (const std::string &name, const std::string &mat_name, const CSGRegion &region)
 Constructor for Material Cell. More...
 
 CSGCell (const std::string &name, const CSGUniverse *univ, const CSGRegion &region)
 Constructor for Universe Cell. More...
 
virtual ~CSGCell ()=default
 Destructor. 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 std::string & getFillName () const
 Get the name of the fill, regardless of its type. More...
 
const std::string & getName () const
 Get the cell name. More...
 
const CSGRegiongetRegion () const
 Get the cell region. More...
 
const std::string & getRegionAsString () const
 Get the string representation of 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...
 

Protected Member Functions

void setName (const std::string &name)
 
void updateRegion (const CSGRegion &region)
 
 FRIEND_TEST (CSGCellTest, testSetName)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGCellTest, testUpdateRegion)
 

Protected Attributes

std::string _name
 Name of surface. More...
 
MooseEnum _fill_type {"VOID CSG_MATERIAL UNIVERSE"}
 An enum for type of fill for cell region. More...
 
std::string _fill_name
 name of the fill object More...
 
CSGRegion _region
 Cell region, represented as a CSGRegion object. More...
 
const CSGUniverse_fill_universe
 Fill object if fill is CSGUniverse. More...
 

Friends

class CSGCellList
 
class CSGBase
 

Detailed Description

CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell, which represents a region of space filled by a material or void.

Definition at line 27 of file CSGCell.h.

Constructor & Destructor Documentation

◆ CSGCell() [1/3]

CSG::CSGCell::CSGCell ( const std::string &  name,
const CSGRegion region 
)

Constructor for void cell.

Parameters
namename of cell
regioncell region

Definition at line 16 of file CSGCell.C.

16  : _name(name), _region(region)
17 {
18  _fill_type = "VOID";
19 }
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:130
std::string _name
Name of surface.
Definition: CSGCell.h:126
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136

◆ CSGCell() [2/3]

CSG::CSGCell::CSGCell ( const std::string &  name,
const std::string &  mat_name,
const CSGRegion region 
)

Constructor for Material Cell.

Parameters
namename of cell
mat_namename of the CSG material (not a MOOSE material) to use as the cell fill
regioncell region

Definition at line 21 of file CSGCell.C.

22  : _name(name), _fill_name(mat_name), _region(region)
23 {
24  _fill_type = "CSG_MATERIAL";
25 }
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:130
std::string _name
Name of surface.
Definition: CSGCell.h:126
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136
std::string _fill_name
name of the fill object
Definition: CSGCell.h:133

◆ CSGCell() [3/3]

CSG::CSGCell::CSGCell ( const std::string &  name,
const CSGUniverse univ,
const CSGRegion region 
)

Constructor for Universe Cell.

Parameters
namename of cell
univuniverse to be the fill
regioncell region

Definition at line 27 of file CSGCell.C.

28  : _name(name), _fill_name(univ->getName()), _region(region), _fill_universe(univ)
29 {
30  _fill_type = "UNIVERSE";
31 }
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:130
std::string _name
Name of surface.
Definition: CSGCell.h:126
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136
std::string _fill_name
name of the fill object
Definition: CSGCell.h:133
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:139

◆ ~CSGCell()

virtual CSG::CSGCell::~CSGCell ( )
virtualdefault

Destructor.

Member Function Documentation

◆ FRIEND_TEST() [1/2]

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

Friends for unit testing.

◆ FRIEND_TEST() [2/2]

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

◆ getFillMaterial()

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

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

Returns
name of the cell's CSG material fill

Definition at line 43 of file CSGCell.C.

Referenced by operator==().

44 {
45  if (getFillType() != "CSG_MATERIAL")
46  mooseError("Cell '" + getName() + "' has " + getFillType() + " fill, not CSG_MATERIAL.");
47  else
48  return _fill_name;
49 }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:94
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:66
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
std::string _fill_name
name of the fill object
Definition: CSGCell.h:133

◆ getFillName()

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

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

Returns
std::string fill name

Definition at line 87 of file CSGCell.h.

Referenced by operator==().

87 { return _fill_name; }
std::string _fill_name
name of the fill object
Definition: CSGCell.h:133

◆ getFillType()

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

Get the type of fill for the cell.

Returns
fill type

Definition at line 66 of file CSGCell.h.

Referenced by getFillMaterial(), getFillUniverse(), and operator==().

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

◆ getFillUniverse()

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

Get the cell fill if fill type is UNIVERSE.

Returns
Reference to CSGUniverse fill

Definition at line 34 of file CSGCell.C.

Referenced by operator==().

35 {
36  if (getFillType() != "UNIVERSE")
37  mooseError("Cell '" + getName() + "' has " + getFillType() + " fill, not UNIVERSE.");
38  else
39  return *_fill_universe;
40 }
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:94
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:66
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:323
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:139

◆ getName()

const std::string& CSG::CSGCell::getName ( ) const
inline

◆ getRegion()

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

Get the cell region.

Returns
const CSGRegion& region of the cell

Definition at line 101 of file CSGCell.h.

Referenced by operator==().

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

◆ getRegionAsString()

const std::string& CSG::CSGCell::getRegionAsString ( ) const
inline

Get the string representation of the cell region.

Returns
std::string string representation of the cell region

Definition at line 108 of file CSGCell.h.

108 { return _region.toString(); }
const std::string & toString() const
gets the string representation of the region
Definition: CSGRegion.h:76
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136

◆ operator!=()

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

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

Definition at line 72 of file CSGCell.C.

73 {
74  return !(*this == other);
75 }

◆ operator==()

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

Operator overload for checking if two CSGCell objects are equal.

Definition at line 52 of file CSGCell.C.

53 {
54  const auto name_eq = this->getName() == other.getName();
55  const auto region_eq = this->getRegion() == other.getRegion();
56  const auto fill_type_eq =
57  (this->getFillType() == other.getFillType()) && (this->getFillName() == other.getFillName());
58  if (name_eq && region_eq && fill_type_eq)
59  {
60  if (this->getFillType() == "CSG_MATERIAL")
61  return this->getFillMaterial() == other.getFillMaterial();
62  else if (this->getFillType() == "UNIVERSE")
63  return this->getFillUniverse() == other.getFillUniverse();
64  else
65  return true;
66  }
67  else
68  return false;
69 }
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
Definition: CSGCell.C:34
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:94
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:66
const std::string & getFillName() const
Get the name of the fill, regardless of its type.
Definition: CSGCell.h:87
const CSGRegion & getRegion() const
Get the cell region.
Definition: CSGCell.h:101
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:43

◆ setName()

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

Definition at line 119 of file CSGCell.h.

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

◆ updateRegion()

void CSG::CSGCell::updateRegion ( const CSGRegion region)
inlineprotected

Definition at line 123 of file CSGCell.h.

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

123 { _region = region; }
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136

Friends And Related Function Documentation

◆ CSGBase

friend class CSGBase
friend

Definition at line 142 of file CSGCell.h.

◆ CSGCellList

friend class CSGCellList
friend

Definition at line 141 of file CSGCell.h.

Member Data Documentation

◆ _fill_name

std::string CSG::CSGCell::_fill_name
protected

name of the fill object

Definition at line 133 of file CSGCell.h.

Referenced by getFillMaterial(), and getFillName().

◆ _fill_type

MooseEnum CSG::CSGCell::_fill_type {"VOID CSG_MATERIAL UNIVERSE"}
protected

An enum for type of fill for cell region.

Definition at line 130 of file CSGCell.h.

Referenced by CSGCell(), and getFillType().

◆ _fill_universe

const CSGUniverse* CSG::CSGCell::_fill_universe
protected

Fill object if fill is CSGUniverse.

Definition at line 139 of file CSGCell.h.

Referenced by getFillUniverse().

◆ _name

std::string CSG::CSGCell::_name
protected

Name of surface.

Definition at line 126 of file CSGCell.h.

Referenced by getName(), and setName().

◆ _region

CSGRegion CSG::CSGCell::_region
protected

Cell region, represented as a CSGRegion object.

Definition at line 136 of file CSGCell.h.

Referenced by getRegion(), getRegionAsString(), and updateRegion().


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