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

CSGHexagonalLattice is the class for constructing hexagonal lattices of CSGUniverses arranged in concentric hexagonal rings. More...

#include <CSGHexagonalLattice.h>

Inheritance diagram for CSG::CSGHexagonalLattice:
[legend]

Public Member Functions

 CSGHexagonalLattice (const std::string &name, Real pitch, std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes, const std::optional< OuterVariant > &outer=std::nullopt)
 Construct a new CSGHexagonalLattice from a map of universes. More...
 
 CSGHexagonalLattice (const std::string &name, Real pitch, const std::optional< OuterVariant > &outer=std::nullopt)
 Construct a new empty CSGHexagonalLattice with the specified pitch. More...
 
virtual ~CSGHexagonalLattice ()=default
 Destructor. More...
 
std::unique_ptr< CSGLatticeclone () const override
 clone this hexagonal lattice More...
 
virtual std::unordered_map< std::string, AttributeVariantgetAttributes () const override
 Get attributes that define the lattice (excluding the universe map). More...
 
virtual bool isValidIndex (const std::pair< int, int > index) const override
 check if provided index in row-column form is valid for the given hexagonal lattice More...
 
virtual bool isValidUniverseMap (std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes) const override
 check if the arrangement of the provided universes is valid for the hexagonal lattice given the number or rows/rings defined for the lattice. More...
 
unsigned int getNRows () const
 get number of rows in the lattices More...
 
unsigned int getNRings () const
 get number of rings in the lattice More...
 
std::pair< int, intgetRowIndexFromRingIndex (const std::pair< int, int > &row_col_index) const
 Given an index in ring-position form, get the corresponding row-column index. More...
 
std::pair< int, intgetRingIndexFromRowIndex (const std::pair< int, int > &row_col_index) const
 Given an index in row-column form, get the corresponding ring-position index. More...
 
Real getPitch () const
 get the pitch of the lattice More...
 
void setPitch (Real pitch)
 set the pitch of the lattice More...
 
const std::string & getName () const
 Get the name of lattice. More...
 
const std::string & getType () const
 Get the lattice type. More...
 
const std::string getOuterType () const
 Get the type of outer that fills the space around the lattice elements. More...
 
const CSGUniversegetOuterUniverse () const
 Get the outer universe if outer type is UNIVERSE. More...
 
const std::string & getOuterMaterial () const
 Get the outer material name if outer fype is CSG_MATERIAL. More...
 
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > getUniverses () const
 Get the arrangement of CSGUniverses in the lattice. More...
 
const std::vector< std::vector< std::string > > getUniverseNameMap () const
 Get the arrangement of CSGUniverses in the lattice as their names. More...
 
bool hasUniverse (const std::string &name) const
 whether or not the universe of the specified name exists in the lattice More...
 
const CSGUniversegetUniverseAtIndex (const std::pair< int, int > index)
 Get the universe located at the given index. More...
 
const std::vector< std::pair< unsigned int, unsigned int > > getUniverseIndices (const std::string &univ_name) const
 get all locations in lattice where universe of the specified name exists More...
 
void resetOuter ()
 reset the outer fill around the lattice elements to be VOID More...
 
const std::vector< std::reference_wrapper< const CSGUniverse > > getUniqueUniverses () const
 Get the list of unique universe objects in the lattice. More...
 
bool operator== (const CSGLattice &other) const
 Operator overload for checking if two CSGLattice objects are equal. More...
 
bool operator!= (const CSGLattice &other) const
 Operator overload for checking if two CSGLattice objects are not equal. More...
 
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations () const
 Get the list of transformations. More...
 
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings () const
 Get the transformations of this object with string representations for types. 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

virtual bool compareAttributes (const CSGLattice &other) const override
 compare the attributes returned in getAttributes of this lattice to another lattice More...
 
void buildIndexMap ()
 build a mapping of row-column indices to ring-position indices for quick conversion and look-up. More...
 
virtual void setUniverses (std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes) override
 set the universes that define the lattice layout More...
 
void setName (const std::string &name)
 
void setUniverseAtIndex (const CSGUniverse &universe, const std::pair< int, int > index)
 replace the element at specified index in the lattice with the provided CSGUniverse. More...
 
void updateOuter (const std::string &outer_name)
 Update the outer of the lattice to be the provided material name. More...
 
void updateOuter (const CSGUniverse &outer_universe)
 Update the outer of the lattice to be the provided universe. 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...
 
 FRIEND_TEST (CSGLatticeTest, testHexSetUniverses)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGLatticeTest, testConvertRowsRings)
 
 FRIEND_TEST (CSGLatticeTest, testSetName)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGLatticeTest, testUpdateOuter)
 
 FRIEND_TEST (CSGBaseTest, testAddLattice)
 
 FRIEND_TEST (CSGLatticeTest, testCartLatticeEquality)
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithTransform)
 Friends for unit testing. More...
 
 FRIEND_TEST (CSGSurfaceTest, testHalfspaceWithNullTransform)
 

Protected Attributes

Real _pitch
 lattice pitch (flat-to-flat distance between adjacent hex elements) More...
 
unsigned int _nrow
 number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings More...
 
unsigned int _nring
 number of rings in the hexagonal lattice, should be consistent with the number of rows More...
 
