https://mooseframework.inl.gov
CSGSurfaceEngUnit.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 #include "CSGSurface.h"
18 #include "CSGEngUnit.h"
19 
20 namespace CSG
21 {
22 
23 class CSGBase; // forward declaration
24 
42 class CSGSurfaceEngUnit : public CSGSurface, public CSGEngUnit
43 {
44 public:
50  CSGSurfaceEngUnit(const std::string & name);
51 
65  std::unordered_map<std::string, Real> getCoeffs() const override;
66 
78  Real evaluateSurfaceEquationAtPoint(const Point & p) const override = 0;
79 
81  const std::string & getName() const override { return CSGSurface::getName(); }
82 
84  bool isEngUnit() const override { return true; }
85 
87  bool operator==(const CSGSurfaceEngUnit & other) const { return CSGEngUnit::operator==(other); }
88  bool operator!=(const CSGSurfaceEngUnit & other) const { return CSGEngUnit::operator!=(other); }
89 
91  const std::vector<std::pair<TransformationType, std::tuple<Real, Real, Real>>> &
92  getTransformations() const override
93  {
95  }
96 
98  std::vector<std::pair<std::string, std::tuple<Real, Real, Real>>>
99  getTransformationsAsStrings() const override
100  {
102  }
103 
104 protected:
113  void expandUnit() override = 0;
114 
124 
126  std::unique_ptr<CSGSurface> clone() const override = 0;
127 
130 
131  // Only CSGBase should be calling expandUnit(), doGetExpandedRegion(), and setting
132  // _expanded_region
133  friend class CSGBase;
134 
135 #ifdef MOOSE_UNIT_TEST
136  FRIEND_TEST(CSGEngUnitTest, testSurfUnit);
140 #endif
141 };
142 
143 } // namespace CSG
std::string name(const ElemQuality q)
const std::string & getName() const
Get the name of surface.
Definition: CSGSurface.h:90
bool operator==(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are equal.
Definition: CSGEngUnit.C:34
void expandUnit() override=0
Create and add the concrete CSGSurface(s) in _internal_base.
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const override
Delegate to CSGSurface (CSGTransformationHelper)
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection...
Definition: CSGRegion.h:22
bool operator==(const CSGSurfaceEngUnit &other) const
Disambiguate == and != by forwarding to CSGEngUnit (name/property-based comparison) ...
CSGRegion _expanded_region
Stores the result of expandUnit(); EMPTY until then.
const std::string & getName() const override
Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()
std::unique_ptr< CSGSurface > clone() const override=0
clone() is pure virtual – derived classes must implement
CSGSurfaceEngUnit(const std::string &name)
Construct a new CSGSurfaceEngUnit.
CSGRegion getExpandedRegion() const
Return the CSGRegion formed by the expanded CSGSurfaces.
bool operator!=(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are not equal.
Definition: CSGEngUnit.C:50
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real evaluateSurfaceEquationAtPoint(const Point &p) const override=0
Evaluate the surface equation at the given point.
bool operator!=(const CSGSurfaceEngUnit &other) const
bool isEngUnit() const override
Engineering units report true so comparisons can skip the dynamic_cast fast path. ...
FRIEND_TEST(CSGEngUnitTest, testSurfUnit)
Friends for unit testing.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...
Definition: CSGSurface.h:26
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const override
Delegate to CSGSurface (CSGTransformationHelper)
std::unordered_map< std::string, Real > getCoeffs() const override
Always throws – coefficients are not defined for a surface engineering unit.
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const
Get the transformations of this object with string representations for types.
CSGSurfaceEngUnit is an abstract base class for "engineering units" that can be used as surfaces in c...
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model...
Definition: CSGBase.h:53
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system...
Definition: CSGEngUnit.h:32