Reference documentation for deal.II version 9.0.0
|
#include <deal.II/base/function.h>
Public Member Functions | |
VectorFunctionFromScalarFunctionObject (const std::function< RangeNumberType(const Point< dim > &)> &function_object, const unsigned int selected_component, const unsigned int n_components) | |
virtual RangeNumberType | value (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_value (const Point< dim > &p, Vector< RangeNumberType > &values) const |
Public Member Functions inherited from Function< dim, RangeNumberType > | |
Function (const unsigned int n_components=1, const RangeNumberType initial_time=0.0) | |
virtual | ~Function ()=0 |
Function & | operator= (const Function &f) |
virtual void | value_list (const std::vector< Point< dim > > &points, std::vector< RangeNumberType > &values, const unsigned int component=0) const |
virtual void | vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< RangeNumberType > > &values) const |
virtual void | vector_values (const std::vector< Point< dim > > &points, std::vector< std::vector< RangeNumberType > > &values) const |
virtual Tensor< 1, dim, RangeNumberType > | gradient (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, RangeNumberType > > &gradients) const |
virtual void | gradient_list (const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim, RangeNumberType > > &gradients, const unsigned int component=0) const |
virtual void | vector_gradients (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > &gradients) const |
virtual void | vector_gradient_list (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, RangeNumberType > > > &gradients) const |
virtual RangeNumberType | laplacian (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_laplacian (const Point< dim > &p, Vector< RangeNumberType > &values) const |
virtual void | laplacian_list (const std::vector< Point< dim > > &points, std::vector< RangeNumberType > &values, const unsigned int component=0) const |
virtual void | vector_laplacian_list (const std::vector< Point< dim > > &points, std::vector< Vector< RangeNumberType > > &values) const |
virtual SymmetricTensor< 2, dim, RangeNumberType > | hessian (const Point< dim > &p, const unsigned int component=0) const |
virtual void | vector_hessian (const Point< dim > &p, std::vector< SymmetricTensor< 2, dim, RangeNumberType > > &values) const |
virtual void | hessian_list (const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim, RangeNumberType > > &values, const unsigned int component=0) const |
virtual void | vector_hessian_list (const std::vector< Point< dim > > &points, std::vector< std::vector< SymmetricTensor< 2, dim, RangeNumberType > > > &values) const |
std::size_t | memory_consumption () const |
Public Member Functions inherited from FunctionTime< RangeNumberType > | |
FunctionTime (const RangeNumberType initial_time=RangeNumberType(0.0)) | |
virtual | ~FunctionTime ()=default |
RangeNumberType | get_time () const |
virtual void | set_time (const RangeNumberType new_time) |
virtual void | advance_time (const RangeNumberType delta_t) |
Public Member Functions inherited from Subscriptor | |
Subscriptor () | |
Subscriptor (const Subscriptor &) | |
Subscriptor (Subscriptor &&) noexcept | |
virtual | ~Subscriptor () |
Subscriptor & | operator= (const Subscriptor &) |
Subscriptor & | operator= (Subscriptor &&) noexcept |
void | subscribe (const char *identifier=nullptr) const |
void | unsubscribe (const char *identifier=nullptr) const |
unsigned int | n_subscriptions () const |
void | list_subscribers () const |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
const std::function< RangeNumberType(const Point< dim > &)> | function_object |
const unsigned int | selected_component |
Additional Inherited Members | |
Static Public Member Functions inherited from Subscriptor | |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Public Attributes inherited from Function< dim, RangeNumberType > | |
const unsigned int | n_components |
Static Public Attributes inherited from Function< dim, RangeNumberType > | |
static const unsigned int | dimension = dim |
This class is similar to the ScalarFunctionFromFunctionObject class in that it allows for the easy conversion of a function object to something that satisfies the interface of the Function base class. The difference is that here, the given function object is still a scalar function (i.e. it has a single value at each space point) but that the Function object generated is vector valued. The number of vector components is specified in the constructor, where one also selects a single one of these vector components that should be filled by the passed object. The result is a vector Function object that returns zero in each component except the single selected one where it returns the value returned by the given as the first argument to the constructor.
x
that can be called as in x(p)
) and the capitalized (vector valued) "Function object" (i.e., an object of a class that is derived from the Function base class).To be more concrete, let us consider the following example:
Here, component_mask
then represents a Function object that for every point returns the vector \((0, 1, 0)^T\), i.e. a mask function that could, for example, be passed to VectorTools::integrate_difference(). This effect can also be achieved using the ComponentSelectFunction class but is obviously easily extended to functions that are non-constant in their one component.
Definition at line 711 of file function.h.
VectorFunctionFromScalarFunctionObject< dim, RangeNumberType >::VectorFunctionFromScalarFunctionObject | ( | const std::function< RangeNumberType(const Point< dim > &)> & | function_object, |
const unsigned int | selected_component, | ||
const unsigned int | n_components | ||
) |
|
virtual |
Return the value of the function at the given point. Returns the value the function given to the constructor produces for this point.
Reimplemented from Function< dim, RangeNumberType >.
|
virtual |
Return all components of a vector-valued function at a given point.
values
shall have the right size beforehand, i.e. n_components.
Reimplemented from Function< dim, RangeNumberType >.
|
private |
The function object which we call when this class's value() or value_list() functions are called.
Definition at line 749 of file function.h.
|
private |
The vector component whose value is to be filled by the given scalar function.
Definition at line 755 of file function.h.