Chombo + EB + MF  3.2
SmoothIntersection.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 _SMOOTHINTERSECTION_H_
12 #define _SMOOTHINTERSECTION_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  max(a,b) = 0.5*(a+b + | a-b |)
30 */
32 {
33 public:
34 
35  ///
36  /**
37  Constructor specifying any number of implicit functions as inputs.
38  */
39  SmoothIntersection(const Vector<BaseIF*>& a_impFuncs,
40  const Real & a_delta);
41 
42  /// Destructor
43  virtual ~SmoothIntersection();
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  ///max(a,b) = 0.5*(a+b + | a-b |)
59  /**
60  loops through all the functions
61  */
62  virtual Real smoothMax(const IntVect & a_deriv,
63  const RealVect & a_point,
64  const int & a_closestIF,
65  const int & a_nextClosestIF
66  ) const;
67 
68  void findClosest(int & a_closestIF,
69  int & a_nextClosestIF,
70  int & a_numWithinDelta,
71  const RealVect & a_point) const;
72 
73 protected:
74  int m_numFuncs; // number of implicit functions
75  Vector<BaseIF*> m_impFuncs; // implicit functions
76  Real m_delta ; //smoothing length scale
77 
78 
79  //debug stuff
83 
84 
85 
86 private:
88  {
89  MayDay::Abort("SmoothIntersection uses strong construction");
90  }
91 
93  {
94  MayDay::Abort("SmoothIntersection does not have copy construction");
95  }
96 
97  void operator=(const SmoothIntersection& a_inputIF)
98  {
99  MayDay::Abort("SmoothIntersection doesn't allow assignment");
100  }
101 };
102 
103 #include "NamespaceFooter.H"
104 #endif
void findClosest(int &a_closestIF, int &a_nextClosestIF, int &a_numWithinDelta, const RealVect &a_point) const
Vector< BaseIF * > m_impFuncs
Definition: SmoothIntersection.H:75
int m_numFuncs
Definition: SmoothIntersection.H:74
one dimensional dynamic array
Definition: Vector.H:53
Definition: SmoothIntersection.H:31
virtual Real smoothMax(const IntVect &a_deriv, const RealVect &a_point, const int &a_closestIF, const int &a_nextClosestIF) const
max(a,b) = 0.5*(a+b + | a-b |)
void operator=(const SmoothIntersection &a_inputIF)
Definition: SmoothIntersection.H:97
SmoothIntersection()
Definition: SmoothIntersection.H:87
Real m_delta
Definition: SmoothIntersection.H:76
virtual BaseIF * newImplicitFunction() const
Definition: BaseIF.H:32
IntVect m_ivDebug
Definition: SmoothIntersection.H:80
double Real
Definition: REAL.H:33
virtual Real value(const RealVect &a_point) const
virtual Real derivative(const IntVect &a_deriv, const RealVect &a_point) const
return the partial derivative at the point
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Real m_dxDebug
Definition: SmoothIntersection.H:81
RealVect m_rvDebug
Definition: SmoothIntersection.H:82
SmoothIntersection(const SmoothIntersection &a_inputIF)
Definition: SmoothIntersection.H:92
virtual ~SmoothIntersection()
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).