Chombo + EB  3.2
MollifyIF.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 _MOLLIFYIF_H_
12 #define _MOLLIFYIF_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 mollifies on implicit function using another
25  implicit function (e.g., "GaussianSphereIF"). Basically, the IF being
26  mollified is sampled in a small (specified) neighborhood of a point and
27  convolved with the mollifying function in this neighborhood.
28  */
29 class MollifyIF: public BaseIF
30 {
31 public:
32  ///
33  /**
34  Constructor specifying the implicit function to mollify (a_impFunc),
35  the mollifier (a_mollifier), a neighorhood to use (a_min, a_max) is
36  each dimension, and a sampling (a_numPts).
37  */
38  MollifyIF(const BaseIF& a_impFunc,
39  const BaseIF& a_mollifier,
40  const Real& a_min,
41  const Real& a_max,
42  const int& a_numPts);
43 
44  /// Copy constructor
45  MollifyIF(const MollifyIF& a_inputIF);
46 
47  /// Destructor
48  virtual ~MollifyIF();
49 
50  ///
51  /**
52  Return the value of the function at a_point.
53  */
54  virtual Real value(const RealVect& a_point) const;
55 
56  ///
57  /**
58  Return the value of the function at a_point.
59  */
60  virtual Real value(const IndexTM<Real,GLOBALDIM>& a_point) const;
61 
62  ///
63  /**
64  Return the partial derivative of the function at a_point.
65  */
66  virtual Real value(const IndexTM<int,GLOBALDIM> & a_partialDerivative,
67  const IndexTM<Real,GLOBALDIM>& a_point) const;
68 
69  virtual BaseIF* newImplicitFunction() const;
70 
71  ///
72  /**
73  Pass this call onto the IFs contained in this IF class.
74  */
75  virtual void boxLayoutChanged(const DisjointBoxLayout & a_newBoxLayout,
76  const RealVect & a_dx)
77  {
78  m_impFunc ->boxLayoutChanged(a_newBoxLayout,a_dx);
79  m_mollifier->boxLayoutChanged(a_newBoxLayout,a_dx);
80  }
81 
82 protected:
83  BaseIF* m_impFunc; // function to mollify
84  BaseIF* m_mollifier; // mollifier
85 
86  Real m_min; // minimum of the mollifying neighborhood
87  Real m_max; // maximum of the mollifying neighborhood
88  int m_numPts; // number of sample points in meighborhood
89 
90  Real m_dx; // spacing in the sampled neighborhood
91  Real m_vol; // volume of a sample
92  Box m_sampleBox; // the sample box
93 
94  // These are "mutable" so they can be modified in "const" methods - this is
95  // done so that they can be cached but ONLY if the function which needs them
96  // is called.
97  mutable Real m_mollifierSum; // the total of the samples
98  mutable FArrayBox m_sampledMollifier; // sampled mollifier
99 
100 private:
102  {
103  MayDay::Abort("MollifyIF uses strong construction");
104  }
105 
106  void operator=(const MollifyIF& a_inputIF)
107  {
108  MayDay::Abort("MollifyIF doesn't allow assignment");
109  }
110 };
111 
112 #include "NamespaceFooter.H"
113 #endif
BaseIF * m_mollifier
Definition: MollifyIF.H:84
Real m_vol
Definition: MollifyIF.H:91
MollifyIF()
Definition: MollifyIF.H:101
Real m_dx
Definition: MollifyIF.H:90
virtual void boxLayoutChanged(const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
Definition: BaseIF.H:259
Definition: BaseIF.H:32
Real m_max
Definition: MollifyIF.H:87
Definition: MollifyIF.H:29
Real m_mollifierSum
Definition: MollifyIF.H:97
double Real
Definition: REAL.H:33
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void operator=(const MollifyIF &a_inputIF)
Definition: MollifyIF.H:106
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
BaseIF * m_impFunc
Definition: MollifyIF.H:83
virtual BaseIF * newImplicitFunction() const
Definition: FArrayBox.H:45
virtual Real value(const RealVect &a_point) const
virtual void boxLayoutChanged(const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
Definition: MollifyIF.H:75
virtual ~MollifyIF()
Destructor.
Box m_sampleBox
Definition: MollifyIF.H:92
FArrayBox m_sampledMollifier
Definition: MollifyIF.H:98
int m_numPts
Definition: MollifyIF.H:88
Real m_min
Definition: MollifyIF.H:86
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).