CSGHexagonalLattice is the class for constructing hexagonal lattices of CSGUniverses arranged in concentric hexagonal rings. More...
#include <CSGHexagonalLattice.h>
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< CSGLattice > | clone () const override |
| clone this hexagonal lattice More... | |
| virtual std::unordered_map< std::string, AttributeVariant > | getAttributes () 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, int > | getRowIndexFromRingIndex (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, int > | getRingIndexFromRowIndex (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 CSGUniverse & | getOuterUniverse () 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 CSGUniverse & | getUniverseAtIndex (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... | |
CSGHexagonalLattice is the class for constructing hexagonal lattices of CSGUniverses arranged in concentric hexagonal rings.
Definition at line 25 of file CSGHexagonalLattice.h.
| 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.
| name | unique identifying name of lattice |
| pitch | flat-to-flat distance for one hexagonal lattice element |
| universes | row-wise ragged vector of universes representing hex pattern |
| outer | optional 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.
| 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.
| name | unique identifying name of lattice |
| pitch | flat-to-flat distance for one hexagonal lattice element |
| outer | optional 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.
|
virtualdefault |
Destructor.
|
protectedinherited |
Add a transformation to the list of transformations.
| type | The type of transformation |
| values | The values for the transformation |
Definition at line 16 of file CSGTransformationHelper.C.
|
protectedinherited |
update the value of point p by applying the inverse of the list of transformations to the point
| p | point to transform |
Definition at line 74 of file CSGTransformationHelper.C.
Referenced by CSG::CSGSurface::getHalfspaceFromPoint().
|
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().
|
inlineoverridevirtual |
clone this hexagonal lattice
Implements CSG::CSGLattice.
Definition at line 66 of file CSGHexagonalLattice.h.
|
overrideprotectedvirtual |
compare the attributes returned in getAttributes of this lattice to another lattice
Implements CSG::CSGLattice.
Definition at line 112 of file CSGHexagonalLattice.C.
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
|
protected |
Friends for unit testing.
|
protected |
|
protectedinherited |
Friends for unit testing.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
overridevirtual |
Get attributes that define the lattice (excluding the universe map).
Implements CSG::CSGLattice.
Definition at line 86 of file CSGHexagonalLattice.C.
Referenced by compareAttributes().
|
inlineinherited |
Get the name of lattice.
Definition at line 62 of file CSGLattice.h.
Referenced by CSG::CSGLatticeList::addLattice(), CSG::CSGBase::addLatticeToList(), CSG::CSGBase::addTransformation(), CSG::CSGBase::checkLatticeInBase(), CSG::CSGCartesianLattice::CSGCartesianLattice(), CSGHexagonalLattice(), CSG::CSGBase::deleteLattice(), CSG::CSGCell::getFillName(), CSG::CSGLattice::getOuterMaterial(), CSG::CSGLattice::getOuterUniverse(), getRingIndexFromRowIndex(), getRowIndexFromRingIndex(), CSG::CSGLattice::getUniverseAtIndex(), CSG::CSGLattice::getUniverseIndices(), CSG::CSGLattice::operator==(), CSG::CSGLatticeList::renameLattice(), CSG::CSGBase::resetLatticeOuter(), CSG::CSGBase::setLatticeOuter(), CSG::CSGBase::setLatticeUniverses(), CSG::CSGCartesianLattice::setPitch(), setPitch(), CSG::CSGLattice::setUniverseAtIndex(), CSG::CSGBase::setUniverseAtLatticeIndex(), CSG::CSGCartesianLattice::setUniverses(), setUniverses(), and CSG::CSGBase::updateCellFill().
|
inline |
get number of rings in the lattice
Definition at line 111 of file CSGHexagonalLattice.h.
|
inline |
get number of rows in the lattices
Definition at line 104 of file CSGHexagonalLattice.h.
|
inherited |
Get the outer material name if outer fype is CSG_MATERIAL.
Definition at line 120 of file CSGLattice.C.
Referenced by CSG::CSGLattice::operator==().
|
inlineinherited |
Get the type of outer that fills the space around the lattice elements.
Definition at line 76 of file CSGLattice.h.
Referenced by CSG::CSGBase::addLatticeToList(), CSG::CSGLattice::getOuterMaterial(), CSG::CSGLattice::getOuterUniverse(), and CSG::CSGLattice::operator==().
|
inherited |
Get the outer universe if outer type is UNIVERSE.
Definition at line 111 of file CSGLattice.C.
Referenced by CSG::CSGBase::addLatticeToList(), and CSG::CSGLattice::operator==().
|
inline |
get the pitch of the lattice
Definition at line 172 of file CSGHexagonalLattice.h.
| 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)
| index | in row-column form |
Definition at line 224 of file CSGHexagonalLattice.C.
| 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)
| index | in ring-position form |
Definition at line 144 of file CSGHexagonalLattice.C.
Referenced by buildIndexMap().
|
inlineinherited |
Get 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==().
|
inherited |
Get the transformations of this object with string representations for types.
Definition at line 65 of file CSGTransformationHelper.C.
|
staticinherited |
Get the string representation of the transformation type.
| type | The transformation type |
Definition at line 56 of file CSGTransformationHelper.C.
Referenced by CSG::CSGTransformationHelper::addTransformation(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().
|
inlineinherited |
Get the lattice type.
Definition at line 69 of file CSGLattice.h.
Referenced by CSG::CSGCartesianLattice::compareAttributes(), compareAttributes(), CSG::CSGLattice::operator==(), CSG::CSGCartesianLattice::setUniverses(), and setUniverses().
|
inherited |
Get the list of unique universe objects in the lattice.
Definition at line 93 of file CSGLattice.C.
|
inherited |
Get the universe located at the given index.
| index | pair of ints that specify the location in lattice |
Definition at line 66 of file CSGLattice.C.
|
inherited |
get all locations in lattice where universe of the specified name exists
| univ_name | name of universe |
Definition at line 76 of file CSGLattice.C.
|
inherited |
Get the arrangement of CSGUniverses in the lattice as their names.
Definition at line 52 of file CSGLattice.C.
|
inlineinherited |
Get the arrangement of CSGUniverses in the lattice.
Definition at line 97 of file CSGLattice.h.
Referenced by CSG::CSGBase::addLatticeToList(), CSG::CSGBase::createCell(), CSG::CSGLattice::getUniqueUniverses(), and CSG::CSGLattice::operator==().
|
inherited |
whether or not the universe of the specified name exists in the lattice
| name | of universe to search for |
Definition at line 42 of file CSGLattice.C.
Referenced by CSG::CSGLattice::getUniverseIndices().
|
overridevirtual |
check if provided index in row-column form is valid for the given hexagonal lattice
| index | in row-column form |
Implements CSG::CSGLattice.
Definition at line 94 of file CSGHexagonalLattice.C.
Referenced by getRingIndexFromRowIndex(), and getRowIndexFromRingIndex().
|
staticinherited |
Check if the transformation value is valid for the given type.
| type | The type of transformation |
| values | The values for the transformation |
Definition at line 26 of file CSGTransformationHelper.C.
Referenced by CSG::CSGTransformationHelper::addTransformation().
|
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.
| universes | list of lists of universes that define the arrangement of the lattice |
Implements CSG::CSGLattice.
Definition at line 40 of file CSGHexagonalLattice.C.
Referenced by setUniverses().
|
inherited |
Operator overload for checking if two CSGLattice objects are not equal.
Definition at line 189 of file CSGLattice.C.
|
inherited |
Operator overload for checking if two CSGLattice objects are equal.
Definition at line 153 of file CSGLattice.C.
|
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().
|
inlineprotectedinherited |
Definition at line 183 of file CSGLattice.h.
set the pitch of the lattice
| pitch | new pitch value |
Definition at line 78 of file CSGHexagonalLattice.C.
|
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.
| universe | universe to add to the lattice at the location index |
| index | location in lattice replace with provided universe |
Definition at line 30 of file CSGLattice.C.
Referenced by CSG::CSGBase::setUniverseAtLatticeIndex().
|
overrideprotectedvirtual |
set the universes that define the lattice layout
| universes | list of list of universes to set as the lattice map |
Implements CSG::CSGLattice.
Definition at line 64 of file CSGHexagonalLattice.C.
Referenced by CSGHexagonalLattice().
|
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.
| outer_name | name 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().
|
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.
| outer_universe | pointer to outer universe that will fill space around lattice elements |
Definition at line 129 of file CSGLattice.C.
|
protectedinherited |
Type of lattice.
Definition at line 222 of file CSGLattice.h.
Referenced by CSG::CSGLattice::getType().
|
protectedinherited |
Name of lattice.
Definition at line 219 of file CSGLattice.h.
Referenced by CSG::CSGLattice::getName(), and CSG::CSGLattice::setName().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
protectedinherited |
List of transformations applied to this object.
Definition at line 92 of file CSGTransformationHelper.h.
Referenced by CSG::CSGTransformationHelper::addTransformation(), CSG::CSGTransformationHelper::applyReverseTransformsToPoint(), CSG::CSGTransformationHelper::getTransformations(), and CSG::CSGTransformationHelper::getTransformationsAsStrings().
|
protectedinherited |
Universes in the arrangement of how they appear in the lattice; dimensions depends on lattice type.
Definition at line 225 of file CSGLattice.h.
Referenced by CSG::CSGLattice::getUniverseAtIndex(), CSG::CSGLattice::getUniverseIndices(), CSG::CSGLattice::getUniverseNameMap(), CSG::CSGLattice::getUniverses(), CSG::CSGLattice::hasUniverse(), CSG::CSGLattice::setUniverseAtIndex(), CSG::CSGCartesianLattice::setUniverses(), and setUniverses().
1.8.14