15#include "gtest/gtest.h"
40 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes,
41 const std::optional<OuterVariant> & outer = std::nullopt);
54 const std::optional<OuterVariant> & outer = std::nullopt);
66 std::unique_ptr<CSGLattice>
clone()
const override
68 return std::make_unique<CSGHexagonalLattice>(*
this);
78 virtual std::unordered_map<std::string, AttributeVariant>
getAttributes()
const override;
86 virtual bool isValidIndex(
const std::pair<int, int> index)
const override;
97 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
const override;
197 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
override;
209 std::map<std::pair<unsigned int, unsigned int>, std::pair<unsigned int, unsigned int>>
212#ifdef MOOSE_UNIT_TEST
CSGHexagonalLattice is the class for constructing hexagonal lattices of CSGUniverses arranged in conc...
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 getNRings() const
get number of rings in the lattice
void buildIndexMap()
build a mapping of row-column indices to ring-position indices for quick conversion and look-up.
unsigned int getNRows() const
get number of rows in the lattices
virtual bool compareAttributes(const CSGLattice &other) const override
compare the attributes returned in getAttributes of this lattice to another lattice
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
unsigned int _nrow
number of rows in the hexagonal lattice (must be odd), should be consistent with the number of rings
Real getPitch() const
get the pitch of the lattice
virtual ~CSGHexagonalLattice()=default
Destructor.
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.
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const override
Get attributes that define the lattice (excluding the universe map).
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.
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...
FRIEND_TEST(CSGLatticeTest, testHexSetUniverses)
Friends for unit testing.
void setPitch(Real pitch)
set the pitch of the lattice
FRIEND_TEST(CSGLatticeTest, testConvertRowsRings)
std::unique_ptr< CSGLattice > clone() const override
clone this hexagonal lattice
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes) override
set the universes that define the lattice layout
CSGLattice is the abstract class for defining lattices.
unsigned int nRowToRing(int nrow)
methods to help convert between number of rows and rings get the total number of rings from the numbe...
unsigned int nRingToRow(int nring)
get the total number of rows from the number of rings