https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
20namespace CSG
21{
22
23class CSGBase; // forward declaration
24
43{
44public:
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>>>
100 {
102 }
103
104protected:
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
138 FRIEND_TEST(CSGEngUnitTest, testSurfUnit);
140#endif
141};
142
143} // namespace CSG
CSGBase creates an internal representation of a Constructive Solid Geometry (CSG) model.
Definition CSGBase.h:54
CSGEngUnit is the abstract base class for all "engineering unit" types in the CSG system.
Definition CSGEngUnit.h:33
bool operator!=(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are not equal.
Definition CSGEngUnit.C:50
bool operator==(const CSGEngUnit &other) const
Operator overload for checking if two CSGEngUnit objects are equal.
Definition CSGEngUnit.C:34
CSGRegions creates an internal representation of a CSG region, which can refer to an intersection,...
Definition CSGRegion.h:23
CSGSurfaceEngUnit is an abstract base class for "engineering units" that can be used as surfaces in c...
bool isEngUnit() const override
Engineering units report true so comparisons can skip the dynamic_cast fast path.
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const override
Delegate to CSGSurface (CSGTransformationHelper)
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const override
Delegate to CSGSurface (CSGTransformationHelper)
Real evaluateSurfaceEquationAtPoint(const Point &p) const override=0
Evaluate the surface equation at the given point.
std::unordered_map< std::string, Real > getCoeffs() const override
Always throws – coefficients are not defined for a surface engineering unit.
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.
void expandUnit() override=0
Create and add the concrete CSGSurface(s) in _internal_base.
CSGRegion getExpandedRegion() const
Return the CSGRegion formed by the expanded CSGSurfaces.
const std::string & getName() const override
Satisfy CSGEngUnit::getName() – resolved via CSGSurface::getName()
FRIEND_TEST(CSGEngUnitTest, testSurfUnit)
Friends for unit testing.
std::unique_ptr< CSGSurface > clone() const override=0
clone() is pure virtual – derived classes must implement
bool operator!=(const CSGSurfaceEngUnit &other) const
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface,...
Definition CSGSurface.h:27
const std::string & getName() const
Get the name of surface.
Definition CSGSurface.h:90
const std::vector< std::pair< TransformationType, std::tuple< Real, Real, Real > > > & getTransformations() const
Get the list of transformations.
std::vector< std::pair< std::string, std::tuple< Real, Real, Real > > > getTransformationsAsStrings() const
Get the transformations of this object with string representations for types.