20 #ifndef LIBMESH_ANALYTIC_FUNCTION_H 21 #define LIBMESH_ANALYTIC_FUNCTION_H 24 #include "libmesh/function_base.h" 47 template <
typename Output=Number>
91 virtual void init ()
override;
93 virtual void clear ()
override;
95 virtual std::unique_ptr<FunctionBase<Output>>
clone ()
const override;
98 const Real time=0.)
override;
109 template <
typename Output>
115 libmesh_assert_msg(_number_fptr,
116 "You must construct AnalyticFunction with a scalar-valued " 117 "function in order to use this operator() override.");
118 return (this->_number_fptr(p, time));
123 template <
typename Output>
130 libmesh_assert_msg(_vector_fptr,
131 "You must construct AnalyticFunction with a vector-valued " 132 "function in order to use this operator() override.");
133 this->_vector_fptr(output, p, time);
139 template <
typename Output>
143 _vector_fptr (nullptr)
151 template <
typename Output>
155 _number_fptr (nullptr),
164 template <
typename Output>
168 libmesh_assert ((_number_fptr !=
nullptr) || (_vector_fptr !=
nullptr));
171 this->_initialized =
true;
176 template <
typename Output>
181 _number_fptr =
nullptr;
182 _vector_fptr =
nullptr;
185 this->_initialized =
false;
190 template <
typename Output>
192 std::unique_ptr<FunctionBase<Output>>
195 return _number_fptr ?
196 std::make_unique<AnalyticFunction<Output>>(_number_fptr) :
204 #endif // LIBMESH_ANALYTIC_FUNCTION_H OutputFunction _number_fptr
Pointer to user-provided function that computes the boundary values when an analytical expression is ...
virtual Output operator()(const Point &p, const Real time=0.) override
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
Output(* OutputFunction)(const Point &p, const Real time)
Scalar return value function pointer type.
The libMesh namespace provides an interface to certain functionality in the library.
OutputVectorFunction _vector_fptr
Pointer to user-provided vector valued function.
Wraps a function pointer into a FunctionBase object.
Number fptr(const Point &p, const Parameters &, const std::string &libmesh_dbg_var(sys_name), const std::string &unknown_name)
virtual std::unique_ptr< FunctionBase< Output > > clone() const override
virtual ~AnalyticFunction()=default
void(* OutputVectorFunction)(DenseVector< Output > &output, const Point &p, const Real time)
Vector return value function pointer type.
AnalyticFunction(OutputFunction fptr)
Constructor.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void init() override
The actual initialization process.
virtual void clear() override
Clears the function.
bool initialized()
Checks that library initialization has been done.
Base class for functors that can be evaluated at a point and (optionally) time.
AnalyticFunction & operator=(const AnalyticFunction &)=default
A Point defines a location in LIBMESH_DIM dimensional Real space.