16 const std::string & name,
18 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes,
19 const std::optional<OuterVariant> & outer)
29 const std::optional<OuterVariant> & outer)
30 :
CSGLattice(name, outer), _pitch(pitch), _nrow(0), _ncol(0)
44std::unordered_map<std::string, AttributeVariant>
47 return {{
"nrow",
static_cast<unsigned int>(
_nrow)},
48 {
"ncol",
static_cast<unsigned int>(
_ncol)},
54 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
const
57 if (universes.size() < 1)
61 auto row_size = universes[0].size();
62 for (
auto univ_list : universes)
64 if (univ_list.size() != row_size)
72 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
77 " with universes. Does not have valid dimensions for lattice type " +
getType());
79 _nrow = universes.size();
80 _ncol = universes[0].size();
87 auto row = index.first;
88 auto col = index.second;
89 return ((0 <= row && row < (
int)
_nrow) && (0 <= col && col < (
int)
_ncol));
95 if (other.
getType() != this->getType())
100 if (std::get<unsigned int>(this_dims[
"nrow"]) != std::get<unsigned int>(other_dims[
"nrow"]))
102 if (std::get<unsigned int>(this_dims[
"ncol"]) != std::get<unsigned int>(other_dims[
"ncol"]))
104 if (std::get<Real>(this_dims[
"pitch"]) != std::get<Real>(other_dims[
"pitch"]))
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
CSGCartesianLattice(const std::string &name, const Real pitch, std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes, const std::optional< OuterVariant > &outer=std::nullopt)
Construct a new CSGCartesianLattice object from the map of universes provided.
virtual bool isValidIndex(const std::pair< int, int > index) const override
Checks if the given index location (row, column) is a valid index for the lattice.
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes) override
set the universes that define the lattice layout
virtual bool compareAttributes(const CSGLattice &other) const override
compare the attributes returned in getAttributes of this lattice to another lattice
unsigned int _ncol
number of elements in the second direction (columns)
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const override
Get attributes that define the lattice (excluding the universe map).
void setPitch(Real pitch)
set the pitch of the lattice
virtual bool isValidUniverseMap(std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes) const override
check that any provided list of list of CSGUniverses are the correct dimensions.
unsigned int _nrow
number of elements in the first dimension (rows)
CSGLattice is the abstract class for defining lattices.
const std::string & getName() const
Get the name of lattice.
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get attributes that define the lattice (excluding the universe map).
const std::string getType() const
Get the lattice type.
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.