Chombo + EB + MF  3.2
PolynomialIF.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 _POLYNOMIALIF_H_
12 #define _POLYNOMIALIF_H_
13
14 #include "MayDay.H"
15 #include "RealVect.H"
16 #include "Vector.H"
17 #include "IndexTM.H"
18
19 #include "BaseIF.H"
20
22
23 ///
24 /**
25  This represents one term in a general polynomial
26  */
27 class PolyTerm
28 {
29 public:
30  ///
31  /**
32  Partial derivative
33  */
34  void partialDerivative(PolyTerm & a_partial,
35  const IntVect & a_whichPartial,
36  const PolyTerm & a_poly) const;
37
38  ///
39  /**
40  First order partial
41  */
42  void firstOrderPartial(PolyTerm & a_partial,
43  const int & a_whichPartial) const;
44
45
46  ///
47  /**
48  Coefficient of this polynomial term
49  */
51
52  ///
53  /**
54  Powers of this polynomial term
55  */
57 };
58
59 ///
60 /**
61  This implicit function specifies a general polynomial function.
62 */
63 class PolynomialIF: public BaseIF
64 {
65 public:
66  ///
67  /**
68  Constructor specifying the term composing the polynomial (a_polynomial)
69  and whether the domain is on the inside (a_inside), i.e. where the
70  function is negative.
71  */
72  PolynomialIF(const Vector<PolyTerm>& a_polynomial,
73  const bool& a_inside);
74
75  /// Copy constructor
76  PolynomialIF(const PolynomialIF& a_inputIF);
77
78  /// Destructor
79  virtual ~PolynomialIF();
80
81  ///
82  /**
83  Return the parameter information
84  */
85  virtual void GetParams(Vector<PolyTerm>& a_polynomial,
86  bool& a_inside) const;
87
88  ///
89  /**
90  Set the parameter information
91  */
92  virtual void SetParams(const Vector<PolyTerm>& a_polynomial,
93  const bool& a_inside);
94
95  ///
96  /**
97  Return the value of the function at a_point using a_polynomial
98  */
99  virtual Real value(const RealVect & a_point,
100  const Vector<PolyTerm> & a_polynomial) const;
101
102  ///
103  /**
104  Return the value of the function at a_point.
105  */
106  virtual Real value(const RealVect& a_point) const;
107
108  ///
109  /**
110  Return the value of the derivative at a_point.
111  */
112  virtual Real value(const IndexTM<int,GLOBALDIM> & a_partialDerivative,
113  const IndexTM<Real,GLOBALDIM>& a_point) const;
114  ///
115  /**
116  Partial derivative
117  */
118  virtual void partialDerivative(Vector<PolyTerm> & a_partial,
119  const IntVect & a_whichPartialOp,
120  const Vector<PolyTerm> & a_polynomial)const;
121
122  virtual BaseIF* newImplicitFunction() const;
123
124 protected:
125  Vector<PolyTerm> m_polynomial; // polynomial (term by term)
126  bool m_inside; // inside flag
127
128 private:
130  {
131  MayDay::Abort("PolynomialIF uses strong construction");
132  }
133
134  void operator=(const PolynomialIF& a_inputIF)
135  {
136  MayDay::Abort("PolynomialIF doesn't allow assignment");
137  }
138 };
139
140 #include "NamespaceFooter.H"
141 #endif
IntVect powers
Definition: PolynomialIF.H:56
Real coef
Definition: PolynomialIF.H:50
Definition: IndexTM.H:36
void firstOrderPartial(PolyTerm &a_partial, const int &a_whichPartial) const
Definition: PolynomialIF.H:63
void operator=(const PolynomialIF &a_inputIF)
Definition: PolynomialIF.H:134
Definition: BaseIF.H:32
void partialDerivative(PolyTerm &a_partial, const IntVect &a_whichPartial, const PolyTerm &a_poly) const
double Real
Definition: REAL.H:33
Definition: PolynomialIF.H:27
Vector< PolyTerm > m_polynomial
Definition: PolynomialIF.H:125
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
PolynomialIF()
Definition: PolynomialIF.H:129
bool m_inside
Definition: PolynomialIF.H:126
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).