chombo-discharge
CD_SignedDistanceBVH.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_SignedDistanceBVH_H
13 #define CD_SignedDistanceBVH_H
14 
15 // Std includes
16 #include <memory>
17 #include <chrono>
18 
19 // EBGeometry includes
20 #include <EBGeometry.hpp>
21 
22 // Chombo includes
23 #include <BaseIF.H>
24 
25 // Our includes
26 #include <CD_NamespaceHeader.H>
27 
33 template <class T, class BV, int K>
34 class SignedDistanceBVH : public BaseIF
35 {
36 public:
40  using Vec3 = EBGeometry::Vec3T<T>;
41 
45  using Face = EBGeometry::DCEL::FaceT<T>;
46 
50  using Node = EBGeometry::BVH::LinearBVH<T, Face, BV, K>;
51 
55  SignedDistanceBVH() = delete;
56 
63  SignedDistanceBVH(const std::shared_ptr<Node>& a_root, const bool a_flipInside, const Real a_zCoord = 0.0);
64 
68  SignedDistanceBVH(const SignedDistanceBVH& a_object);
69 
73  virtual ~SignedDistanceBVH();
74 
79  Real
80  value(const RealVect& a_point) const override;
81 
85  BaseIF*
86  newImplicitFunction() const override;
87 
88 protected:
92  Real m_zCoord;
93 
97  std::shared_ptr<Node> m_root;
98 
103 
107  mutable long m_numCalled;
108 
112  mutable std::chrono::duration<double> m_timespan;
113 };
114 
115 #include <CD_NamespaceFooter.H>
116 
118 
119 #endif
Implementation of CD_SignedDistanceBVH.H.
Signed distance function for a DCEL mesh.
Definition: CD_SignedDistanceBVH.H:35
bool m_flipInside
Hook for turning inside to outside.
Definition: CD_SignedDistanceBVH.H:102
Real m_zCoord
For 2D only. This is the z-coordinate through which we slice the object.
Definition: CD_SignedDistanceBVH.H:92
BaseIF * newImplicitFunction() const override
Factory method. Sends pointers around.
Definition: CD_SignedDistanceBVHImplem.H:87
SignedDistanceBVH()=delete
Disallowed weak construction.
std::shared_ptr< Node > m_root
Pointer to root node in bounding volume hierarchy.
Definition: CD_SignedDistanceBVH.H:97
EBGeometry::BVH::LinearBVH< T, Face, BV, K > Node
Alias for BVH node with precision T, enclosing DCEL face with a bounding volume type V.
Definition: CD_SignedDistanceBVH.H:50
std::chrono::duration< double > m_timespan
Total time spent computing the signed distance. Use for performance tracking.
Definition: CD_SignedDistanceBVH.H:112
EBGeometry::Vec3T< T > Vec3
Alias for always-3D vector with template.
Definition: CD_SignedDistanceBVH.H:40
EBGeometry::DCEL::FaceT< T > Face
DCEL polygon face, which is the primitive type enclosed in the bounding volume hierarchy.
Definition: CD_SignedDistanceBVH.H:45
virtual ~SignedDistanceBVH()
Destructor (does nothing)
Definition: CD_SignedDistanceBVHImplem.H:49
long m_numCalled
Number of times the implicit function was called. Use for performance tracking.
Definition: CD_SignedDistanceBVH.H:107
Real value(const RealVect &a_point) const override
Value function.
Definition: CD_SignedDistanceBVHImplem.H:60