libMesh::FunctionBase< Output > Class Template Referenceabstract

#include <dirichlet_boundaries.h>

Inheritance diagram for libMesh::FunctionBase< Output >:

Public Member Functions

virtual ~FunctionBase ()
 
virtual void init ()
 
virtual void clear ()
 
virtual UniquePtr< 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
 
void set_is_time_dependent (bool is_time_dependent)
 
bool is_time_dependent () const
 

Protected Member Functions

 FunctionBase (const FunctionBase *master=libmesh_nullptr)
 

Protected Attributes

const FunctionBase_master
 
bool _initialized
 
bool _is_time_dependent
 

Detailed Description

template<typename Output = Number>
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 afterward the virtual members allow the convenient and libMesh-common usage through a FunctionBase *.

Note
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.
For 2-D elements in 3 spatial dimensions, libMesh is expecting 2 components (i.e. mesh_dimension() number of components).
Author
Daniel Dreyer
Date
2003

Definition at line 44 of file dirichlet_boundaries.h.

Constructor & Destructor Documentation

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

Constructor. Optionally takes a master.

Definition at line 189 of file function_base.h.

189  :
190  _master (master),
191  _initialized (false),
192  _is_time_dependent (true) // Assume we are time-dependent until the user says otherwise
193 {
194 }
const FunctionBase * _master
template<typename Output >
libMesh::FunctionBase< Output >::~FunctionBase ( )
inlinevirtual

Destructor.

Definition at line 200 of file function_base.h.

201 {
202 }

Member Function Documentation

template<typename Output = Number>
virtual void libMesh::FunctionBase< Output >::clear ( )
inlinevirtual
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.
Note
Subclasses aren't required to override this, since the default implementation is based on the full vector evaluation, which is often correct.
Subclasses are recommended to override this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.

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

Definition at line 230 of file function_base.h.

Referenced by libMesh::FunctionBase< Real >::clear().

233 {
234  DenseVector<Output> outvec(i+1);
235  (*this)(p, time, outvec);
236  return outvec(i);
237 }
template<typename Output = Number>
virtual void libMesh::FunctionBase< Output >::init ( )
inlinevirtual
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 208 of file function_base.h.

References libMesh::FunctionBase< Output >::_initialized.

Referenced by libMesh::FunctionBase< Real >::clear(), and libMesh::AnalyticFunction< Output >::operator()().

209 {
210  return (this->_initialized);
211 }
template<typename Output >
bool libMesh::FunctionBase< Output >::is_time_dependent ( ) const
inline
template<typename Output>
void libMesh::FunctionBase< Output >::operator() ( const Point p,
DenseVector< Output > &  output 
)
inline

Evaluation function for time-independent vector-valued functions. Sets output values in the passed-in output DenseVector.

Definition at line 243 of file function_base.h.

References libMesh::FunctionBase< Output >::operator()().

245 {
246  // Call the time-dependent function with t=0.
247  this->operator()(p, 0., output);
248 }
virtual Output operator()(const Point &p, const Real time=0.)=0
template<typename Output = Number>
virtual void libMesh::FunctionBase< Output >::operator() ( const Point p,
const Real  time,
DenseVector< Output > &  output 
)
pure virtual
template<typename Output >
void libMesh::FunctionBase< Output >::set_is_time_dependent ( bool  is_time_dependent)
inline

Function to set whether this is a time-dependent function or not. This is intended to be only used by subclasses who cannot natively determine time-dependence. In such a case, this function should be used immediately following construction.

Definition at line 215 of file function_base.h.

References libMesh::FunctionBase< Output >::_is_time_dependent, and libMesh::FunctionBase< Output >::is_time_dependent().

Referenced by libMesh::FunctionBase< Real >::clear().

216 {
218 }
bool is_time_dependent() const

Member Data Documentation

template<typename Output = Number>
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 168 of file function_base.h.


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