libMesh::AnalyticFunction< Output > Class Template Reference

#include <analytic_function.h>

Inheritance diagram for libMesh::AnalyticFunction< Output >:

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 ()
 
virtual void init () libmesh_override
 
virtual void clear () libmesh_override
 
virtual UniquePtr< FunctionBase< Output > > clone () const libmesh_override
 
virtual Output operator() (const Point &p, const Real time=0.) libmesh_override
 
virtual void operator() (const Point &p, const Real time, DenseVector< Output > &output) libmesh_override
 
void operator() (const Point &p, DenseVector< Output > &output)
 
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
 

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
 
bool _is_time_dependent
 

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
Date
2003

Definition at line 45 of file analytic_function.h.

Constructor & Destructor Documentation

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

Constructor. Takes a function pointer for scalar return values.

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

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

Constructor. Takes a function pointer for vector valued functions.

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

Destructor.

Definition at line 173 of file analytic_function.h.

174 {
175 }

Member Function Documentation

template<typename Output >
void libMesh::AnalyticFunction< Output >::clear ( )
inlinevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Output >.

Definition at line 193 of file analytic_function.h.

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

194 {
195  // We probably need a method to reset these later...
198 
199  // definitely not ready
200  this->_initialized = false;
201 }
const class libmesh_nullptr_t libmesh_nullptr
void(* _vector_fptr)(DenseVector< Output > &output, const Point &p, const Real time)
Output(* _number_fptr)(const Point &p, const Real time)
template<typename Output >
UniquePtr< FunctionBase< Output > > libMesh::AnalyticFunction< Output >::clone ( ) const
inlinevirtual

Returns a new deep copy of the function.

Implements libMesh::FunctionBase< Output >.

Definition at line 208 of file analytic_function.h.

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

209 {
210  return UniquePtr<FunctionBase<Output> >
211  ( _number_fptr ?
212  new AnalyticFunction<Output>(_number_fptr) :
213  new AnalyticFunction<Output>(_vector_fptr) );
214 }
void(* _vector_fptr)(DenseVector< Output > &output, const Point &p, const Real time)
Output(* _number_fptr)(const Point &p, const Real time)
template<typename Output >
Output libMesh::FunctionBase< Output >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtualinherited
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::CompositeFunction< Output >, libMesh::WrappedFunction< Output >, libMesh::ParsedFunction< Output, OutputGradient >, and libMesh::ParsedFunction< T >.

Definition at line 234 of file function_base.h.

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

237 {
238  DenseVector<Output> outvec(i+1);
239  (*this)(p, time, outvec);
240  return outvec(i);
241 }
template<typename Output >
void libMesh::AnalyticFunction< Output >::init ( )
virtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Output >.

Definition at line 180 of file analytic_function.h.

References libMesh::FunctionBase< Output >::_initialized, libMesh::AnalyticFunction< Output >::_number_fptr, libMesh::AnalyticFunction< Output >::_vector_fptr, libMesh::libmesh_assert(), and libmesh_nullptr.

181 {
182  // dumb double-test
184 
185  // definitely ready
186  this->_initialized = true;
187 }
const class libmesh_nullptr_t libmesh_nullptr
libmesh_assert(j)
void(* _vector_fptr)(DenseVector< Output > &output, const Point &p, const Real time)
Output(* _number_fptr)(const Point &p, const Real time)
template<typename Output >
bool libMesh::FunctionBase< Output >::initialized ( ) const
inlineinherited
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 212 of file function_base.h.

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

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

213 {
214  return (this->_initialized);
215 }
template<typename Output >
bool libMesh::FunctionBase< Output >::is_time_dependent ( ) const
inlineinherited
template<typename Output >
Output libMesh::AnalyticFunction< Output >::operator() ( const Point p,
const Real  time = 0. 
)
inlinevirtual
Returns
the value at point p and time time, which defaults to zero.

Implements libMesh::FunctionBase< Output >.

Definition at line 121 of file analytic_function.h.

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

123 {
124  libmesh_assert (this->initialized());
125  return (this->_number_fptr(p, time));
126 }
bool initialized() const
libmesh_assert(j)
Output(* _number_fptr)(const Point &p, const Real time)
template<typename Output >
void libMesh::AnalyticFunction< Output >::operator() ( const Point p,
const Real  time,
DenseVector< Output > &  output 
)
inlinevirtual

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

Implements libMesh::FunctionBase< Output >.

Definition at line 132 of file analytic_function.h.

References libMesh::FunctionBase< Output >::_initialized, libMesh::AnalyticFunction< Output >::_number_fptr, libMesh::AnalyticFunction< Output >::_vector_fptr, libMesh::AnalyticFunction< Output >::AnalyticFunction(), libMesh::FunctionBase< Output >::initialized(), libMesh::libmesh_assert(), libmesh_nullptr, and libMesh::Real.

135 {
136  libmesh_assert (this->initialized());
137  this->_vector_fptr(output, p, time);
138  return;
139 }
bool initialized() const
libmesh_assert(j)
void(* _vector_fptr)(DenseVector< Output > &output, const Point &p, const Real time)
template<typename Output>
void libMesh::FunctionBase< Output >::operator() ( const Point p,
DenseVector< Output > &  output 
)
inlineinherited

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

Definition at line 247 of file function_base.h.

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

249 {
250  // Call the time-dependent function with t=0.
251  this->operator()(p, 0., output);
252 }
virtual Output operator()(const Point &p, const Real time=0.)=0
template<typename Output >
void libMesh::FunctionBase< Output >::set_is_time_dependent ( bool  is_time_dependent)
inlineinherited

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 219 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().

220 {
222 }
bool is_time_dependent() const

Member Data Documentation

template<typename Output = Number>
bool libMesh::FunctionBase< Output >::_is_time_dependent
protectedinherited
template<typename Output = Number>
const FunctionBase* libMesh::FunctionBase< Output >::_master
protectedinherited

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

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: