28 const double initial_time)
54 ExcMessage(
"The argument passed to this function does not "
55 "match any known difference formula."));
67 for (
unsigned int i = 0; i < dim; ++i)
75 const unsigned int comp)
const
83 for (
unsigned int i = 0; i < dim; ++i)
86 grad[i] = (this->
value(p, comp) - this->
value(q1, comp)) /
h;
93 for (
unsigned int i = 0; i < dim; ++i)
98 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
105 for (
unsigned int i = 0; i < dim; ++i)
111 grad[i] = (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
112 8 * this->
value(q3, comp) + this->
value(q4, comp)) /
130 Assert(gradients.size() == this->n_components,
139 const double h_inv = 1. /
h;
140 for (
unsigned int i = 0; i < dim; ++i)
146 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
147 gradients[comp][i] = (v(comp) - v1(comp)) * h_inv;
156 const double h_inv_2 = 1. / (2 *
h);
157 for (
unsigned int i = 0; i < dim; ++i)
164 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
165 gradients[comp][i] = (v1(comp) - v2(comp)) * h_inv_2;
175 const double h_inv_12 = 1. / (12 *
h);
176 for (
unsigned int i = 0; i < dim; ++i)
187 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
189 (-v1(comp) + 8 * v2(comp) - 8 * v3(comp) + v4(comp)) *
206 const unsigned int comp)
const
208 Assert(gradients.size() == points.size(),
216 for (
unsigned int p = 0; p < points.size(); ++p)
217 for (
unsigned int i = 0; i < dim; ++i)
219 q1 = points[p] -
ht[i];
221 (this->
value(points[p], comp) - this->
value(q1, comp)) /
h;
229 for (
unsigned int p = 0; p < points.size(); ++p)
230 for (
unsigned int i = 0; i < dim; ++i)
232 q1 = points[p] +
ht[i];
233 q2 = points[p] -
ht[i];
235 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
243 for (
unsigned int p = 0; p < points.size(); ++p)
244 for (
unsigned int i = 0; i < dim; ++i)
246 q2 = points[p] +
ht[i];
248 q3 = points[p] -
ht[i];
251 (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
252 8 * this->
value(q3, comp) + this->
value(q4, comp)) /
271 Assert(gradients.size() == points.size(),
273 for (
unsigned int p = 0; p < points.size(); ++p)
282 for (
unsigned int p = 0; p < points.size(); ++p)
283 for (
unsigned int i = 0; i < dim; ++i)
285 q1 = points[p] -
ht[i];
286 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
287 gradients[p][comp][i] =
288 (this->
value(points[p], comp) - this->
value(q1, comp)) /
h;
296 for (
unsigned int p = 0; p < points.size(); ++p)
297 for (
unsigned int i = 0; i < dim; ++i)
299 q1 = points[p] +
ht[i];
300 q2 = points[p] -
ht[i];
301 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
302 gradients[p][comp][i] =
303 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
311 for (
unsigned int p = 0; p < points.size(); ++p)
312 for (
unsigned int i = 0; i < dim; ++i)
314 q2 = points[p] +
ht[i];
316 q3 = points[p] -
ht[i];
318 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
319 gradients[p][comp][i] =
320 (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
321 8 * this->
value(q3, comp) + this->
value(q4, comp)) /
AutoDerivativeFunction(const double h, const unsigned int n_components=1, const double initial_time=0.0)
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim > > &gradients) const override
void set_h(const double h)
DifferenceFormula formula
virtual void vector_gradient_list(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const override
std::vector< Tensor< 1, dim > > ht
void set_formula(const DifferenceFormula formula=Euler)
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const override
static DifferenceFormula get_formula_of_order(const unsigned int ord)
const unsigned int n_components
Function(const unsigned int n_components=1, const time_type initial_time=0.0)
virtual void vector_value(const Point< dim > &p, Vector< RangeNumberType > &values) const
#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)
const bool IsBlockVector< VectorType >::value
#define DEAL_II_NOT_IMPLEMENTED()