AnalyticFunction Class Reference

#include <analytic_function.h>

Inheritance diagram for AnalyticFunction:

List of all members.

Public Member Functions

 AnalyticFunction (Number fptr(const Point &p, const Real time))
 AnalyticFunction (void fptr(DenseVector< Number > &output, const Point &p, const Real time))
 ~AnalyticFunction ()
void init ()
Number operator() (const Point &p, const Real time=0.)
void operator() (const Point &p, const Real time, DenseVector< Number > &output)
virtual void clear ()=0
void operator() (const Point &p, DenseVector< Number > &output)
bool initialized () const

Public Attributes

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

Protected Attributes

const FunctionBase_master
bool _initialized


Detailed Description

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 48 of file analytic_function.h.


Constructor & Destructor Documentation

AnalyticFunction::AnalyticFunction ( Number   fptrconst Point &p,const Real time  ) 

Constructor. Takes a function pointer for scalar return values.

Definition at line 32 of file analytic_function.C.

References FunctionBase::_initialized.

00033                                                                   :
00034   FunctionBase (),
00035   _number_fptr (fptr)
00036 {
00037   libmesh_assert (fptr != NULL);
00038   this->_initialized = true;
00039 }

AnalyticFunction::AnalyticFunction ( void   fptrDenseVector< Number > &output,const Point &p,const Real time  ) 

Constructor. Takes a function pointer for vector valued functions.

Definition at line 44 of file analytic_function.C.

References FunctionBase::_initialized.

00046                                                                 :
00047   FunctionBase (),
00048   _vector_fptr (fptr)
00049 {
00050   libmesh_assert (fptr != NULL);
00051   this->_initialized = true;
00052 }

AnalyticFunction::~AnalyticFunction (  ) 

Destructor.

Definition at line 57 of file analytic_function.C.

00058 {
00059 }


Member Function Documentation

virtual void FunctionBase::clear (  )  [pure virtual, inherited]

Clears the function.

Implemented in MeshFunction.

void AnalyticFunction::init (  )  [virtual]

The actual initialization process.

Implements FunctionBase.

Definition at line 65 of file analytic_function.C.

References FunctionBase::_initialized, _number_fptr, and _vector_fptr.

00066 {
00067   // dumb double-test
00068   libmesh_assert ((_number_fptr != NULL) || (_vector_fptr != NULL));
00069 
00070   // definitely ready
00071   this->_initialized = true;
00072 }

bool FunctionBase::initialized (  )  const [inline, inherited]

Returns:
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 144 of file function_base.h.

References FunctionBase::_initialized.

Referenced by MeshFunction::disable_out_of_mesh_mode(), MeshFunction::enable_out_of_mesh_mode(), MeshFunction::get_point_locator(), MeshFunction::gradient(), MeshFunction::hessian(), MeshFunction::operator()(), and operator()().

00145 {
00146   return (this->_initialized);
00147 }

void FunctionBase::operator() ( const Point p,
DenseVector< Number > &  output 
) [inline, inherited]

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

Definition at line 152 of file function_base.h.

References FunctionBase::operator()().

00154 {
00155   // Call the time-dependent function with t=0.
00156   this->operator()(p, 0., output);
00157 }

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

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

Implements FunctionBase.

Definition at line 124 of file analytic_function.h.

References _vector_fptr, and FunctionBase::initialized().

00127 {
00128   libmesh_assert (this->initialized());
00129   this->_vector_fptr(output, p, time);
00130   return;
00131 }

Number AnalyticFunction::operator() ( const Point p,
const Real  time = 0. 
) [inline, virtual]

Returns:
the value at point p and time time, which defaults to zero.

Implements FunctionBase.

Definition at line 114 of file analytic_function.h.

References _number_fptr, and FunctionBase::initialized().

00116 {
00117   libmesh_assert (this->initialized());
00118   return (this->_number_fptr(p, time));
00119 }


Member Data Documentation

bool FunctionBase::_initialized [protected, inherited]

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

Definition at line 136 of file function_base.h.

Referenced by AnalyticFunction(), MeshFunction::clear(), MeshFunction::init(), init(), and FunctionBase::initialized().

const FunctionBase* FunctionBase::_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 130 of file function_base.h.

Referenced by MeshFunction::clear(), MeshFunction::gradient(), MeshFunction::hessian(), MeshFunction::init(), MeshFunction::operator()(), and MeshFunction::~MeshFunction().

Number(* AnalyticFunction::_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 init(), and operator()().

void(* AnalyticFunction::_vector_fptr)(DenseVector< Number > &output, const Point &p, const Real time)

Pointer to user-provided vector valued function.

Referenced by init(), and operator()().


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

Site Created By: libMesh Developers
Last modified: November 25 2009 03:43:54.

Hosted By:
SourceForge.net Logo