19#include "gtest/gtest.h"
29typedef std::variant<std::reference_wrapper<const CSGUniverse>, std::string>
OuterVariant;
45 CSGLattice(
const std::string & name,
const std::optional<OuterVariant> & outer = std::nullopt);
53 virtual std::unique_ptr<CSGLattice>
clone()
const = 0;
98 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>>
getUniverses()
const
124 virtual std::unordered_map<std::string, AttributeVariant>
149 const std::vector<std::pair<unsigned int, unsigned int>>
173 const std::vector<std::reference_wrapper<const CSGUniverse>>
getUniqueUniverses()
const;
189 setUniverses(std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes) = 0;
223 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>>
_universe_map;
239#ifdef MOOSE_UNIT_TEST
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
CSGLatticeList creates a container for CSGLattice objects to pass to CSGBase.
CSGLattice is the abstract class for defining lattices.
std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > getUniverses() const
Get the arrangement of CSGUniverses in the lattice.
FRIEND_TEST(CSGLatticeTest, testSetName)
Friends for unit testing.
virtual std::unique_ptr< CSGLattice > clone() const =0
FRIEND_TEST(CSGLatticeTest, testCartLatticeEquality)
void updateOuter(const std::string &outer_name)
Update the outer of the lattice to be the provided material name.
virtual bool isValidUniverseMap(std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes) const =0
check that any provided list of list of CSGUniverses are the correct dimensions for the type of latti...
const std::string & getName() const
Get the name of lattice.
const std::vector< std::vector< std::string > > getUniverseNameMap() const
Get the arrangement of CSGUniverses in the lattice as their names.
const std::string getOuterType() const
Get the type of outer that fills the space around the lattice elements.
const std::string & getOuterMaterial() const
Get the outer material name if outer fype is CSG_MATERIAL.
std::string _outer_material
name of the outer material
FRIEND_TEST(CSGBaseTest, testAddLattice)
bool operator!=(const CSGLattice &other) const
Operator overload for checking if two CSGLattice objects are not equal.
bool operator==(const CSGLattice &other) const
Operator overload for checking if two CSGLattice objects are equal.
const CSGUniverse * _outer_universe
outer object if fill is CSGUniverse
void setName(const std::string &name)
virtual void setUniverses(std::vector< std::vector< std::reference_wrapper< const CSGUniverse > > > universes)=0
assign the vectors of universes as the lattice elements
const std::vector< std::reference_wrapper< const CSGUniverse > > getUniqueUniverses() const
Get the list of unique universe objects in the lattice.
virtual std::unordered_map< std::string, AttributeVariant > getAttributes() const =0
Get attributes that define the lattice (excluding the universe map).
const CSGUniverse & getOuterUniverse() const
Get the outer universe if outer type is UNIVERSE.
virtual bool compareAttributes(const CSGLattice &other) const =0
helper function to compare the attributes of the lattice type
void resetOuter()
reset the outer fill around the lattice elements to be VOID
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
virtual ~CSGLattice()=default
Destructor.
bool hasUniverse(const std::string &name) const
whether or not the universe of the specified name exists in the lattice
const std::string getType() const
Get the lattice type.
const CSGUniverse & getUniverseAtIndex(const std::pair< int, int > index)
Get the universe located at the given index.
FRIEND_TEST(CSGLatticeTest, testUpdateOuter)
std::string _name
Name of lattice.
void setUniverseAtIndex(const CSGUniverse &universe, const std::pair< int, int > index)
replace the element at specified index in the lattice with the provided CSGUniverse.
virtual bool isValidIndex(const std::pair< int, int > index) const =0
Checks if the given index location is a valid index for the lattice.
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.
std::string _outer_type
An enum for type of outer fill for lattice.
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe,...
std::variant< std::reference_wrapper< const CSGUniverse >, std::string > OuterVariant
Type definition for a variant that can hold either a CSGUniverse reference or a string for use as the...
std::string prettyCppType(const std::string &cpp_type)
std::string demangle(const char *name)