00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _TENSORFUNCTION_H_ 00012 #define _TENSORFUNCTION_H_ 00013 00014 #include "REAL.H" 00015 #include "RealVect.H" 00016 #include "RealTensor.H" 00017 #include "NamespaceHeader.H" 00018 00019 //! \class TensorFunction 00020 //! This base class represents a tensor function \f$T: \mathbf{R}^D \rightarrow \mathbf{R}^D\otimes\mathbf{R}^D\f$. 00021 class TensorFunction 00022 { 00023 public: 00024 00025 //! Base class constructor. Must be called by subclasses. 00026 //! \param a_homogeneous This flag indicates whether the tensor function 00027 //! is constant in space. 00028 //! \param a_constant This flag indicates whether the tensor function 00029 //! is constant in time. 00030 TensorFunction(bool a_homogeneous, 00031 bool a_constant); 00032 00033 //! Destructor. 00034 virtual ~TensorFunction(); 00035 00036 //! Override this method to evaluate this function at the given 00037 //! point in space and time. 00038 //! \param a_x A point in \f$D\f$-dimensional space. 00039 //! \param a_t The time at which the function is evaluated. 00040 virtual RealTensor operator()(const RealVect& a_x, 00041 Real a_t) const = 0; 00042 00043 //! This evaluates the function at time 0. 00044 //! \param a_x A point in \f$D\f$-dimensional space. 00045 RealTensor operator()(const RealVect& a_x) const 00046 { 00047 return operator()(a_x, 0.0); 00048 } 00049 00050 //! Returns true if this function is homogeneous, false otherwise. 00051 bool isHomogeneous() const 00052 { 00053 return m_isHomogeneous; 00054 } 00055 00056 //! Returns true if this function is constant, false otherwise. 00057 bool isConstant() const 00058 { 00059 return m_isConstant; 00060 } 00061 00062 protected: 00063 00064 bool m_isHomogeneous, m_isConstant; 00065 00066 private: 00067 00068 // Disallowed! 00069 TensorFunction(); 00070 TensorFunction(const TensorFunction&); 00071 TensorFunction& operator=(const TensorFunction&); 00072 }; 00073 00074 #include "NamespaceFooter.H" 00075 #endif