https://mooseframework.inl.gov
Loading...
Searching...
No Matches
CSGCartesianLattice.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://www.mooseframework.org
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "CSGLattice.h"
13
14#ifdef MOOSE_UNIT_TEST
15#include "gtest/gtest.h"
16#endif
17
18namespace CSG
19{
20
25{
26public:
36 CSGCartesianLattice(const std::string & name,
37 const Real pitch,
38 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes,
39 const std::optional<OuterVariant> & outer = std::nullopt);
40
50 CSGCartesianLattice(const std::string & name,
51 const Real pitch,
52 const std::optional<OuterVariant> & outer = std::nullopt);
53
57 virtual ~CSGCartesianLattice() = default;
58
64 std::unique_ptr<CSGLattice> clone() const override
65 {
66 return std::make_unique<CSGCartesianLattice>(*this);
67 }
68
77 virtual std::unordered_map<std::string, AttributeVariant> getAttributes() const override;
78
86 virtual bool isValidIndex(const std::pair<int, int> index) const override;
87
95 virtual bool isValidUniverseMap(
96 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes) const override;
97
103 unsigned int getNRows() const { return _nrow; }
104
110 unsigned int getNCols() const { return _ncol; }
111
117 Real getPitch() const { return _pitch; }
118
124 void setPitch(Real pitch);
125
126protected:
128 virtual bool compareAttributes(const CSGLattice & other) const override;
129
135 virtual void setUniverses(
136 std::vector<std::vector<std::reference_wrapper<const CSGUniverse>>> universes) override;
137
139 Real _pitch;
140
142 unsigned int _nrow;
143
145 unsigned int _ncol;
146
147 friend class CSGBase;
148
149#ifdef MOOSE_UNIT_TEST
152 FRIEND_TEST(CSGLatticeTest, testCartSetUniverses);
153 FRIEND_TEST(CSGLatticeTest, testCartSetUniverseAtIndex);
154 FRIEND_TEST(CSGLatticeTest, testEmptyToFilled);
155 FRIEND_TEST(CSGLatticeTest, testCartLatticeEquality);
157#endif
158};
159}
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGCartesianLattice is the class for constructing regular Cartesian lattices of CSGUniverses.
FRIEND_TEST(CSGLatticeTest, testCartSetUniverseAtIndex)
FRIEND_TEST(CSGLatticeTest, testEmptyToFilled)
unsigned int getNRows() const
get the number of rows
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 ~CSGCartesianLattice()=default
Destructor.
unsigned int getNCols() const
get number of columns
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.
std::unique_ptr< CSGLattice > clone() const override
clone this Cartesian lattice
FRIEND_TEST(CSGLatticeTest, testCartLatticeEquality)
Real getPitch() const
get lattice pitch
FRIEND_TEST(CSGLatticeTest, testCartSetUniverses)
Friends for unit testing.
unsigned int _nrow
number of elements in the first dimension (rows)
CSGLattice is the abstract class for defining lattices.
Definition CSGLattice.h:35