27 const unsigned int n_components,
28 const double initial_time)
29 :
Function<dim>(n_components, 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)
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)
130 Assert(gradients.size() ==
this->n_components,
139 const double h_inv = 1. / h;
140 for (
unsigned int i = 0; i < dim; ++i)
143 this->vector_value(p, v);
144 this->vector_value(
q1,
v1);
146 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
156 const double h_inv_2 = 1. / (2 * h);
157 for (
unsigned int i = 0; i < dim; ++i)
161 this->vector_value(
q1,
v1);
162 this->vector_value(
q2,
v2);
164 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
174 v3(this->n_components),
v4(this->n_components);
175 const double h_inv_12 = 1. / (12 * h);
176 for (
unsigned int i = 0; i < dim; ++i)
182 this->vector_value(
q1,
v1);
183 this->vector_value(
q2,
v2);
184 this->vector_value(
q3,
v3);
185 this->vector_value(
q4,
v4);
187 for (
unsigned int comp = 0;
comp < this->n_components; ++
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];
271 Assert(gradients.size() == points.size(),
273 for (
unsigned int p = 0; p < points.size(); ++p)
274 Assert(gradients[p].size() == this->n_components,
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] =
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)
virtual void vector_gradient_list(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const override
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)
#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()