Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Private Attributes | List of all members
FunctionDerivative< dim > Class Template Reference

#include <function_derivative.h>

Inheritance diagram for FunctionDerivative< dim >:
[legend]

Public Member Functions

 FunctionDerivative (const Function< dim > &f, const Point< dim > &direction, const double h=1.e-6)
 
 FunctionDerivative (const Function< dim > &f, const std::vector< Point< dim > > &direction, const double h=1.e-6)
 
void set_formula (typename AutoDerivativeFunction< dim >::DifferenceFormula formula=AutoDerivativeFunction< dim >::Euler)
 
void set_h (const double h)
 
virtual double value (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_value (const Point< dim > &p, Vector< double > &value) const
 
virtual void value_list (const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
 
std::size_t memory_consumption () const
 
 DeclException0 (ExcInvalidFormula)
 
- Public Member Functions inherited from AutoDerivativeFunction< dim >
 AutoDerivativeFunction (const double h, const unsigned int n_components=1, const double initial_time=0.0)
 
virtual ~AutoDerivativeFunction ()
 
void set_formula (const DifferenceFormula formula=Euler)
 
void set_h (const double h)
 
virtual Tensor< 1, dim > gradient (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_gradient (const Point< dim > &p, std::vector< Tensor< 1, dim > > &gradients) const
 
virtual void gradient_list (const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const
 
virtual void vector_gradient_list (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
 
 DeclException0 (ExcInvalidFormula)
 
- Public Member Functions inherited from Function< dim >
 Function (const unsigned int n_components=1, const double initial_time=0.0)
 
virtual ~Function ()=0
 
Functionoperator= (const Function &f)
 
virtual void vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
 
virtual void vector_values (const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const
 
virtual void vector_gradients (const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
 
virtual double laplacian (const Point< dim > &p, const unsigned int component=0) const
 
virtual void vector_laplacian (const Point< dim > &p, Vector< double > &values) const
 
virtual void laplacian_list (const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
 
virtual void vector_laplacian_list (const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
 
std::size_t memory_consumption () const
 
- Public Member Functions inherited from FunctionTime
 FunctionTime (const double initial_time=0.0)
 
virtual ~FunctionTime ()
 
double get_time () const
 
virtual void set_time (const double new_time)
 
virtual void advance_time (const double delta_t)
 
- Public Member Functions inherited from Subscriptor
 Subscriptor ()
 
 Subscriptor (const Subscriptor &)
 
virtual ~Subscriptor ()
 
Subscriptoroperator= (const Subscriptor &)
 
void subscribe (const char *identifier=0) const
 
void unsubscribe (const char *identifier=0) const
 
unsigned int n_subscriptions () const
 
void list_subscribers () const
 
 DeclException3 (ExcInUse, int, char *, std::string &,<< "Object of class "<< arg2<< " is still used by "<< arg1<< " other objects.\n"<< "(Additional information: "<< arg3<< ")\n"<< "Note the entry in the Frequently Asked Questions of "<< "deal.II (linked to from http://www.dealii.org/) for "<< "more information on what this error means.")
 
 DeclException2 (ExcNoSubscriber, char *, char *,<< "No subscriber with identifier \""<< arg2<< "\" did subscribe to this object of class "<< arg1)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

const Function< dim > & f
 
double h
 
AutoDerivativeFunction< dim >
::DifferenceFormula 
formula
 
std::vector< Point< dim > > incr
 

Additional Inherited Members

- Public Types inherited from AutoDerivativeFunction< dim >
enum  DifferenceFormula { Euler, UpwindEuler, FourthOrder }
 
- Static Public Member Functions inherited from AutoDerivativeFunction< dim >
static DifferenceFormula get_formula_of_order (const unsigned int ord)
 
- Public Attributes inherited from Function< dim >
const unsigned int n_components
 
- Static Public Attributes inherited from Function< dim >
static const unsigned int dimension = dim
 

Detailed Description

template<int dim>
class FunctionDerivative< dim >

Derivative of a function object. The value access functions of this class return the directional derivative of a function with respect to a direction provided on construction. If b is the vector, the derivative b . grad f is computed. This derivative is evaluated directly, not by computing the gradient of f and its scalar product with b.

The derivative is computed numerically, using one of the provided difference formulas (see set_formula for available schemes). Experimenting with h and the difference scheme may be necessary to obtain sufficient results.

Author
Guido Kanschat, 2000

Definition at line 45 of file function_derivative.h.

Constructor & Destructor Documentation

template<int dim>
FunctionDerivative< dim >::FunctionDerivative ( const Function< dim > &  f,
const Point< dim > &  direction,
const double  h = 1.e-6 
)

Constructor. Provided are the functions to compute derivatives of, the direction vector of the differentiation and the step size h of the difference formula.

template<int dim>
FunctionDerivative< dim >::FunctionDerivative ( const Function< dim > &  f,
const std::vector< Point< dim > > &  direction,
const double  h = 1.e-6 
)

Constructor. Provided are the functions to compute derivatives of and the direction vector of the differentiation in each quadrature point and the difference step size.

This is the constructor for a variable velocity field. Most probably, a new object of FunctionDerivative has to be constructed for each set of quadrature points.

The number of quadrature point must still be the same, when values are accessed.

Member Function Documentation

template<int dim>
void FunctionDerivative< dim >::set_formula ( typename AutoDerivativeFunction< dim >::DifferenceFormula  formula = AutoDerivativeFunction< dim >::Euler)

Choose the difference formula. This is set to the default in the constructor.

Formulas implemented right now are first order backward Euler (UpwindEuler), second order symmetric Euler (Euler) and a symmetric fourth order formula (FourthOrder).

template<int dim>
void FunctionDerivative< dim >::set_h ( const double  h)

Change the base step size of the difference formula

template<int dim>
virtual double FunctionDerivative< dim >::value ( const Point< dim > &  p,
const unsigned int  component = 0 
) const
virtual

Return the value of the function at the given point. Unless there is only one component (i.e. the function is scalar), you should state the component you want to have evaluated; it defaults to zero, i.e. the first component.

Reimplemented from Function< dim >.

template<int dim>
virtual void FunctionDerivative< dim >::vector_value ( const Point< dim > &  p,
Vector< double > &  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 >.

template<int dim>
virtual void FunctionDerivative< dim >::value_list ( const std::vector< Point< dim > > &  points,
std::vector< double > &  values,
const unsigned int  component = 0 
) const
virtual

Set values to the point values of the specified component of the function at the points. It is assumed that values already has the right size, i.e. the same size as the points array.

Be default, this function repeatedly calls value() for each point separately, to fill the output array.

Reimplemented from Function< dim >.

template<int dim>
std::size_t FunctionDerivative< dim >::memory_consumption ( ) const

Determine an estimate for the memory consumption (in bytes) of this object. Since sometimes the size of objects can not be determined exactly (for example: what is the memory consumption of an STL std::map type with a certain number of elements?), this is only an estimate. however often quite close to the true value.

Member Data Documentation

template<int dim>
const Function<dim>& FunctionDerivative< dim >::f
private

Function for differentiation.

Definition at line 145 of file function_derivative.h.

template<int dim>
double FunctionDerivative< dim >::h
private

Step size of the difference formula.

Definition at line 151 of file function_derivative.h.

template<int dim>
AutoDerivativeFunction<dim>::DifferenceFormula FunctionDerivative< dim >::formula
private

Difference formula.

Definition at line 156 of file function_derivative.h.

template<int dim>
std::vector<Point<dim> > FunctionDerivative< dim >::incr
private

Helper object. Contains the increment vector for the formula.

Definition at line 163 of file function_derivative.h.


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