Chombo + EB  3.2
SmoothUnion.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _SMOOTHUNION_H_
12 #define _SMOOTHUNION_H_
13 
14 #include "MayDay.H"
15 #include "RealVect.H"
16 #include "Vector.H"
17 
18 #include "BaseIF.H"
19 
20 #include "NamespaceHeader.H"
21 
22 ///
23 /**
24  This implicit function is the maximum of two (of more) implicit
25  functions with which it is constructed. This results in an implicit
26  function whose interior is the intersection of the interiors of the given
27  implicit functions.
28  For the maximum, it uses the smooth absolute value Ae(a,b) \approx |a-b|
29  min(a,b) = 0.5*(a+b - | a-b |)
30 */
31 class SmoothUnion: public BaseIF
32 {
33 public:
34 
35  ///
36  /**
37  Constructor specifying any number of implicit functions as inputs.
38  */
39  SmoothUnion(const Vector<BaseIF*>& a_impFuncs,
40  const Real & a_delta);
41 
42  /// Destructor
43  virtual ~SmoothUnion();
44 
45  ///
46  /**
47  Return the value of the function at a_point.
48  */
49  virtual Real value(const RealVect& a_point) const;
50 
51  ///
52  virtual Real derivative(const IntVect& a_deriv,
53  const RealVect& a_point) const;
54 
55 
56  virtual BaseIF* newImplicitFunction() const;
57 
58  //min(a,b) = 0.5*(a+b - | a-b |)
59  virtual Real smoothMin(const IntVect & a_deriv,
60  const RealVect & a_point,
61  const int & a_closestIF,
62  const int & a_nextClosestIF) const;
63 
64  void findClosest(int & a_closestIF,
65  int & a_nextClosestIF,
66  int & a_numWithinDelta,
67  const RealVect & a_point) const;
68 protected:
69  int m_numFuncs; // number of implicit functions
70  Vector<BaseIF*> m_impFuncs; // implicit functions
71  Real m_delta ; //smoothing length scale
72 
73 private:
75  {
76  MayDay::Abort("SmoothUnion uses strong construction");
77  }
78 
79  SmoothUnion(const SmoothUnion& a_inputIF)
80  {
81  MayDay::Abort("SmoothUnion does not have copy construction");
82  }
83 
84  void operator=(const SmoothUnion& a_inputIF)
85  {
86  MayDay::Abort("SmoothUnion doesn't allow assignment");
87  }
88 };
89 
90 #include "NamespaceFooter.H"
91 #endif
void operator=(const SmoothUnion &a_inputIF)
Definition: SmoothUnion.H:84
one dimensional dynamic array
Definition: Vector.H:53
virtual BaseIF * newImplicitFunction() const
Definition: BaseIF.H:32
void findClosest(int &a_closestIF, int &a_nextClosestIF, int &a_numWithinDelta, const RealVect &a_point) const
virtual Real derivative(const IntVect &a_deriv, const RealVect &a_point) const
return the partial derivative at the point
double Real
Definition: REAL.H:33
SmoothUnion(const SmoothUnion &a_inputIF)
Definition: SmoothUnion.H:79
Definition: SmoothUnion.H:31
virtual Real smoothMin(const IntVect &a_deriv, const RealVect &a_point, const int &a_closestIF, const int &a_nextClosestIF) const
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
SmoothUnion()
Definition: SmoothUnion.H:74
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Vector< BaseIF * > m_impFuncs
Definition: SmoothUnion.H:70
int m_numFuncs
Definition: SmoothUnion.H:69
virtual ~SmoothUnion()
Destructor.
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).
virtual Real value(const RealVect &a_point) const
Real m_delta
Definition: SmoothUnion.H:71