47 for (
unsigned int i = 0; i <
incr.size(); ++i)
69 ExcMessage(
"The argument passed to this function does not "
70 "match any known difference formula."));
82 for (
unsigned int i = 0; i < incr.size(); ++i)
92 const unsigned int component)
const
96 "FunctionDerivative was not initialized for constant direction"));
101 return (f.value(p + incr[0], component) -
102 f.value(p - incr[0], component)) /
105 return (f.value(p, component) - f.value(p - incr[0], component)) / h;
107 return (-f.value(p + 2 * incr[0], component) +
108 8 * f.value(p + incr[0], component) -
109 8 * f.value(p - incr[0], component) +
110 f.value(p - 2 * incr[0], component)) /
127 "FunctionDerivative was not initialized for constant direction"));
137 f.vector_value(p - incr[0], aux);
138 result.sadd(1. / (2 * h), -1. / (2 * h), aux);
142 f.vector_value(p - incr[0], aux);
143 result.sadd(1. / h, -1. / h, aux);
147 f.vector_value(p + 2 * incr[0], aux);
149 f.vector_value(p - incr[0], aux);
151 f.vector_value(p + incr[0], aux);
165 std::vector<double> &values,
166 const unsigned int component)
const
168 const unsigned int n = points.size();
171 Assert(incr.size() == points.size(),
175 std::vector<double> aux(n);
177 std::vector<Point<dim>>
paux(n);
184 for (
unsigned int i = 0; i < n; ++i)
187 for (
unsigned int i = 0; i < n; ++i)
189 f.value_list(
paux, aux, component);
190 for (
unsigned int i = 0; i < n; ++i)
195 for (
unsigned int i = 0; i < n; ++i)
197 f.value_list(
paux, aux, component);
198 for (
unsigned int i = 0; i < n; ++i)
202 for (
unsigned int i = 0; i < n; ++i)
205 for (
unsigned int i = 0; i < n; ++i)
207 f.value_list(
paux, aux, component);
208 for (
unsigned int i = 0; i < n; ++i)
210 for (
unsigned int i = 0; i < n; ++i)
212 f.value_list(
paux, aux, component);
213 for (
unsigned int i = 0; i < n; ++i)
215 for (
unsigned int i = 0; i < n; ++i)
217 f.value_list(
paux, aux, component);
218 for (
unsigned int i = 0; i < n; ++i)
234 return sizeof(*this);
virtual std::size_t memory_consumption() const override
virtual void vector_value(const Point< dim > &p, Vector< double > &value) const override
void set_h(const double h)
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const override
FunctionDerivative(const Function< dim > &f, const Point< dim > &direction, const double h=1.e-6)
virtual double value(const Point< dim > &p, const unsigned int component=0) const override
std::vector< Tensor< 1, dim > > incr
void set_formula(typename AutoDerivativeFunction< dim >::DifferenceFormula formula=AutoDerivativeFunction< dim >::Euler)
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< RangeNumberType > &values, const unsigned int component=0) const
virtual void vector_value(const Point< dim > &p, Vector< RangeNumberType > &values) const
std::conditional_t< rank_==1, std::array< Number, dim >, std::array< Tensor< rank_ - 1, dim, Number >, dim > > values
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define DEAL_II_NOT_IMPLEMENTED()