libMesh::WrappedFunctor< Output > Class Template Reference

#include <wrapped_functor.h>

Inheritance diagram for libMesh::WrappedFunctor< Output >:

Public Member Functions

 WrappedFunctor (const FunctionBase< Output > &func)
 
virtual UniquePtr< FEMFunctionBase< Output > > clone () const libmesh_override
 
virtual Output operator() (const FEMContext &, const Point &p, const Real time=0.) libmesh_override
 
virtual void operator() (const FEMContext &, const Point &p, const Real time, DenseVector< Output > &output) libmesh_override
 
virtual Output component (const FEMContext &, unsigned int i, const Point &p, Real time=0.) libmesh_override
 
virtual void init_context (const FEMContext &)
 
void operator() (const FEMContext &, const Point &p, DenseVector< Output > &output)
 

Protected Attributes

UniquePtr< FunctionBase< Output > > _func
 

Detailed Description

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

This class provides a wrapper with which to evaluate a (libMesh-style) function pointer in a FunctionBase-compatible interface.

Author
Roy Stogner
Date
2015

Definition at line 43 of file wrapped_functor.h.

Constructor & Destructor Documentation

template<typename Output = Number>
libMesh::WrappedFunctor< Output >::WrappedFunctor ( const FunctionBase< Output > &  func)
inline

Constructor to wrap FunctionBase functors in a FEMFunctionBase compatible shim

Definition at line 51 of file wrapped_functor.h.

52  : _func(func.clone())
53  { }
UniquePtr< FunctionBase< Output > > _func

Member Function Documentation

template<typename Output = Number>
virtual UniquePtr<FEMFunctionBase<Output> > libMesh::WrappedFunctor< Output >::clone ( ) const
inlinevirtual

Returns a new copy of the function. The new copy should be as ``deep'' as necessary to allow independent destruction and simultaneous evaluations of the copies in different threads.

Implements libMesh::FEMFunctionBase< Output >.

Definition at line 55 of file wrapped_functor.h.

56  {
57  return UniquePtr<FEMFunctionBase<Output> >
58  (new WrappedFunctor<Output> (*_func));
59  }
template<typename Output = Number>
virtual Output libMesh::WrappedFunctor< Output >::component ( const FEMContext ,
unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtual
Returns
the vector component i at coordinate p and time time.

Reimplemented from libMesh::FEMFunctionBase< Output >.

Definition at line 85 of file wrapped_functor.h.

References libMesh::WrappedFunctor< Output >::_func.

89  { return _func->component(i, p, time); }
UniquePtr< FunctionBase< Output > > _func
template<typename Output = Number>
virtual void libMesh::FEMFunctionBase< Output >::init_context ( const FEMContext )
inlinevirtualinherited

Prepares a context object for use.

Most problems will want to reimplement this for efficiency, in order to call FE::get_*() as their particular function requires.

Reimplemented in libMesh::ParsedFEMFunction< Output >, and libMesh::ParsedFEMFunction< T >.

Definition at line 71 of file fem_function_base.h.

References libMesh::FEMFunctionBase< Output >::clone(), libMesh::FEMFunctionBase< Output >::component(), libMesh::FEMFunctionBase< Output >::operator()(), and libMesh::Real.

71 {}
template<typename Output = Number>
virtual Output libMesh::WrappedFunctor< Output >::operator() ( const FEMContext ,
const Point p,
const Real  time = 0. 
)
inlinevirtual
Returns
the scalar value of variable varnum at coordinate p and time time.

Implements libMesh::FEMFunctionBase< Output >.

Definition at line 65 of file wrapped_functor.h.

References libMesh::WrappedFunctor< Output >::_func.

68  { return _func->operator()(p, time); }
UniquePtr< FunctionBase< Output > > _func
template<typename Output = Number>
virtual void libMesh::WrappedFunctor< Output >::operator() ( const FEMContext ,
const Point p,
const Real  time,
DenseVector< Output > &  output 
)
inlinevirtual

Return function for vectors. Returns in output the values of all system variables at the coordinate p and for time time.

Implements libMesh::FEMFunctionBase< Output >.

Definition at line 75 of file wrapped_functor.h.

References libMesh::WrappedFunctor< Output >::_func.

79  { _func->operator() (p, time, output); }
UniquePtr< FunctionBase< Output > > _func
template<typename Output >
void libMesh::FEMFunctionBase< Output >::operator() ( const FEMContext context,
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 144 of file fem_function_base.h.

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

147 {
148  // Call the time-dependent function with t=0.
149  this->operator()(context, p, 0., output);
150 }
virtual Output operator()(const FEMContext &, const Point &p, const Real time=0.)=0

Member Data Documentation

template<typename Output = Number>
UniquePtr<FunctionBase<Output> > libMesh::WrappedFunctor< Output >::_func
protected

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