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"
17 
18 namespace CSG
19 {
20 
21 class CSGUniverse;
22 
27 class CSGCell
28 {
29 public:
36  CSGCell(const std::string & name, const CSGRegion & region);
37 
45  CSGCell(const std::string & name, const std::string & mat_name, const CSGRegion & region);
46 
54  CSGCell(const std::string & name, const CSGUniverse * univ, const CSGRegion & region);
55 
59  virtual ~CSGCell() = default;
60 
66  const std::string getFillType() const { return _fill_type; }
67 
73  const CSGUniverse & getFillUniverse() const;
74 
80  const std::string & getFillMaterial() const;
81 
87  const std::string & getFillName() const { return _fill_name; }
88 
94  const std::string & getName() const { return _name; }
95 
101  const CSGRegion & getRegion() const { return _region; }
102 
108  const std::string & getRegionAsString() const { return _region.toString(); }
109 
111  bool operator==(const CSGCell & other) const;
112 
114  bool operator!=(const CSGCell & other) const;
115 
116 protected:
117  // set the name of the cell - intentionally not public because
118  // name needs to be managed at the CSGCellList level
119  void setName(const std::string & name) { _name = name; }
120 
121  // update the region of the cell to a new region - not public because
122  // it needs to be called from CSGBase so that the surfaces can be checked first.
123  void updateRegion(const CSGRegion & region) { _region = region; }
124 
126  std::string _name;
127 
129  // TODO: add support for lattice fill
130  MooseEnum _fill_type{"VOID CSG_MATERIAL UNIVERSE"};
131 
133  std::string _fill_name;
134 
137 
140 
141  friend class CSGCellList; // needed for setName() access
142  friend class CSGBase; // needed for updateRegion() access
143 
144 #ifdef MOOSE_UNIT_TEST
145  FRIEND_TEST(CSGCellTest, testSetName);
148  FRIEND_TEST(CSGCellTest, testUpdateRegion);
150 #endif
151 };
152 } // namespace CSG
std::string name(const ElemQuality q)
const CSGUniverse & getFillUniverse() const
Get the cell fill if fill type is UNIVERSE.
Definition: CSGCell.C:34
const std::string & getName() const
Get the cell name.
Definition: CSGCell.h:94
const std::string getFillType() const
Get the type of fill for the cell.
Definition: CSGCell.h:66
void updateRegion(const CSGRegion &region)
Definition: CSGCell.h:123
MooseEnum _fill_type
An enum for type of fill for cell region.
Definition: CSGCell.h:130
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:21
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:119
const std::string & toString() const
gets the string representation of the region
Definition: CSGRegion.h:76
std::string _name
Name of surface.
Definition: CSGCell.h:126
CSGUniverse creates an internal representation of a Constructive Solid Geometry (CSG) universe...
Definition: CSGUniverse.h:26
CSGRegion _region
Cell region, represented as a CSGRegion object.
Definition: CSGCell.h:136
const std::string & getFillName() const
Get the name of the fill, regardless of its type.
Definition: CSGCell.h:87
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
CSGCell(const std::string &name, const CSGRegion &region)
Constructor for void cell.
Definition: CSGCell.C:16
CSGCell creates an internal representation of a Constructive Solid Geometry (CSG) cell...
Definition: CSGCell.h:27
bool operator!=(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are not equal.
Definition: CSGCell.C:72
std::string _fill_name
name of the fill object
Definition: CSGCell.h:133
virtual ~CSGCell()=default
Destructor.
const CSGRegion & getRegion() const
Get the cell region.
Definition: CSGCell.h:101
const CSGUniverse * _fill_universe
Fill object if fill is CSGUniverse.
Definition: CSGCell.h:139
const std::string & getFillMaterial() const
Get the cell fill material name if fill fype is CSG_MATERIAL.
Definition: CSGCell.C:43
FRIEND_TEST(CSGCellTest, testSetName)
Friends for unit testing.
const std::string & getRegionAsString() const
Get the string representation of the cell region.
Definition: CSGCell.h:108
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:29
bool operator==(const CSGCell &other) const
Operator overload for checking if two CSGCell objects are equal.
Definition: CSGCell.C:52