https://mooseframework.inl.gov
CSGSurface.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 "MooseApp.h"
17 #include "MooseEnum.h"
18 
19 namespace CSG
20 {
21 
27 {
28 public:
30  enum class Halfspace
31  {
32  POSITIVE,
33  NEGATIVE
34  };
35 
41  CSGSurface(const std::string & name);
42 
49  CSGSurface(const std::string & name, const std::string & surf_type);
50 
54  virtual ~CSGSurface() = default;
55 
61  const std::string & getSurfaceType() const { return _surface_type; }
62 
68  virtual std::unordered_map<std::string, Real> getCoeffs() const = 0; // Pure virtual function
69 
79  virtual Real evaluateSurfaceEquationAtPoint(const Point & p) const = 0; // Pure virtual function
80 
88  CSGSurface::Halfspace getHalfspaceFromPoint(const Point & p) const;
89 
95  const std::string & getName() const { return _name; }
96 
98  bool operator==(const CSGSurface & other) const;
99 
101  bool operator!=(const CSGSurface & other) const;
102 
103 protected:
104  // set the name of the surface - intentionally not public because
105  // name needs to be managed at the CSGSurfaceList level
106  void setName(const std::string & name) { _name = name; }
107 
109  std::string _name;
110 
113  const std::string _surface_type;
114 
115  // CSGSurfaceList needs to be friend to access setName()
116  friend class CSGSurfaceList;
117 
118 #ifdef MOOSE_UNIT_TEST
119  FRIEND_TEST(CSGSurfaceTest, testSetName);
123 #endif
124 };
125 } // namespace CSG
std::string name(const ElemQuality q)
const std::string & getName() const
Get the name of surface.
Definition: CSGSurface.h:95
void setName(const std::string &name)
Definition: CSGSurface.h:106
Halfspace
Enum for the sign of the half-space being represented by a point and surface.
Definition: CSGSurface.h:30
virtual Real evaluateSurfaceEquationAtPoint(const Point &p) const =0
given a point, determine its evaluation based on the surface equation.
bool operator==(const CSGSurface &other) const
Operator overload for checking if two CSGSurface objects are equal.
Definition: CSGSurface.C:37
FRIEND_TEST(CSGSurfaceTest, testSetName)
Friends for unit testing.
virtual std::unordered_map< std::string, Real > getCoeffs() const =0
Get the coefficients that define the surface.
virtual ~CSGSurface()=default
Destructor.
const std::string _surface_type
Type of surface that is being represented string is taken directly from the surface class name...
Definition: CSGSurface.h:113
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::string _name
Name of surface.
Definition: CSGSurface.h:109
CSGSurfaceList is a container for storing CSGSurface objects in the CSGBase object.
CSGSurface creates an internal representation of a Constructive Solid Geometry (CSG) surface...
Definition: CSGSurface.h:26
CSGSurface(const std::string &name)
Default constructor.
CSGSurface::Halfspace getHalfspaceFromPoint(const Point &p) const
given a point, determine if it is in the positive or negative half-space for the surface ...
Definition: CSGSurface.C:21
bool operator!=(const CSGSurface &other) const
Operator overload for checking if two CSGSurface objects are not equal.
Definition: CSGSurface.C:45
const std::string & getSurfaceType() const
Get the Surface Type.
Definition: CSGSurface.h:61