std::map< std::pair< unsigned int, unsigned int >, std::pair< unsigned int, unsigned int > > _row_to_ring_map
 map of row-column indices to ring-position indices for quick conversion and look-up More...
 
std::string _name
 Name of lattice. More...
 
const std::string _lattice_type
 Type of lattice. More...
 
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
 Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type. More...
 
std::string _outer_type
 An enum for type of outer fill for lattice. More...
 
std::string _outer_material
 name of the outer material More...
 
const CSGUniverse_outer_universe
 outer object if fill is CSGUniverse More...
 
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
 List of transformations applied to this object. More...
 

Detailed Description

CSGHexagonalLattice is the class for constructing hexagonal lattices of CSGUniverses arranged in concentric hexagonal rings.

Definition at line 25 of file CSGHexagonalLattice.h.

Constructor & Destructor Documentation

◆ CSGHexagonalLattice() [1/2]

CSG::CSGHexagonalLattice::CSGHexagonalLattice ( const std::string &  name,
Real  pitch,
std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>>  universes,
const std::optional< OuterVariant > &  outer = std::nullopt 
)

Construct a new CSGHexagonalLattice from a map of universes.

Universes should be arranged by rows and correspond to a hexagonal lattice with x-orientation.

Parameters
nameunique identifying name of lattice
pitchflat-to-flat distance for one hexagonal lattice element
universesrow-wise ragged vector of universes representing hex pattern
outeroptional outer universe or material name that fills space around lattice elements. If not provided, outer is assumed to be VOID.

Definition at line 15 of file CSGHexagonalLattice.C.

20  : CSGLattice(name, MooseUtils::prettyCppType<CSGHexagonalLattice>(), outer), _pitch(pitch)
21 {
22  setUniverses(universes); // this will set _nrow
23  if (_pitch < 0)
24  mooseError("Lattice " + getName() + " must have pitch greater than 0.");
25 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGLattice(const std::string &name, const std::string &lattice_type, const std::optional< OuterVariant > &outer=std::nullopt)
Construct a new CSGLattice of specific type.
Definition: CSGLattice.C:16
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
Real _pitch
lattice pitch (flat-to-flat distance between adjacent hex elements)
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes) override
set the universes that define the lattice layout

◆ CSGHexagonalLattice() [2/2]

CSG::CSGHexagonalLattice::CSGHexagonalLattice ( const std::string &  name,
Real  pitch,
const std::optional< OuterVariant > &  outer = std::nullopt 
)

Construct a new empty CSGHexagonalLattice with the specified pitch.

NOTE: must call setLatticeUniverses to populate universe map.

Parameters
nameunique identifying name of lattice
pitchflat-to-flat distance for one hexagonal lattice element
outeroptional outer universe or material name that fills space around lattice elements. If not provided, outer is assumed to be VOID.

Definition at line 27 of file CSGHexagonalLattice.C.

30  : CSGLattice(name, MooseUtils::prettyCppType<CSGHexagonalLattice>(), outer),
31  _pitch(pitch),
32  _nrow(0),
33  _nring(0)
34 {
35  if (_pitch < 0)
36  mooseError("Lattice " + getName() + " must have pitch greater than 0.");
37 }
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
CSGLattice(const std::string &name, const std::string &lattice_type, const std::optional< OuterVariant > &outer=std::nullopt)
Construct a new CSGLattice of specific type.
Definition: CSGLattice.C:16
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
Real _pitch
lattice pitch (flat-to-flat distance between adjacent hex elements)
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ ~CSGHexagonalLattice()

virtual CSG::CSGHexagonalLattice::~CSGHexagonalLattice ( )
virtualdefault

Destructor.

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.

18 {
19  if (!isValidTransformationValue(type, values))
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.

◆ 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
void scale(MeshBase &mesh, const Real xs, const Real ys=0., const Real zs=0.)
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)

◆ buildIndexMap()

void CSG::CSGHexagonalLattice::buildIndexMap ( )
protected

build a mapping of row-column indices to ring-position indices for quick conversion and look-up.

Sets the _row_to_ring_map variable.

Definition at line 129 of file CSGHexagonalLattice.C.

Referenced by setUniverses().

130 {
131  for (const auto ring : make_range(_nring))
132  {
133  unsigned int num_elements = (ring == _nring - 1) ? 1 : 6 * (_nring - 1 - ring);
134  for (const auto element : make_range(num_elements))
135  {
136  std::pair<unsigned int, unsigned int> ring_index = std::make_pair(ring, element);
137  std::pair<unsigned int, unsigned int> row_index = getRowIndexFromRingIndex(ring_index);
138  _row_to_ring_map[row_index] = ring_index;
139  }
140  }
141 }
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...
std::map< std::pair< unsigned int, unsigned int >, std::pair< unsigned int, unsigned int > > _row_to_ring_map
map of row-column indices to ring-position indices for quick conversion and look-up ...
IntRange< T > make_range(T beg, T end)
std::pair< int, int > getRowIndexFromRingIndex(const std::pair< int, int > &row_col_index) const
Given an index in ring-position form, get the corresponding row-column index.

◆ clone()

std::unique_ptr<CSGLattice> CSG::CSGHexagonalLattice::clone ( ) const
inlineoverridevirtual

clone this hexagonal lattice

