NSF Postdoctoral Research
A set of C++ code developed by Andrew E. Slaughter
SlaughterFEM::MyAnalyticFunction< Output > Class Template Reference

A class for using boost::functions with libmesh. More...

#include <my_analytic_function.h>

List of all members.

Public Member Functions

 MyAnalyticFunction (boost::function< Output(const Point &, const Real) > fptr)
 Class constructor for functions with scalar return values.
 MyAnalyticFunction (boost::function< void(DenseVector< Output > &, const Point &, const Real)> fptr)
 Class constructor for functions with vector output, void return.
 ~MyAnalyticFunction ()
 Class destructor.
void init ()
 An initialization function.
void clear ()
 Clears the function.
virtual AutoPtr< FunctionBase
< Output > > 
clone () const
 Returns a new deep copy of the function.
Output operator() (const Point &p, const Real t=0.)
 Allows the class to behave like a function.
void operator() (const Point &p, const Real t, DenseVector< Output > &output)
 Allows the class to behave like a function.

Public Attributes

boost::function< Output(const
Point &, const Real) > 
_number_fptr
boost::function< void(DenseVector
< Output > &, const Point
&, const Real) > 
_vector_fptr

Detailed Description

template<typename Output = Number>
class SlaughterFEM::MyAnalyticFunction< Output >

A class for using boost::functions with libmesh.

This class mimics the behavior of libMesh::AnalyticFunction but utilizes the boost::function behavior, as such both class members and functions can be used.

Examples:
fem/examples/example3.cpp, and fem/examples/example5.cpp.

Constructor & Destructor Documentation

template<typename Output = Number>
SlaughterFEM::MyAnalyticFunction< Output >::MyAnalyticFunction ( boost::function< Output(const Point &, const Real) >  fptr) [inline]

Class constructor for functions with scalar return values.

Parameters:
fptrA boost::function object that acts like a function pointer, this version outputs the type defined by the template parameter and takes a libMesh Point and Real (time) as input.
template<typename Output = Number>
SlaughterFEM::MyAnalyticFunction< Output >::MyAnalyticFunction ( boost::function< void(DenseVector< Output > &, const Point &, const Real)>  fptr) [inline]

Class constructor for functions with vector output, void return.

Parameters:
fptrA boost::function object that acts like a function pointer, this version output values through the DenseVector reference input (the type is defined as the template parameter) that is computed from the libMesh Point and Real (time) inputs.

Member Function Documentation

template<typename Output = Number>
void SlaughterFEM::MyAnalyticFunction< Output >::clear ( ) [inline]

Clears the function.

This sets the two boost::function objects to NULL, thus the function is set to be un-initilized.

template<typename Output = Number>
virtual AutoPtr<FunctionBase<Output> > SlaughterFEM::MyAnalyticFunction< Output >::clone ( ) const [inline, virtual]

Returns a new deep copy of the function.

Returns:
A new copy of the object, the new object is created with either the _number_fptr or _vector_ptr depending on which is initilized.
template<typename Output = Number>
void SlaughterFEM::MyAnalyticFunction< Output >::init ( ) [inline]

An initialization function.

This checks if either the _number_fptr or the _vector_fptr is valid, if so the class is marked as intilized.

template<typename Output = Number>
Output SlaughterFEM::MyAnalyticFunction< Output >::operator() ( const Point &  p,
const Real  t = 0. 
) [inline]

Allows the class to behave like a function.

/param p A libMesh point /param t The time /return The value of the function to which this class points at point p and time t (defaults to zero).


Member Data Documentation

template<typename Output = Number>
boost::function< Output (const Point&, const Real) > SlaughterFEM::MyAnalyticFunction< Output >::_number_fptr

Boost::function that points to a user provided class or function that computes the boundary values and has a scalar output.

template<typename Output = Number>
boost::function< void (DenseVector<Output>&, const Point&, const Real) > SlaughterFEM::MyAnalyticFunction< Output >::_vector_fptr

Boost::function that points to a user provided class or function that computes the boundary values and outputs a vector via the DenseVector input reference.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs