https://mooseframework.inl.gov
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 
18 namespace CSG
19 {
20 
25 {
26 public:
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 
126 protected:
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 
140 
142  unsigned int _nrow;
143 
145  unsigned int _ncol;
146 
147  friend class CSGBase;
148 
149 #ifdef MOOSE_UNIT_TEST
150  FRIEND_TEST(CSGLatticeTest, testCartSetUniverses);
153  FRIEND_TEST(CSGLatticeTest, testCartSetUniverseAtIndex);
154  FRIEND_TEST(CSGLatticeTest, testEmptyToFilled);
155  FRIEND_TEST(CSGLatticeTest, testCartLatticeEquality);
157 #endif
158 };
159 }
std::string name(const ElemQuality q)
void setPitch(Real pitch)
set the pitch of the lattice
unsigned int getNRows() const
get the number of rows
Real getPitch() const
get lattice pitch
unsigned int getNCols() const
get number of columns
FRIEND_TEST(CSGLatticeTest, testCartSetUniverses)
Friends for unit testing.
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).
CSGLattice is the abstract class for defining lattices.
Definition: CSGLattice.h:34
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
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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.
std::unique_ptr< CSGLattice > clone() const override
clone this Cartesian lattice
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.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:51
virtual ~CSGCartesianLattice()=default
Destructor.