Returns
std::unique_ptr<CSGLattice> unique pointer to cloned hexagonal lattice

Implements CSG::CSGLattice.

Definition at line 66 of file CSGHexagonalLattice.h.

67  {
68  return std::make_unique<CSGHexagonalLattice>(*this);
69  }

◆ compareAttributes()

bool CSG::CSGHexagonalLattice::compareAttributes ( const CSGLattice other) const
overrideprotectedvirtual

compare the attributes returned in getAttributes of this lattice to another lattice

Implements CSG::CSGLattice.

Definition at line 112 of file CSGHexagonalLattice.C.

113 {
114  if (other.getType() != this->getType())
115  return false;
116 
117  auto this_dims = this->getAttributes();
118  auto other_dims = other.getAttributes();
119  if (std::get<unsigned int>(this_dims["nrow"]) != std::get<unsigned int>(other_dims["nrow"]))
120  return false;
121  if (std::get<unsigned int>(this_dims["nring"]) != std::get<unsigned int>(other_dims["nring"]))
122  return false;
123  if (std::get<Real>(this_dims["pitch"]) != std::get<Real>(other_dims["pitch"]))
124  return false;
125  return true;
126 }
const std::string & getType() const
Get the lattice type.
Definition: CSGLattice.h:69
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const override
Get attributes that define the lattice (excluding the universe map).

◆ FRIEND_TEST() [1/8]

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

Friends for unit testing.

◆ FRIEND_TEST() [2/8]

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

◆ FRIEND_TEST() [3/8]

CSG::CSGHexagonalLattice::FRIEND_TEST ( CSGLatticeTest  ,
testHexSetUniverses   
)
protected

Friends for unit testing.

◆ FRIEND_TEST() [4/8]

CSG::CSGHexagonalLattice::FRIEND_TEST ( CSGLatticeTest  ,
testConvertRowsRings   
)
protected

◆ FRIEND_TEST() [5/8]

CSG::CSGLattice::FRIEND_TEST ( CSGLatticeTest  ,
testSetName   
)
protectedinherited

Friends for unit testing.

◆ FRIEND_TEST() [6/8]

CSG::CSGLattice::FRIEND_TEST ( CSGLatticeTest  ,
testUpdateOuter   
)
protectedinherited

◆ FRIEND_TEST() [7/8]

CSG::CSGLattice::FRIEND_TEST ( CSGBaseTest  ,
testAddLattice   
)
protectedinherited

◆ FRIEND_TEST() [8/8]

CSG::CSGLattice::FRIEND_TEST ( CSGLatticeTest  ,
testCartLatticeEquality   
)
protectedinherited

◆ getAttributes()

std::unordered_map< std::string, AttributeVariant > CSG::CSGHexagonalLattice::getAttributes ( ) const
overridevirtual

Get attributes that define the lattice (excluding the universe map).

  • nrow: number of rows in the hex lattice (int)
  • pitch: pitch of the lattice element (Real)
Returns
map of string dimension name to value of that dimension

Implements CSG::CSGLattice.

Definition at line 86 of file CSGHexagonalLattice.C.

Referenced by compareAttributes().

87 {
88  return {{"nrow", static_cast<unsigned int>(_nrow)},
89  {"nring", static_cast<unsigned int>(_nring)},
90  {"pitch", _pitch}};
91 }
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...
Real _pitch
lattice pitch (flat-to-flat distance between adjacent hex elements)
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ getName()

const std::string& CSG::CSGLattice::getName ( ) const
inlineinherited

◆ getNRings()

unsigned int CSG::CSGHexagonalLattice::getNRings ( ) const
inline

get number of rings in the lattice

Returns
number of rings

Definition at line 111 of file CSGHexagonalLattice.h.

111 { return _nring; }
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...

◆ getNRows()

unsigned int CSG::CSGHexagonalLattice::getNRows ( ) const
inline

get number of rows in the lattices

Returns
number of rows

Definition at line 104 of file CSGHexagonalLattice.h.

104 { return _nrow; }
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ getOuterMaterial()

const std::string & CSG::CSGLattice::getOuterMaterial ( ) const
inherited

Get the outer material name if outer fype is CSG_MATERIAL.

Returns
name of the CSG material fill

Definition at line 120 of file CSGLattice.C.

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

121 {
122  if (getOuterType() != "CSG_MATERIAL")
123  mooseError("Lattice '" + getName() + "' has " + getOuterType() + " outer, not CSG_MATERIAL.");
124  else
125  return _outer_material;
126 }
std::string _outer_material
name of the outer material
Definition: CSGLattice.h:231
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
Get the name of lattice.
Definition: CSGLattice.h:62
const std::string getOuterType() const
Get the type of outer that fills the space around the lattice elements.
Definition: CSGLattice.h:76

◆ getOuterType()

const std::string CSG::CSGLattice::getOuterType ( ) const
inlineinherited

Get the type of outer that fills the space around the lattice elements.

Returns
string of outer type: CSG_MATERIAL, UNIVERSE, or VOID

Definition at line 76 of file CSGLattice.h.

Referenced by CSG::CSGBase::addLatticeToList(), CSG::CSGLattice::getOuterMaterial(), CSG::CSGLattice::getOuterUniverse(), and CSG::CSGLattice::operator==().

