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)
47 std::unordered_map<std::string, AttributeVariant>
50 return {{
"nrow",
static_cast<unsigned int>(
_nrow)},
51 {
"ncol",
static_cast<unsigned int>(
_ncol)},
57 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
const 60 if (universes.size() < 1)
64 auto row_size = universes[0].size();
65 for (
auto univ_list : universes)
67 if (univ_list.size() != row_size)
75 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes)
80 " with universes. Does not have valid dimensions for lattice type " +
getType());
82 _nrow = universes.size();
83 _ncol = universes[0].size();
90 auto row = index.first;
91 auto col = index.second;
92 return ((0 <= row && row < (
int)
_nrow) && (0 <= col && col < (
int)
_ncol));
103 if (std::get<unsigned int>(this_dims[
"nrow"]) != std::get<unsigned int>(other_dims[
"nrow"]))
105 if (std::get<unsigned int>(this_dims[
"ncol"]) != std::get<unsigned int>(other_dims[
"ncol"]))
107 if (std::get<Real>(this_dims[
"pitch"]) != std::get<Real>(other_dims[
"pitch"]))
std::string name(const ElemQuality q)
void setPitch(Real pitch)
set the pitch of the lattice
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const std::string & getType() const
Get the lattice type.
unsigned int _ncol
number of elements in the second direction (columns)
const std::string & getName() const
Get the name of lattice.
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const override
Get attributes that define the lattice (excluding the universe map).
CSGLattice is the abstract class for defining lattices.
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...
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.
virtual bool compareAttributes(const CSGLattice &other) const override
compare the attributes returned in getAttributes of this lattice to another lattice ...
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse >>> universes) override
set the universes that define the lattice layout
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get attributes that define the lattice (excluding the universe map).
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.
unsigned int _nrow
number of elements in the first dimension (rows)
CSGCartesianLattice is the class for constructing regular Cartesian lattices of CSGUniverses.
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.
std::string prettyCppType(const std::string &cpp_type)