Chombo + EB  3.2
SumIF.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 _SUMIF_H_
12 #define _SUMIF_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 sum of two (of more) implicit
25  functions with which it is constructed.
26  */
27 class SumIF: public BaseIF
28 {
29 public:
30  ///
31  /**
32  Constructor specifying two implicit functions as inputs.
33  */
34  SumIF(const BaseIF& a_impFunc1,
35  const BaseIF& a_impFunc2,
36  const bool& a_sign);
37 
38  ///
39  /**
40  Constructor specifying any number of implicit functions as inputs.
41  */
42  SumIF(const Vector<BaseIF*>& a_impFuncs);
43 
44  /// Copy constructor
45  SumIF(const SumIF& a_inputIF);
46 
47  /// Destructor
48  virtual ~SumIF();
49 
50  void setSign(bool a_sign);
51 
52  ///
53  /**
54  Return the value of the function at a_point.
55  */
56  virtual Real value(const RealVect& a_point) const;
57 
58  virtual Real value(const IndexTM<Real,GLOBALDIM>& a_point) const;
59 
60  virtual Real value(const IndexTM<int,GLOBALDIM> & a_partialDerivative,
61  const IndexTM<Real,GLOBALDIM>& a_point) const;
62 
63  virtual bool getSign() const;
64 
65  virtual BaseIF* getImplicitFunction(int a_num);
66 
67  virtual BaseIF* newImplicitFunction() const;
68 
69  ///
70  /**
71  Pass this call onto the IFs contained in this IF class.
72  */
73  virtual void boxLayoutChanged(const DisjointBoxLayout & a_newBoxLayout,
74  const RealVect & a_dx)
75  {
76  for (int i = 0; i < m_numFuncs; i++)
77  {
78  m_impFuncs[i]->boxLayoutChanged(a_newBoxLayout,a_dx);
79  }
80  }
81 
82 protected:
83  int m_numFuncs; // number of implicit functions
84  Vector<BaseIF*> m_impFuncs; // implicit functions
85  bool m_sign; // if true -> sum of all IF //if false the first IF minus the second one (never happen when m_numFuncs > 2)
86 
87 private:
89  {
90  MayDay::Abort("SumIF uses strong construction");
91  }
92 
93  void operator=(const SumIF& a_inputIF)
94  {
95  MayDay::Abort("SumIF doesn't allow assignment");
96  }
97 };
98 
99 #include "NamespaceFooter.H"
100 #endif
bool m_sign
Definition: SumIF.H:85
void operator=(const SumIF &a_inputIF)
Definition: SumIF.H:93
virtual BaseIF * newImplicitFunction() const
one dimensional dynamic array
Definition: Vector.H:53
virtual BaseIF * getImplicitFunction(int a_num)
Definition: BaseIF.H:32
double Real
Definition: REAL.H:33
virtual bool getSign() const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
int m_numFuncs
Definition: SumIF.H:83
SumIF()
Definition: SumIF.H:88
virtual Real value(const RealVect &a_point) const
virtual ~SumIF()
Destructor.
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual void boxLayoutChanged(const DisjointBoxLayout &a_newBoxLayout, const RealVect &a_dx)
Definition: SumIF.H:73
void setSign(bool a_sign)
Definition: SumIF.H:27
Vector< BaseIF * > m_impFuncs
Definition: SumIF.H:84
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).