Classes | |
class | ExcInvalidFormula |
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 |
unsigned int | memory_consumption () const |
Private Attributes | |
const Function< dim > & | f |
double | h |
AutoDerivativeFunction< dim > ::DifferenceFormula | formula |
std::vector< Point< dim > > | incr |
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.
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.
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.
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
).
void FunctionDerivative< dim >::set_h | ( | const double | h | ) |
Change the base step size of the difference formula
Reimplemented from AutoDerivativeFunction< 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 >.
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 >.
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 >.
unsigned int 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.
Reimplemented from Function< dim >.
const Function<dim>& FunctionDerivative< dim >::f [private] |
Function for differentiation.
double FunctionDerivative< dim >::h [private] |
Step size of the difference formula.
Reimplemented from AutoDerivativeFunction< dim >.
AutoDerivativeFunction<dim>::DifferenceFormula FunctionDerivative< dim >::formula [private] |
Difference formula.
Reimplemented from AutoDerivativeFunction< dim >.
std::vector<Point<dim> > FunctionDerivative< dim >::incr [private] |
Helper object. Contains the increment vector for the formula.