76 { return _outer_type; }
std::string _outer_type
An enum for type of outer fill for lattice.
Definition: CSGLattice.h:228

◆ getOuterUniverse()

const CSGUniverse & CSG::CSGLattice::getOuterUniverse ( ) const
inherited

Get the outer universe if outer type is UNIVERSE.

Returns
Reference to CSGUniverse

Definition at line 111 of file CSGLattice.C.

Referenced by CSG::CSGBase::addLatticeToList(), and CSG::CSGLattice::operator==().

112 {
113  if (getOuterType() != "UNIVERSE")
114  mooseError("Lattice '" + getName() + "' has " + getOuterType() + " outer, not UNIVERSE.");
115  else
116  return *_outer_universe;
117 }
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
Get the name of lattice.
Definition: CSGLattice.h:62
const CSGUniverse * _outer_universe
outer object if fill is CSGUniverse
Definition: CSGLattice.h:234
const std::string getOuterType() const
Get the type of outer that fills the space around the lattice elements.
Definition: CSGLattice.h:76

◆ getPitch()

Real CSG::CSGHexagonalLattice::getPitch ( ) const
inline

get the pitch of the lattice

Returns
pitch

Definition at line 172 of file CSGHexagonalLattice.h.

172 { return _pitch; }
Real _pitch
lattice pitch (flat-to-flat distance between adjacent hex elements)

◆ getRingIndexFromRowIndex()

std::pair< int, int > CSG::CSGHexagonalLattice::getRingIndexFromRowIndex ( const std::pair< int, int > &  row_col_index) const

Given an index in row-column form, get the corresponding ring-position index.

The row-column form assumes the top row is the 0th row and is indexed from left to right. The ring-position form assumes the outermost ring is the 0th ring and is indexed starting from the rightmost position of the ring and proceeding counter-clockwise around the ring.

Example of corresponding indices for a hexagonal lattice with 3 rings (5 rows):

Row-Column Form: (0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) (2,4) (3,0) (3,1) (3,2) (3,3) (4,0) (4,1) (4,2)

Ring-Position Form: (0,8) (0,9) (0,10) (0,7) (1,4) (1,5) (0,11) (0,6) (1,3) (2,0) (1,0) (0,0) (0,5) (1,2) (1,1) (0,1) (0,4) (0,3) (0,2)

Parameters
indexin row-column form
Returns
index in ring-position form

Definition at line 224 of file CSGHexagonalLattice.C.

225 {
226  if (!isValidIndex(row_col_index))
227  mooseError("Index (" + std::to_string(row_col_index.first) + ", " +
228  std::to_string(row_col_index.second) +
229  ") is not a valid index for hexagonal "
230  "lattice " +
231  getName());
232 
233  return _row_to_ring_map.at(row_col_index);
234 }
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
Get the name of lattice.
Definition: CSGLattice.h:62
std::map< std::pair< unsigned int, unsigned int >, std::pair< unsigned int, unsigned int > > _row_to_ring_map
map of row-column indices to ring-position indices for quick conversion and look-up ...
virtual bool isValidIndex(const std::pair< int, int > index) const override
check if provided index in row-column form is valid for the given hexagonal lattice ...

◆ getRowIndexFromRingIndex()

std::pair< int, int > CSG::CSGHexagonalLattice::getRowIndexFromRingIndex ( const std::pair< int, int > &  row_col_index) const

Given an index in ring-position form, get the corresponding row-column index.

The ring-position form assumes the outermost ring is the 0th ring and is indexed starting from the rightmost position of the ring and proceeding counter-clockwise around the ring. The row-column form assumes the top row is the 0th row and is indexed from left to right.

Example of corresponding indices for a hexagonal lattice with 3 rings (5 rows):

Row-Column Form: (0,0) (0,1) (0,2) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) (2,4) (3,0) (3,1) (3,2) (3,3) (4,0) (4,1) (4,2)

Ring-Position Form: (0,8) (0,9) (0,10) (0,7) (1,4) (1,5) (0,11) (0,6) (1,3) (2,0) (1,0) (0,0) (0,5) (1,2) (1,1) (0,1) (0,4) (0,3) (0,2)

Parameters
indexin ring-position form
Returns
index in row-column form

Definition at line 144 of file CSGHexagonalLattice.C.

Referenced by buildIndexMap().

