libMesh::AnalyticFunction< Output > Class Template Reference

#include <analytic_function.h>

Inheritance diagram for libMesh::AnalyticFunction< Output >:

List of all members.

Public Member Functions

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

Public Attributes

Output(* _number_fptr )(const Point &p, const Real time)
void(* _vector_fptr )(DenseVector< Output > &output, const Point &p, const Real time)

Protected Attributes

const FunctionBase_master
bool _initialized

Detailed Description

template<typename Output = Number>
class libMesh::AnalyticFunction< Output >

This class provides function-like objects for which an analytical expression can be provided. The user may either provide vector-return or number-return functions.

Author:
Daniel Dreyer, 2003

Definition at line 50 of file analytic_function.h.


Constructor & Destructor Documentation

template<typename Output >
libMesh::AnalyticFunction< Output >::AnalyticFunction ( Output   fptrconst Point &p,const Real time  )  [inline]

Constructor. Takes a function pointer for scalar return values.

Definition at line 150 of file analytic_function.h.

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

00151                                                                           :
00152   FunctionBase<Output> (),
00153   _number_fptr (fptr),
00154   _vector_fptr (NULL)
00155 {
00156   libmesh_assert(fptr);
00157   this->_initialized = true;
00158 }

template<typename Output >
libMesh::AnalyticFunction< Output >::AnalyticFunction ( void   fptrDenseVector< Output > &output,const Point &p,const Real time  )  [inline]

Constructor. Takes a function pointer for vector valued functions.

Definition at line 164 of file analytic_function.h.

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

00166                                                                         :
00167   FunctionBase<Output> (),
00168   _number_fptr (NULL),
00169   _vector_fptr (fptr)
00170 {
00171   libmesh_assert(fptr);
00172   this->_initialized = true;
00173 }

template<typename Output >
libMesh::AnalyticFunction< Output >::~AnalyticFunction (  )  [inline]

Destructor.

Definition at line 179 of file analytic_function.h.

00180 {
00181 }


Member Function Documentation

template<typename Output >
void libMesh::AnalyticFunction< Output >::clear (  )  [inline, virtual]

Clears the function.

Reimplemented from libMesh::FunctionBase< Output >.

Definition at line 199 of file analytic_function.h.

References libMesh::FunctionBase< Output >::_initialized, libMesh::AnalyticFunction< Output >::_number_fptr, and libMesh::AnalyticFunction< Output >::_vector_fptr.

00200 {
00201   // We probably need a method to reset these later...
00202   _number_fptr = NULL;
00203   _vector_fptr = NULL;
00204 
00205   // definitely not ready
00206   this->_initialized = false;
00207 }

template<typename Output >
AutoPtr< FunctionBase< Output > > libMesh::AnalyticFunction< Output >::clone (  )  const [inline, virtual]

Returns a new deep copy of the function.

Implements libMesh::FunctionBase< Output >.

Definition at line 214 of file analytic_function.h.

References libMesh::AnalyticFunction< Output >::_number_fptr, and libMesh::AnalyticFunction< Output >::_vector_fptr.

00215 {
00216   return AutoPtr<FunctionBase<Output> >
00217     ( _number_fptr ?
00218         new AnalyticFunction<Output>(_number_fptr) :
00219         new AnalyticFunction<Output>(_vector_fptr) );
00220 }

template<typename Output >
Output libMesh::FunctionBase< Output >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
) [inline, virtual, inherited]
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::BoundaryProjectSolution::operator()(), libMesh::ProjectFEMSolution::operator()(), and libMesh::ProjectSolution::operator()().

00206 {
00207   DenseVector<Output> outvec(i+1);
00208   (*this)(p, time, outvec);
00209   return outvec(i);
00210 }

template<typename Output >
void libMesh::AnalyticFunction< Output >::init (  )  [inline, virtual]

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Output >.

Definition at line 186 of file analytic_function.h.

References libMesh::FunctionBase< Output >::_initialized, libMesh::AnalyticFunction< Output >::_number_fptr, and libMesh::AnalyticFunction< Output >::_vector_fptr.

00187 {
00188   // dumb double-test
00189   libmesh_assert ((_number_fptr != NULL) || (_vector_fptr != NULL));
00190 
00191   // definitely ready
00192   this->_initialized = true;
00193 }

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

Definition at line 194 of file function_base.h.

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

Referenced by libMesh::AnalyticFunction< Output >::operator()().

00195 {
00196   return (this->_initialized);
00197 }

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

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.

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

00218 {
00219   // Call the time-dependent function with t=0.
00220   this->operator()(p, 0., output);
00221 }

template<typename Output >
void libMesh::AnalyticFunction< Output >::operator() ( const Point p,
const Real  time,
DenseVector< Output > &  output 
) [inline, virtual]

Like before, but returns the values in a writable reference.

Implements libMesh::FunctionBase< Output >.

Definition at line 138 of file analytic_function.h.

References libMesh::AnalyticFunction< Output >::_vector_fptr, and libMesh::FunctionBase< Output >::initialized().

00141 {
00142   libmesh_assert (this->initialized());
00143   this->_vector_fptr(output, p, time);
00144   return;
00145 }

template<typename Output >
Output libMesh::AnalyticFunction< Output >::operator() ( const Point p,
const Real  time = 0. 
) [inline, virtual]
Returns:
the value at point p and time time, which defaults to zero.

Implements libMesh::FunctionBase< Output >.

Definition at line 127 of file analytic_function.h.

References libMesh::AnalyticFunction< Output >::_number_fptr, and libMesh::FunctionBase< Output >::initialized().

00129 {
00130   libmesh_assert (this->initialized());
00131   return (this->_number_fptr(p, time));
00132 }


Member Data Documentation

template<typename Output = Number>
const FunctionBase* libMesh::FunctionBase< Output >::_master [protected, inherited]

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.

template<typename Output = Number>
Output(* libMesh::AnalyticFunction< Output >::_number_fptr)(const Point &p, const Real time)

Pointer to user-provided function that computes the boundary values when an analytical expression is available.

Referenced by libMesh::AnalyticFunction< Output >::clear(), libMesh::AnalyticFunction< Output >::clone(), libMesh::AnalyticFunction< Output >::init(), and libMesh::AnalyticFunction< Output >::operator()().

template<typename Output = Number>
void(* libMesh::AnalyticFunction< Output >::_vector_fptr)(DenseVector< Output > &output, const Point &p, const Real time)

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

Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:06 UTC

Hosted By:
SourceForge.net Logo