20 #ifndef LIBMESH_WRAPPED_FUNCTOR_H 21 #define LIBMESH_WRAPPED_FUNCTOR_H 24 #include "libmesh/fem_function_base.h" 25 #include "libmesh/function_base.h" 26 #include "libmesh/int_range.h" 27 #include "libmesh/point.h" 28 #include "libmesh/wrapped_function.h" 46 template <
typename Output=Number>
65 const std::string & sys_name,
66 const std::string & unknown_name) =
nullptr,
68 unsigned int varnum=0) :
95 virtual std::unique_ptr<FEMFunctionBase<Output>>
clone ()
const override 97 return std::make_unique<WrappedFunctor<Output>>(*_func);
102 const Real time = 0.)
override 103 {
return _func->operator()(p, time); }
109 {
_func->operator() (p, time, output); }
114 Real time=0.)
override 115 {
return _func->component(i, p, time); }
119 std::unique_ptr<FunctionBase<Output>>
_func;
123 template <
typename Output>
140 #endif // LIBMESH_WRAPPED_FUNCTOR_H Wrap a libMesh-style function pointer into a FunctionBase object.
This class provides the ability to map between arbitrary, user-defined strings and several data types...
WrappedFunctor & operator=(const WrappedFunctor &)=delete
virtual Output component(const FEMContext &, unsigned int i, const Point &p, Real time=0.) override
The libMesh namespace provides an interface to certain functionality in the library.
virtual std::unique_ptr< FEMFunctionBase< Output > > clone() const override
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
This class provides a wrapper with which to evaluate a (libMesh-style) function pointer in a Function...
virtual Output operator()(const FEMContext &, const Point &p, const Real time=0.) override
std::unique_ptr< FunctionBase< Output > > _func
Manages consistently variables, degrees of freedom, and coefficient vectors.
virtual void init() override
Any post-construction initialization.
This class provides all data required for a physics package (e.g.
virtual ~WrappedFunctor()=default
virtual void init_context(const FEMContext &c) override
Tell the context we don't need anything from it.
WrappedFunctor(const System &sys, Output fptr(const Point &p, const Parameters ¶meters, const std::string &sys_name, const std::string &unknown_name)=nullptr, const Parameters *parameters=nullptr, unsigned int varnum=0)
Constructor to wrap scalar-valued function pointers.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh...
WrappedFunctor(const FunctionBase< Output > &func)
Constructor to wrap FunctionBase functors in a FEMFunctionBase compatible shim.
This class forms the foundation from which generic finite elements may be derived.
unsigned int n_vars() const
Number of variables in solution.
Base class for functors that can be evaluated at a point and (optionally) time.
FEMFunctionBase is a base class from which users can derive in order to define "function-like" object...
A Point defines a location in LIBMESH_DIM dimensional Real space.
const std::set< unsigned char > & elem_dimensions() const