145 {
146  auto og_ring = ring_ele_index.first; // ring corresponds to the outermost ring as ring 0
147  int ring = _nring - og_ring - 1; // convert to internal indexing (0 as innermost ring)
148  auto element = ring_ele_index.second;
149 
150  if (og_ring < 0 || og_ring >= (int)_nring)
151  mooseError("Ring " + std::to_string(og_ring) + " is not valid for hexagonal lattice " +
152  getName());
153  if (element < 0 || element >= (ring == 0 ? 1 : 6 * ring))
154  mooseError("Position " + std::to_string(element) + " is not valid for ring " +
155  std::to_string(og_ring) + " in hexagonal lattice " + getName());
156 
157  // Calculate the center row and column indices
158  int center_row = (_nrow - 1) / 2;
159  int center_col = center_row;
160 
161  // Special case for the center element
162  if (ring == 0)
163  return {center_row, center_col};
164 
165  // Calculate the side length of the hexagon for the given ring
166  int side_length = ring;
167 
168  // Determine which side of the hexagon the element is on and get row/col from this
169  int side = element / side_length;
170  int offset = element % side_length; // position within the side moving counter-clockwise
171  int row, col;
172 
173  // lamba to calculate the number of columns in any given row
174  auto calc_num_cols_in_row = [&](int r) { return _nrow - std::abs(center_row - r); };
175 
176  // diagram of side numbers:
177  // 4
178  // _______
179  // / \*
180  // 3 / \ 5
181  // / \*
182  // \ /
183  // 2 \ / 0
184  // \ _______ /
185  // 1
186  switch (side)
187  {
188  case 0: // bottom right (contains starting position of the ring)
189  row = center_row + offset;
190  col = calc_num_cols_in_row(row) - og_ring - 1;
191  break;
192  case 1: // bottom
193  row = center_row + ring;
194  col = calc_num_cols_in_row(row) - og_ring - 1 - offset;
195  break;
196  case 2: // bottom left
197  row = center_row + (side_length - offset);
198  col = center_col - ring;
199  break;
200  case 3: // top left
201  row = center_row - offset;
202  col = center_col - ring;
203  break;
204  case 4: // top
205  row = center_row - ring;
206  col = center_col - ring + offset;
207  break;
208  case 5: // top right
209  row = center_row - (side_length - offset);
210  col = calc_num_cols_in_row(row) - og_ring - 1;
211  break;
212  default:
213  mooseError("Invalid side ID calculation in hexagonal lattice " + getName());
214  }
215 
216  mooseAssert(isValidIndex(std::make_pair(row, col)),
217  "Calculated index (" + std::to_string(row) + ", " + std::to_string(col) +
218  ") is not valid for hexagonal lattice " + getName());
219 
220  return {row, col};
221 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...
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
Get the name of lattice.
Definition: CSGLattice.h:62
virtual bool isValidIndex(const std::pair< int, int > index) const override
check if provided index in row-column form is valid for the given hexagonal lattice ...
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ getTransformations()

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

Get the list of transformations.

Returns
The list of transformations

Definition at line 47 of file CSGTransformationHelper.h.

Referenced by CSG::CSGSurface::getHalfspaceFromPoint(), CSG::CSGUniverse::operator==(), CSG::CSGSurface::operator==(), CSG::CSGCell::operator==(), and CSG::CSGLattice::operator==().

48  {
49  return _transformations;
50  }
std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > _transformations
List of transformations applied to this object.

◆ getTransformationsAsStrings()

std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > CSG::CSGTransformationHelper::getTransformationsAsStrings ( ) const
inherited

Get the transformations of this object with string representations for types.

Returns
Vector of transformation pairs with string representations for types

Definition at line 65 of file CSGTransformationHelper.C.

66 {
67  std::vector<std::pair<std::string, std::tuple<Real, Real, Real>>> result;
68  for (const auto & transform_pair : _transformations)
69  result.emplace_back(getTransformationTypeString(transform_pair.first), transform_pair.second);
70  return result;
71 }
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.

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

◆ getType()

const std::string& CSG::CSGLattice::getType ( ) const
inlineinherited

Get the lattice type.

Returns
std::string type of lattice

Definition at line 69 of file CSGLattice.h.

Referenced by CSG::CSGCartesianLattice::compareAttributes(), compareAttributes(), CSG::CSGLattice::operator==(), CSG::CSGCartesianLattice::setUniverses(), and setUniverses().

69 { return _lattice_type; }
const std::string _lattice_type
Type of lattice.
Definition: CSGLattice.h:222

◆ getUniqueUniverses()

const std::vector< std::reference_wrapper< const CSGUniverse > > CSG::CSGLattice::getUniqueUniverses ( ) const
inherited

Get the list of unique universe objects in the lattice.

Returns
list of references to unique CSGUniverse objects

Definition at line 93 of file CSGLattice.C.

94 {
95  std::vector<std::reference_wrapper<const CSGUniverse>> unique_univs;
96  auto all_univs = getUniverses();
97 
98  for (const auto & ulist : all_univs)
99  for (const auto & u : ulist)
100  {
101  auto it = std::find_if(unique_univs.begin(),
102  unique_univs.end(),
103  [&u](const auto & ref) { return &ref.get() == &u.get(); });
104  if (it == unique_univs.end())
105  unique_univs.push_back(u);
106  }
107  return unique_univs;
108 }
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > getUniverses() const
Get the arrangement of CSGUniverses in the lattice.
Definition: CSGLattice.h:97

◆ getUniverseAtIndex()

const CSGUniverse & CSG::CSGLattice::getUniverseAtIndex ( const std::pair< int, int index)
inherited

Get the universe located at the given index.

Parameters
indexpair of ints that specify the location in lattice
Returns
universe at the specified location

Definition at line 66 of file CSGLattice.C.

67 {
68  if (!isValidIndex(index))
69  mooseError("Index (" + std::to_string(index.first) + ", " + std::to_string(index.second) +
70  ") is not a valid index for lattice " + getName());
71  else
72  return _universe_map[index.first][index.second];
73 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual bool isValidIndex(const std::pair< int, int > index) const =0
Checks if the given index location is a valid index for the lattice.
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225

◆ getUniverseIndices()

const std::vector< std::pair< unsigned int, unsigned int > > CSG::CSGLattice::getUniverseIndices ( const std::string &  univ_name) const
inherited

get all locations in lattice where universe of the specified name exists

Parameters
univ_namename of universe
Returns
vector of locations (pairs of ints)

Definition at line 76 of file CSGLattice.C.

77 {
78  if (!hasUniverse(univ_name))
79  mooseError("Universe " + univ_name + " does not exist in lattice " + getName());
80 
81  std::vector<std::pair<unsigned int, unsigned int>> indices;
82  for (auto i : index_range(_universe_map))
83  for (auto j : index_range(_universe_map[i]))
84  {
85  const CSGUniverse & univ = _universe_map[i][j];
86  if (univ.getName() == univ_name)
87  indices.push_back(std::make_pair(i, j));
88  }
89  return indices;
90 }
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
Get the name of lattice.
Definition: CSGLattice.h:62
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225
bool hasUniverse(const std::string &name) const
whether or not the universe of the specified name exists in the lattice
Definition: CSGLattice.C:42
auto index_range(const T &sizable)

◆ getUniverseNameMap()

const std::vector< std::vector< std::string > > CSG::CSGLattice::getUniverseNameMap ( ) const
inherited

Get the arrangement of CSGUniverses in the lattice as their names.

Returns
list of list of universe names

Definition at line 52 of file CSGLattice.C.

53 {
54  std::vector<std::vector<std::string>> name_map;
55  for (auto & univ_list : _universe_map)
56  {
57  std::vector<std::string> name_list;
58  for (const CSGUniverse & univ : univ_list)
59  name_list.push_back(univ.getName());
60  name_map.push_back(name_list);
61  }
62  return name_map;
63 }
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225

◆ getUniverses()

std::vector<std::vector<std::reference_wrapper<const CSGUniverse> > > CSG::CSGLattice::getUniverses ( ) const
inlineinherited

Get the arrangement of CSGUniverses in the lattice.

Returns
list of list of universes in their lattice arrangement

Definition at line 97 of file CSGLattice.h.

Referenced by CSG::CSGBase::addLatticeToList(), CSG::CSGBase::createCell(), CSG::CSGLattice::getUniqueUniverses(), and CSG::CSGLattice::operator==().

98  {
99  return _universe_map;
100  }
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225

◆ hasUniverse()

bool CSG::CSGLattice::hasUniverse ( const std::string &  name) const
inherited

whether or not the universe of the specified name exists in the lattice

Parameters
nameof universe to search for
Returns
true if universe of that name exists in lattice

Definition at line 42 of file CSGLattice.C.

Referenced by CSG::CSGLattice::getUniverseIndices().

43 {
44  for (auto list_univ : _universe_map)
45  for (const CSGUniverse & univ : list_univ)
46  if (univ.getName() == name)
47  return true;
48  return false; // no universe with matching name was found
49 }
std::string name(const ElemQuality q)
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225

◆ isValidIndex()

bool CSG::CSGHexagonalLattice::isValidIndex ( const std::pair< int, int index) const
overridevirtual

check if provided index in row-column form is valid for the given hexagonal lattice

Parameters
indexin row-column form
Returns
true if valid, otherwise false

Implements CSG::CSGLattice.

Definition at line 94 of file CSGHexagonalLattice.C.

Referenced by getRingIndexFromRowIndex(), and getRowIndexFromRingIndex().

95 {
96  auto row = index.first; // row index
97  auto ele = index.second; // column index within the row
98 
99  // Check if row is valid (0 <= row < _nrow)
100  if (row < 0 || row >= (int)_nrow)
101  return false;
102 
103  // Calculate maximum number of elements in this specific row
104  auto center_row = (_nrow - 1) / 2; // center row index
105  int max_ele = _nrow - std::abs((int)(row - center_row));
106 
107  // Check if column index is valid for this row
108  return !(ele < 0 || ele >= max_ele);
109 }
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Definition: EigenADReal.h:50
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ 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

◆ isValidUniverseMap()

bool CSG::CSGHexagonalLattice::isValidUniverseMap ( std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>>  universes) const
overridevirtual

check if the arrangement of the provided universes is valid for the hexagonal lattice given the number or rows/rings defined for the lattice.

Universes should be listed by row, starting from the top, and assume an x-orientation arrangment.

Parameters
universeslist of lists of universes that define the arrangement of the lattice
Returns
true if valid, otherwise false

Implements CSG::CSGLattice.

Definition at line 40 of file CSGHexagonalLattice.C.

Referenced by setUniverses().

42 {
43  if (universes.size() < 1) // need at least one row
44  return false;
45 
46  if (universes.size() % 2 == 0) // must be odd number of rows
47  return false;
48 
49  // each row differs in how many elements are required depending on size of lattice
50  unsigned int num_row = universes.size();
51  unsigned int center_row = (num_row - 1) / 2;
52  for (unsigned int row_i : index_range(universes))
53  {
54  unsigned int n_ele =
55  num_row - ((row_i > center_row) ? (row_i - center_row) : (center_row - row_i));
56  if (universes[row_i].size() != n_ele)
57  return false;
58  }
59 
60  return true;
61 }
auto index_range(const T &sizable)

◆ operator!=()

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

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

Definition at line 189 of file CSGLattice.C.

190 {
191  return !(*this == other);
192 }

◆ operator==()

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

Operator overload for checking if two CSGLattice objects are equal.

Definition at line 153 of file CSGLattice.C.

154 {
155  if (this->getName() != other.getName())
156  return false;
157  if (this->getType() != other.getType())
158  return false;
159  if (this->getTransformations() != other.getTransformations())
160  return false;
161  if (this->getOuterType() != other.getOuterType())
162  return false;
163  if ((this->getOuterType() == "CSG_MATERIAL") &&
164  (this->getOuterMaterial() != other.getOuterMaterial()))
165  return false;
166  if ((this->getOuterType() == "UNIVERSE") &&
167  (this->getOuterUniverse() != other.getOuterUniverse()))
168  return false;
169  if (!this->compareAttributes(other))
170  return false;
171 
172  const auto & this_univs = this->getUniverses();
173  const auto & other_univs = other.getUniverses();
174  if (this_univs.size() != other_univs.size())
175  return false;
176  for (unsigned int i = 0; i < this_univs.size(); ++i)
177  {
178  if (this_univs[i].size() != other_univs[i].size())
179  return false;
180  for (unsigned int j = 0; j < this_univs[i].size(); j++)
181  if (this_univs[i][j].get() != other_univs[i][j].get())
182  return false;
183  }
184 
185  return true;
186 }
const CSGUniverse & getOuterUniverse() const
Get the outer universe if outer type is UNIVERSE.
Definition: CSGLattice.C:111
const std::string & getType() const
Get the lattice type.
Definition: CSGLattice.h:69
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
const std::string & getOuterMaterial() const
Get the outer material name if outer fype is CSG_MATERIAL.
Definition: CSGLattice.C:120
virtual bool compareAttributes(const CSGLattice &other) const =0
helper function to compare the attributes of the lattice type
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > getUniverses() const
Get the arrangement of CSGUniverses in the lattice.
Definition: CSGLattice.h:97
const std::string getOuterType() const
Get the type of outer that fills the space around the lattice elements.
Definition: CSGLattice.h:76
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.

◆ resetOuter()

void CSG::CSGLattice::resetOuter ( )
inherited

reset the outer fill around the lattice elements to be VOID

Definition at line 145 of file CSGLattice.C.

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

146 {
147  _outer_type = "VOID";
148  _outer_material = "";
149  _outer_universe = nullptr;
150 }
std::string _outer_material
name of the outer material
Definition: CSGLattice.h:231
std::string _outer_type
An enum for type of outer fill for lattice.
Definition: CSGLattice.h:228
const CSGUniverse * _outer_universe
outer object if fill is CSGUniverse
Definition: CSGLattice.h:234

◆ setName()

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

Definition at line 183 of file CSGLattice.h.

183 { _name = name; }
std::string name(const ElemQuality q)
std::string _name
Name of lattice.
Definition: CSGLattice.h:219

◆ setPitch()

void CSG::CSGHexagonalLattice::setPitch ( Real  pitch)

set the pitch of the lattice

Parameters
pitchnew pitch value

Definition at line 78 of file CSGHexagonalLattice.C.

79 {
80  if (pitch < 0)
81  mooseError("Lattice " + getName() + " must have pitch greater than 0.");
82  _pitch = pitch;
83 }
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
Get the name of lattice.
Definition: CSGLattice.h:62
Real _pitch
lattice pitch (flat-to-flat distance between adjacent hex elements)

◆ setUniverseAtIndex()

void CSG::CSGLattice::setUniverseAtIndex ( const CSGUniverse universe,
const std::pair< int, int index 
)
protectedinherited

replace the element at specified index in the lattice with the provided CSGUniverse.

This will check that the _universe_map has been initialized and that the index is valid.

Parameters
universeuniverse to add to the lattice at the location index
indexlocation in lattice replace with provided universe

Definition at line 30 of file CSGLattice.C.

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

31 {
32  std::string base_msg = "Cannot set universe at location (" + std::to_string(index.first) + ", " +
33  std::to_string(index.second) + ") for lattice " + getName() + ". ";
34  if (_universe_map.size() == 0)
35  mooseError(base_msg + "Universe map has not been initialized.");
36  if (!isValidIndex(index))
37  mooseError(base_msg + "Not a valid location.");
38  _universe_map[index.first][index.second] = universe;
39 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:311
virtual bool isValidIndex(const std::pair< int, int > index) const =0
Checks if the given index location is a valid index for the lattice.
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225

◆ setUniverses()

void CSG::CSGHexagonalLattice::setUniverses ( std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>>  universes)
overrideprotectedvirtual

set the universes that define the lattice layout

Parameters
universeslist of list of universes to set as the lattice map

Implements CSG::CSGLattice.

Definition at line 64 of file CSGHexagonalLattice.C.

Referenced by CSGHexagonalLattice().

66 {
67  // check for valid map arrangment
68  if (!isValidUniverseMap(universes))
69  mooseError("Cannot set lattice " + getName() +
70  " with universes. Does not have valid dimensions for lattice type " + getType());
71  // set attributes based on universe map (in case they differ from original values)
72  _nrow = universes.size();
74  _universe_map = universes;
75  buildIndexMap();
76 }
unsigned int _nring
number of rings in the hexagonal lattice, should be consistent with the number of rows ...
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 & getType() const
Get the lattice type.
Definition: CSGLattice.h:69
const std::string & getName() const
Get the name of lattice.
Definition: CSGLattice.h:62
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > _universe_map
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type...
Definition: CSGLattice.h:225
virtual bool isValidUniverseMap(std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes) const override
check if the arrangement of the provided universes is valid for the hexagonal lattice given the numbe...
unsigned int nRowToRing(int nrow)
methods to help convert between number of rows and rings get the total number of rings from the numbe...
void buildIndexMap()
build a mapping of row-column indices to ring-position indices for quick conversion and look-up...
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings ...

◆ updateOuter() [1/2]

void CSG::CSGLattice::updateOuter ( const std::string &  outer_name)
protectedinherited

Update the outer of the lattice to be the provided material name.

This will change outer type to CSG_MATERIAL even if it was a different type previously.

Parameters
outer_namename of CSG material that will fill space around lattice elements

Definition at line 137 of file CSGLattice.C.

Referenced by CSG::CSGLattice::CSGLattice(), and CSG::CSGBase::setLatticeOuter().

138 {
139  _outer_type = "CSG_MATERIAL";
140  _outer_material = outer_name;
141  _outer_universe = nullptr;
142 }
std::string _outer_material
name of the outer material
Definition: CSGLattice.h:231
std::string _outer_type
An enum for type of outer fill for lattice.
Definition: CSGLattice.h:228
const CSGUniverse * _outer_universe
outer object if fill is CSGUniverse
Definition: CSGLattice.h:234

◆ updateOuter() [2/2]

void CSG::CSGLattice::updateOuter ( const CSGUniverse outer_universe)
protectedinherited

Update the outer of the lattice to be the provided universe.

This will change outer type to UNIVERSE even if it was a different type previously.

Parameters
outer_universepointer to outer universe that will fill space around lattice elements

Definition at line 129 of file CSGLattice.C.

130 {
131  _outer_type = "UNIVERSE";
132  _outer_universe = &outer_universe;
133  _outer_material = "";
134 }
std::string _outer_material
name of the outer material
Definition: CSGLattice.h:231
std::string _outer_type
An enum for type of outer fill for lattice.
Definition: CSGLattice.h:228
const CSGUniverse * _outer_universe
outer object if fill is CSGUniverse
Definition: CSGLattice.h:234

Member Data Documentation

◆ _lattice_type

const std::string CSG::CSGLattice::_lattice_type
protectedinherited

Type of lattice.

Definition at line 222 of file CSGLattice.h.

Referenced by CSG::CSGLattice::getType().

◆ _name

std::string CSG::CSGLattice::_name
protectedinherited

Name of lattice.

Definition at line 219 of file CSGLattice.h.

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

◆ _nring

unsigned int CSG::CSGHexagonalLattice::_nring
protected

number of rings in the hexagonal lattice, should be consistent with the number of rows

Definition at line 206 of file CSGHexagonalLattice.h.

Referenced by buildIndexMap(), getAttributes(), getNRings(), getRowIndexFromRingIndex(), and setUniverses().

◆ _nrow

unsigned int CSG::CSGHexagonalLattice::_nrow
protected

number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings

Definition at line 203 of file CSGHexagonalLattice.h.

Referenced by getAttributes(), getNRows(), getRowIndexFromRingIndex(), isValidIndex(), and setUniverses().

◆ _outer_material

std::string CSG::CSGLattice::_outer_material
mutableprotectedinherited

name of the outer material

Definition at line 231 of file CSGLattice.h.

Referenced by CSG::CSGLattice::getOuterMaterial(), CSG::CSGLattice::resetOuter(), and CSG::CSGLattice::updateOuter().

◆ _outer_type

std::string CSG::CSGLattice::_outer_type
mutableprotectedinherited

An enum for type of outer fill for lattice.

Definition at line 228 of file CSGLattice.h.

Referenced by CSG::CSGLattice::getOuterType(), CSG::CSGLattice::resetOuter(), and CSG::CSGLattice::updateOuter().

◆ _outer_universe

const CSGUniverse* CSG::CSGLattice::_outer_universe
protectedinherited

outer object if fill is CSGUniverse

Definition at line 234 of file CSGLattice.h.

Referenced by CSG::CSGLattice::getOuterUniverse(), CSG::CSGLattice::resetOuter(), and CSG::CSGLattice::updateOuter().

◆ _pitch

Real CSG::CSGHexagonalLattice::_pitch
protected

lattice pitch (flat-to-flat distance between adjacent hex elements)

Definition at line 200 of file CSGHexagonalLattice.h.

Referenced by CSGHexagonalLattice(), getAttributes(), getPitch(), and setPitch().

◆ _row_to_ring_map

std::map<std::pair<unsigned int, unsigned int>, std::pair<unsigned int, unsigned int> > CSG::CSGHexagonalLattice::_row_to_ring_map
protected

map of row-column indices to ring-position indices for quick conversion and look-up

Definition at line 210 of file CSGHexagonalLattice.h.

Referenced by buildIndexMap(), and getRingIndexFromRowIndex().

◆ _transformations

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

◆ _universe_map

std::vector<std::vector<std::reference_wrapper<const CSGUniverse> > > CSG::CSGLattice::_universe_map
protectedinherited

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