Chombo + EB  3.2
VectorFunction.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 _VECTORFUNCTION_H_
12 #define _VECTORFUNCTION_H_
13 
14 #include "REAL.H"
15 #include "RealVect.H"
16 #include "IntVect.H"
17 #include "NamespaceHeader.H"
18 
19 //! \class VectorFunction
20 //! This base class represents a vector function \f$F: \mathbf{R}^D \rightarrow \mathbf{R}^D\f$.
22 {
23  public:
24 
25  //! Base class constructor. Must be called by subclasses.
26  //! \param a_homogeneous This flag indicates whether the vector function
27  //! is constant in space.
28  //! \param a_constant This flag indicates whether the vector function
29  //! is constant in time.
30  VectorFunction(bool a_homogeneous,
31  bool a_constant);
32 
33  //! Destructor.
34  virtual ~VectorFunction();
35 
36  //! Override this method to evaluate this function at the given
37  //! point in space and time.
38  //! \param a_x A point in \f$D\f$-dimensional space.
39  //! \param a_t The time at which the function is evaluated.
40  virtual RealVect operator()(const RealVect& a_x,
41  Real a_t) const = 0;
42 
43  //! Override this method to evaluate the given partial derivative of the
44  //! function at the given point in space and time.
45  //! \param a_order A multi-index identifying the order(s) of the
46  //! partial derivative of the function to be evaluated.
47  //! \param a_x A point in \f$D\f$-dimensional space.
48  //! \param a_t The time at which the derivative is to be evaluated.
49  virtual RealVect derivative(const IntVect& a_order,
50  const RealVect& a_x,
51  Real a_t) const;
52 
53  //! Override this method to return true if the derivative of the
54  //! requested order exists and is available, false if it is not.
55  //! This must be implemented in a way that is consistent with the
56  //! derivative method.
57  //! \param a_order A multi-index identifying the order(s) of the
58  //! desired partial derivative of the function.
59  virtual bool hasDerivative(const IntVect& a_order) const;
60 
61  //! This evaluates the function at time 0.
62  //! \param a_x A point in \f$D\f$-dimensional space.
63  RealVect operator()(const RealVect& a_x) const
64  {
65  return operator()(a_x, 0.0);
66  }
67 
68  //! This evaluates the given partial derivative of the function at time 0.
69  //! \param a_order A multi-index identifying the order(s) of the
70  //! partial derivative of the function to be evaluated.
71  //! \param a_x A point in \f$D\f$-dimensional space.
72  RealVect derivative(const IntVect& a_order,
73  const RealVect& a_x) const
74  {
75  return derivative(a_order, a_x, 0.0);
76  }
77 
78  //! Returns true if this function is homogeneous, false otherwise.
79  bool isHomogeneous() const
80  {
81  return m_isHomogeneous;
82  }
83 
84  //! Returns true if this function is constant, false otherwise.
85  bool isConstant() const
86  {
87  return m_isConstant;
88  }
89 
90  protected:
91 
93 
94  private:
95 
96  // Disallowed!
100 };
101 
102 #include "NamespaceFooter.H"
103 #endif
RealVect derivative(const IntVect &a_order, const RealVect &a_x) const
Definition: VectorFunction.H:72
virtual RealVect derivative(const IntVect &a_order, const RealVect &a_x, Real a_t) const
bool isHomogeneous() const
Returns true if this function is homogeneous, false otherwise.
Definition: VectorFunction.H:79
bool m_isConstant
Definition: VectorFunction.H:92
bool m_isHomogeneous
Definition: VectorFunction.H:92
VectorFunction & operator=(const VectorFunction &)
Definition: VectorFunction.H:21
virtual RealVect operator()(const RealVect &a_x, Real a_t) const =0
RealVect operator()(const RealVect &a_x) const
Definition: VectorFunction.H:63
double Real
Definition: REAL.H:33
bool isConstant() const
Returns true if this function is constant, false otherwise.
Definition: VectorFunction.H:85
virtual ~VectorFunction()
Destructor.
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
virtual bool hasDerivative(const IntVect &a_order) const