$extrastylesheet
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 UniquePtr
< 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)

Constructor. Takes a function pointer for scalar return values.

Definition at line 150 of file analytic_function.h.

References libMesh::FunctionBase< Output >::_initialized, and libMesh::libmesh_assert().

                                                                          :
  FunctionBase<Output> (),
  _number_fptr (fptr),
  _vector_fptr (NULL)
{
  libmesh_assert(fptr);
  this->_initialized = true;
}
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, and libMesh::libmesh_assert().

                                                                        :
  FunctionBase<Output> (),
  _number_fptr (NULL),
  _vector_fptr (fptr)
{
  libmesh_assert(fptr);
  this->_initialized = true;
}
template<typename Output >
libMesh::AnalyticFunction< Output >::~AnalyticFunction ( ) [inline]

Destructor.

Definition at line 179 of file analytic_function.h.

{
}

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.

{
  // We probably need a method to reset these later...
  _number_fptr = NULL;
  _vector_fptr = NULL;

  // definitely not ready
  this->_initialized = false;
}
template<typename Output >
UniquePtr< 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.

{
  return UniquePtr<FunctionBase<Output> >
    ( _number_fptr ?
      new AnalyticFunction<Output>(_number_fptr) :
      new AnalyticFunction<Output>(_vector_fptr) );
}
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, OutputGradient >, libMesh::CompositeFunction< Output >, and libMesh::WrappedFunction< Output >.

Definition at line 207 of file function_base.h.

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

{
  DenseVector<Output> outvec(i+1);
  (*this)(p, time, outvec);
  return outvec(i);
}
template<typename Output >
void libMesh::AnalyticFunction< Output >::init ( ) [virtual]

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Output >.

Definition at line 186 of file analytic_function.h.

References libMesh::libmesh_assert().

{
  // dumb double-test
  libmesh_assert ((_number_fptr != NULL) || (_vector_fptr != NULL));

  // definitely ready
  this->_initialized = true;
}
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 198 of file function_base.h.

{
  return (this->_initialized);
}
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::initialized(), and libMesh::libmesh_assert().

{
  libmesh_assert (this->initialized());
  return (this->_number_fptr(p, time));
}
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 220 of file function_base.h.

{
  // Call the time-dependent function with t=0.
  this->operator()(p, 0., output);
}
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::initialized(), and libMesh::libmesh_assert().

{
  libmesh_assert (this->initialized());
  this->_vector_fptr(output, p, time);
  return;
}

Member Data Documentation

template<typename Output = Number>
bool libMesh::FunctionBase< Output >::_initialized [protected, inherited]
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 164 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.

Definition at line 79 of file analytic_function.h.

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

Pointer to user-provided vector valued function.

Definition at line 85 of file analytic_function.h.


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