https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
19namespace CSG
20{
21
22class CSGUniverse;
23class CSGLattice;
24
30{
31public:
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
136 virtual bool isEngUnit() const { return false; }
137
139 bool operator==(const CSGCell & other) const;
140
142 bool operator!=(const CSGCell & other) const;
143
144protected:
145 // set the name of the cell - intentionally not public because
146 // name needs to be managed at the CSGCellList level
147 void setName(const std::string & name) { _name = name; }
148
149 // update the region of the cell to a new region - not public because
150 // it needs to be called from CSGBase so that the surfaces can be checked first.
151 void updateRegion(const CSGRegion & region) { _region = region; }
152
158 void updateCellFill(const std::string & mat_name);
159
165 void updateCellFill(const CSGUniverse * univ);
166
172 void updateCellFill(const CSGLattice * lattice);
173
181 std::map<std::string, std::reference_wrapper<const CSGSurface>> & identical_surface_refs);
182
184 std::string _name;
185
187 MooseEnum _fill_type{"VOID CSG_MATERIAL UNIVERSE LATTICE"};
188
190 std::string _fill_name;
191
194
197
200
201 friend class CSGCellList; // needed for setName() access
202 friend class CSGBase; // needed for updateRegion() access
203
204#ifdef MOOSE_UNIT_TEST
207 FRIEND_TEST(CSGCellTest, testSetName);
208 FRIEND_TEST(CSGCellTest, testUpdateRegion);
209 FRIEND_TEST(CSGCellTest, testCellEquality);
210 FRIEND_TEST(CSGCellTest, testUpdateFill);
212#endif
213};
214} // namespace CSG
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGCellList creates a container for CSGCell objects to pass to CSGBase object.
Definition CSGCellList.h:21
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell,...
Definition CSGCell.h:30
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition CSGCell.h:193
const CSGRegion & getRegion() const
Get the cell region.
Definition CSGCell.h:119
std::string _name
Name of surface.
Definition CSGCell.h:184
const std::string & getName() const
Get the cell name.
Definition CSGCell.h:112
bool operator==(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are equal.
Definition CSGCell.C:126
const CSGLattice & getFillLattice() const
Get the cell fill if fill type is LATTICE.
Definition CSGCell.C:77
FRIEND_TEST(CSGCellTest, testCellEquality)
const std::string getFillType() const
Get the type of fill for the cell.
Definition CSGCell.h:77
virtual bool isEngUnit() const
Whether this cell is an engineering unit.
Definition CSGCell.h:136
FRIEND_TEST(CSGCellTest, testSetName)
Friends for unit testing.
void resetCellFill()
Reset the cell fill to void.
Definition CSGCell.C:86
FRIEND_TEST(CSGCellTest, testUpdateFill)
void updateRegion(const CSGRegion &region)
Definition CSGCell.h:151
const CSGLattice * _fill_lattice
Fill object if fill is CSGLattice.
Definition CSGCell.h:199
FRIEND_TEST(CSGCellTest, testUpdateRegion)
void updateCellFill(const std::string &mat_name)
Set the cell fill to a material name.
Definition CSGCell.C:95
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
Definition CSGCell.C:59
bool operator!=(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are not equal.
Definition CSGCell.C:159
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition CSGCell.h:196
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition CSGCell.C:68
virtual ~CSGCell()=default
Destructor.
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:119
void setName(const std::string &name)
Definition CSGCell.h:147
const std::string & getFillName() const
Get the name of the fill, regardless of its type.
Definition CSGCell.C:48
std::string _fill_name
name of the fill object for CSG_MATERIAL fills
Definition CSGCell.h:190
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition CSGCell.h:187
CSGLattice is the abstract class for defining lattices.
Definition CSGLattice.h:35
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection,...
Definition CSGRegion.h:23
Class for managing transformations in CSG objects.
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe,...
Definition CSGUniverse.h:28
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55