https://mooseframework.inl.gov
CSGCell.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 #ifdef MOOSE_UNIT_TEST
13 #include "gtest/gtest.h"
14 #endif
15 
16 #include "CSGRegion.h"
18 
19 namespace CSG
20 {
21 
22 class CSGUniverse;
23 class CSGLattice;
24 
30 {
31 public:
38  CSGCell(const std::string & name, const CSGRegion & region);
39 
47  CSGCell(const std::string & name, const std::string & mat_name, const CSGRegion & region);
48 
56  CSGCell(const std::string & name, const CSGUniverse * univ, const CSGRegion & region);
57 
65  CSGCell(const std::string & name, const CSGLattice * lattice, const CSGRegion & region);
66 
70  virtual ~CSGCell() = default;
71 
77  const std::string getFillType() const { return _fill_type; }
78 
84  const CSGUniverse & getFillUniverse() const;
85 
91  const std::string & getFillMaterial() const;
92 
98  const CSGLattice & getFillLattice() const;
99 
105  const std::string & getFillName() const;
106 
112  const std::string & getName() const { return _name; }
113 
119  const CSGRegion & getRegion() const { return _region; }
120 
125  void resetCellFill();
126 
132  void updateCellFill(const std::string & mat_name);
133 
139  void updateCellFill(const CSGUniverse * univ);
140 
146  void updateCellFill(const CSGLattice * lattice);
147 
149  bool operator==(const CSGCell & other) const;
150 
152  bool operator!=(const CSGCell & other) const;
153 
154 protected:
162  std::map<std::string, std::reference_wrapper<const CSGSurface>> & identical_surface_refs);
163 
164  // set the name of the cell - intentionally not public because
165  // name needs to be managed at the CSGCellList level
166  void setName(const std::string & name) { _name = name; }
167 
168  // update the region of the cell to a new region - not public because
169  // it needs to be called from CSGBase so that the surfaces can be checked first.
170  void updateRegion(const CSGRegion & region) { _region = region; }
171 
173  std::string _name;
174 
176  MooseEnum _fill_type{"VOID CSG_MATERIAL UNIVERSE LATTICE"};
177 
179  std::string _fill_name;
180 
183 
186 
189 
190  friend class CSGCellList; // needed for setName() access
191  friend class CSGBase; // needed for updateRegion() access
192 
193 #ifdef MOOSE_UNIT_TEST
194  FRIEND_TEST(CSGCellTest, testSetName);
197  FRIEND_TEST(CSGCellTest, testUpdateRegion);
198  FRIEND_TEST(CSGCellTest, testCellEquality);
200 #endif
201 };
202 } // namespace CSG
std::string name(const ElemQuality q)
const CSGLattice & getFillLattice() const
Get the cell fill if fill type is LATTICE.
Definition: CSGCell.C:76
void updateCellRegionSurfaces(std::map< std::string, std::reference_wrapper< const CSGSurface >> &identical_surface_refs)
Update surface references of cell region based on map of input surface references.
Definition: CSGCell.C:118
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
Definition: CSGCell.C:58
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:112
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:77
void updateRegion(const CSGRegion &region)
Definition: CSGCell.h:170
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
Definition: CSGCell.C:94
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:176
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:22
CSGCellList creates a container for CSGCell objects to pass to CSGBase object.
Definition: CSGCellList.h:20
void setName(const std::string &name)
Definition: CSGCell.h:166
std::string _name
Name of surface.
Definition: CSGCell.h:173
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
Definition: CSGUniverse.h:27
void resetCellFill()
Reset the cell fill to void.
Definition: CSGCell.C:85
const std::string & getFillName() const
Get the name of the fill, regardless of its type.
Definition: CSGCell.C:47
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:182
CSGLattice is the abstract class for defining lattices.
Definition: CSGLattice.h:34
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
CSGCell(const std::string &name, const CSGRegion &region)
Constructor for void cell.
Definition: CSGCell.C:18
const CSGLattice * _fill_lattice
Fill object if fill is CSGLattice.
Definition: CSGCell.h:188
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
Definition: CSGCell.h:29
bool operator!=(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are not equal.
Definition: CSGCell.C:148
std::string _fill_name
name of the fill object for CSG_MATERIAL fills
Definition: CSGCell.h:179
virtual ~CSGCell()=default
Destructor.
const CSGRegion & getRegion() const
Get the cell region.
Definition: CSGCell.h:119
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:185
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:67
FRIEND_TEST(CSGCellTest, testSetName)
Friends for unit testing.
Class for managing transformations in CSG objects.
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:51
bool operator==(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are equal.
Definition: CSGCell.C:125