libMesh::FunctionBase< Output > Class Template Referenceabstract

#include <exact_solution.h>

Inheritance diagram for libMesh::FunctionBase< Output >:

Public Member Functions

virtual ~FunctionBase ()
 
virtual void init ()
 
virtual void clear ()
 
virtual AutoPtr< FunctionBase
< Output > > 
clone () const =0
 
virtual Output operator() (const Point &p, const Real time=0.)=0
 
void operator() (const Point &p, DenseVector< Output > &output)
 
virtual void operator() (const Point &p, const Real time, DenseVector< Output > &output)=0
 
virtual Output component (unsigned int i, const Point &p, Real time=0.)
 
bool initialized () const
 

Protected Member Functions

 FunctionBase (const FunctionBase *master=NULL)
 

Protected Attributes

const FunctionBase_master
 
bool _initialized
 

Detailed Description

template<typename Output>
class libMesh::FunctionBase< Output >

This is the base class for functor-like classes. These entities are functions (in the mathematical sense) of time and space, $ f(\mathbf{x},t) = \mbox{\texttt{v}} $, where v may be either a Number or a DenseVector<Number>. Children of this base class implement different styles of data retrieval for these functions. Use the constructors of the derived classes for creating new objects. The required input of each derived class thwarts the effective use of the commonly used build() member. But afterwards the virtual members allow the convenient and libMesh-common usage through a FunctionBase*. Note that for functor objects for vector-valued variables, it is assumed each component is indexed contiguously; i.e. if u_var is index 3, then libMesh expects the x-component of u_var is index 3, the y-component is index 4, and the z-component is index 5. Note that for 2-D elements in 3 spatial dimensions, libMesh is expecting 2 components (i.e. mesh_dimension() number of components).

Author
Daniel Dreyer, 2003

Definition at line 39 of file exact_solution.h.

Constructor & Destructor Documentation

template<typename Output >
libMesh::FunctionBase< Output >::FunctionBase ( const FunctionBase< Output > *  master = NULL)
inlineexplicitprotected

Constructor. Optionally takes a master.

Definition at line 176 of file function_base.h.

176  :
177  _master (master),
178  _initialized (false)
179 {
180 }
template<typename Output >
libMesh::FunctionBase< Output >::~FunctionBase ( )
inlinevirtual

Destructor.

Definition at line 186 of file function_base.h.

187 {
188 }

Member Function Documentation

template<typename Output>
virtual void libMesh::FunctionBase< Output >::clear ( )
inlinevirtual

Clears the function.

Reimplemented in libMesh::ParsedFunction< Output >, libMesh::MeshFunction, and libMesh::AnalyticFunction< Output >.

Definition at line 90 of file function_base.h.

90 {}
template<typename Output >
Output libMesh::FunctionBase< Output >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtual
Returns
the vector component i at coordinate p and time time. Subclasses aren't required to overload this, since the default implementation is based on the full vector evaluation, which is often correct. Subclasses are recommended to overload this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.

Reimplemented in libMesh::ParsedFunction< Output >, and libMesh::WrappedFunction< Output >.

Definition at line 203 of file function_base.h.

Referenced by libMesh::ProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), and libMesh::BoundaryProjectSolution::operator()().

206 {
207  DenseVector<Output> outvec(i+1);
208  (*this)(p, time, outvec);
209  return outvec(i);
210 }
template<typename Output>
virtual void libMesh::FunctionBase< Output >::init ( )
inlinevirtual

The actual initialization process.

Reimplemented in libMesh::ParsedFunction< Output >, libMesh::MeshFunction, and libMesh::AnalyticFunction< Output >.

Definition at line 85 of file function_base.h.

85 {}
template<typename Output >
bool libMesh::FunctionBase< Output >::initialized ( ) const
inline
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 194 of file function_base.h.

195 {
196  return (this->_initialized);
197 }
template<typename Output>
virtual Output libMesh::FunctionBase< Output >::operator() ( const Point p,
const Real  time = 0. 
)
pure virtual
Returns
the scalar value at coordinate p and time time, which defaults to zero. Purely virtual, so you have to overload it. Note that this cannot be a const method, check MeshFunction.

Implemented in libMesh::ParsedFunction< Output >, libMesh::ParsedFunction< Output >, libMesh::MeshFunction, libMesh::AnalyticFunction< Output >, libMesh::WrappedFunction< Output >, and libMesh::ConstFunction< Output >.

template<typename Output>
void libMesh::FunctionBase< Output >::operator() ( const Point p,
DenseVector< Output > &  output 
)
inline

Return function for vectors. Returns in output the values of the data at the coordinate p.

Definition at line 216 of file function_base.h.

218 {
219  // Call the time-dependent function with t=0.
220  this->operator()(p, 0., output);
221 }
template<typename Output>
virtual void libMesh::FunctionBase< Output >::operator() ( const Point p,
const Real  time,
DenseVector< Output > &  output 
)
pure virtual

Return function for vectors. Returns in output the values of the data at the coordinate p and for time time. Purely virtual, so you have to overload it. Note that this cannot be a const method, check MeshFunction.

Implemented in libMesh::ParsedFunction< Output >, libMesh::MeshFunction, libMesh::ParsedFunction< Output >, libMesh::AnalyticFunction< Output >, libMesh::WrappedFunction< Output >, and libMesh::ConstFunction< Output >.

Member Data Documentation

template<typename Output>
bool libMesh::FunctionBase< Output >::_initialized
protected

When init() was called so that everything is ready for calls to operator() (...), then this bool is true.

Definition at line 166 of file function_base.h.

Referenced by libMesh::AnalyticFunction< Output >::AnalyticFunction(), libMesh::ConstFunction< Output >::ConstFunction(), libMesh::ParsedFunction< Output >::ParsedFunction(), and libMesh::WrappedFunction< Output >::WrappedFunction().

template<typename Output>
const FunctionBase* libMesh::FunctionBase< Output >::_master
protected

Const pointer to our master, initialized to NULL. There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.

Definition at line 160 of file function_base.h.


The documentation for this class was generated from the following files:

Site Created By: libMesh Developers
Last modified: February 07 2014 16:58:00 UTC

Hosted By:
SourceForge.net Logo