Reference documentation for deal.II version Git 7f58f27 2017-09-20 15:35:49 -0600
Public Member Functions | Private Attributes | List of all members
VectorFunctionFromScalarFunctionObject< dim, Number > Class Template Reference

#include <deal.II/base/function.h>

Inheritance diagram for VectorFunctionFromScalarFunctionObject< dim, Number >:
[legend]

Public Member Functions

 VectorFunctionFromScalarFunctionObject (const std::function< Number(const Point< dim > &)> &function_object, const unsigned int selected_component, const unsigned int n_components)
 
virtual Number value (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_value (const Point< dim > &p, Vector< Number > &values) const
 
- Public Member Functions inherited from Function< dim, Number >
 Function (const unsigned int n_components=1, const Number initial_time=0.0)
 
virtual ~Function ()=0
 
Functionoperator= (const Function &f)
 
virtual void value_list (const std::vector< Point< dim > > &points, std::vector< Number > &values, const unsigned int component=0) const
 
virtual void vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< Number > > &values) const
 
virtual void vector_values (const std::vector< Point< dim > > &points, std::vector< std::vector< Number > > &values) const
 
virtual Tensor< 1, dim, Number > gradient (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim, Number > > &gradients) const
 
virtual void gradient_list (const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim, Number > > &gradients, const unsigned int component=0) const
 
virtual void vector_gradients (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, Number > > > &gradients) const
 
virtual void vector_gradient_list (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim, Number > > > &gradients) const
 
virtual Number laplacian (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_laplacian (const Point< dim > &p, Vector< Number > &values) const
 
virtual void laplacian_list (const std::vector< Point< dim > > &points, std::vector< Number > &values, const unsigned int component=0) const
 
virtual void vector_laplacian_list (const std::vector< Point< dim > > &points, std::vector< Vector< Number > > &values) const
 
virtual SymmetricTensor< 2, dim, Number > hessian (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_hessian (const Point< dim > &p, std::vector< SymmetricTensor< 2, dim, Number > > &values) const
 
virtual void hessian_list (const std::vector< Point< dim > > &points, std::vector< SymmetricTensor< 2, dim, Number > > &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, Number > > > &values) const
 
std::size_t memory_consumption () const
 
- Public Member Functions inherited from FunctionTime< Number >
 FunctionTime (const Number initial_time=Number(0.0))
 
virtual ~FunctionTime ()=default
 
Number get_time () const
 
virtual void set_time (const Number new_time)
 
virtual void advance_time (const Number delta_t)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
 Subscriptor (Subscriptor &&)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
Subscriptoroperator= (Subscriptor &&)
 
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< Number(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, char *arg2, std::string &arg3)
 
static::ExceptionBase & ExcNoSubscriber (char *arg1, char *arg2)
 
- Public Attributes inherited from Function< dim, Number >
const unsigned int n_components
 
- Static Public Attributes inherited from Function< dim, Number >
static const unsigned int dimension = dim
 

Detailed Description

template<int dim, typename Number = double>
class VectorFunctionFromScalarFunctionObject< dim, Number >

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.

Note
In the above discussion, note the difference between the (scalar) "function object" (i.e., a C++ object 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:

Number one (const Point<2> &p) { return 1; }
component_mask (&one, 1, 3);

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.

Author
Wolfgang Bangerth, 2011

Definition at line 700 of file function.h.

Constructor & Destructor Documentation

template<int dim, typename Number = double>
VectorFunctionFromScalarFunctionObject< dim, Number >::VectorFunctionFromScalarFunctionObject ( const std::function< Number(const Point< dim > &)> &  function_object,
const unsigned int  selected_component,
const unsigned int  n_components 
)

Given a function object that takes a Point and returns a Number value, convert this into an object that matches the Function<dim> interface.

Parameters
function_objectThe scalar function that will form one component of the resulting Function object.
n_componentsThe total number of vector components of the resulting Function object.
selected_componentThe single component that should be filled by the first argument.

Member Function Documentation

template<int dim, typename Number = double>
virtual Number VectorFunctionFromScalarFunctionObject< dim, Number >::value ( const Point< dim > &  p,
const unsigned int  component = 0 
) const
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, Number >.

template<int dim, typename Number = double>
virtual void VectorFunctionFromScalarFunctionObject< dim, Number >::vector_value ( const Point< dim > &  p,
Vector< Number > &  values 
) const
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, Number >.

Member Data Documentation

template<int dim, typename Number = double>
const std::function<Number (const Point<dim> &)> VectorFunctionFromScalarFunctionObject< dim, Number >::function_object
private

The function object which we call when this class's value() or value_list() functions are called.

Definition at line 738 of file function.h.

template<int dim, typename Number = double>
const unsigned int VectorFunctionFromScalarFunctionObject< dim, Number >::selected_component
private

The vector component whose value is to be filled by the given scalar function.

Definition at line 744 of file function.h.


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