Chombo + EB  3.0
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  virtual BaseIF* newImplicitFunction() const;
63 
64  ///
65  /**
66  Pass this call onto the IFs contained in this IF class.
67  */
68  virtual void boxLayoutChanged(const DisjointBoxLayout & a_newBoxLayout,
69  const RealVect & a_dx)
70  {
71  m_impFunc ->boxLayoutChanged(a_newBoxLayout,a_dx);
72  m_mollifier->boxLayoutChanged(a_newBoxLayout,a_dx);
73  }
74 
75 protected:
76  BaseIF* m_impFunc; // function to mollify
77  BaseIF* m_mollifier; // mollifier
78 
79  Real m_min; // minimum of the mollifying neighborhood
80  Real m_max; // maximum of the mollifying neighborhood
81  int m_numPts; // number of sample points in meighborhood
82 
83  Real m_dx; // spacing in the sampled neighborhood
84  Box m_sampleBox; // the sample box
85 
86  // These are "mutable" so they can be modified in "const" methods - this is
87  // done so that they can be cached but ONLY if the function which needs them
88  // is called.
89  mutable Real m_mollifierSum; // the total of the samples
90  mutable FArrayBox m_sampledMollifier; // sampled mollifier
91 
92 private:
94  {
95  MayDay::Abort("MollifyIF uses strong construction");
96  }
97 
98  void operator=(const MollifyIF& a_inputIF)
99  {
100  MayDay::Abort("MollifyIF doesn't allow assignment");
101  }
102 };
103 
104 #include "NamespaceFooter.H"
105 #endif
BaseIF * m_mollifier
Definition: MollifyIF.H:77
MollifyIF()
Definition: MollifyIF.H:93
Real m_dx
Definition: MollifyIF.H:83
virtual void boxLayoutChanged(const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
Definition: BaseIF.H:140
Definition: BaseIF.H:30
Real m_max
Definition: MollifyIF.H:80
Definition: MollifyIF.H:29
Real m_mollifierSum
Definition: MollifyIF.H:89
double Real
Definition: REAL.H:33
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
void operator=(const MollifyIF &a_inputIF)
Definition: MollifyIF.H:98
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:76
virtual BaseIF * newImplicitFunction() const
Definition: FArrayBox.H:44
virtual Real value(const RealVect &a_point) const
virtual void boxLayoutChanged(const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
Definition: MollifyIF.H:68
virtual ~MollifyIF()
Destructor.
Box m_sampleBox
Definition: MollifyIF.H:84
FArrayBox m_sampledMollifier
Definition: MollifyIF.H:90
int m_numPts
Definition: MollifyIF.H:81
Real m_min
Definition: MollifyIF.H:79
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).