28 const unsigned int n_components,
29 const double initial_time)
30 :
Function<dim>(n_components, initial_time)
55 ExcMessage(
"The argument passed to this function does not "
56 "match any known difference formula."));
68 for (
unsigned int i = 0; i < dim; ++i)
76 const unsigned int comp)
const
84 for (
unsigned int i = 0; i < dim; ++i)
94 for (
unsigned int i = 0; i < dim; ++i)
99 (this->value(
q1,
comp) - this->value(
q2,
comp)) / (2 * h);
106 for (
unsigned int i = 0; i < dim; ++i)
131 Assert(gradients.size() ==
this->n_components,
140 const double h_inv = 1. / h;
141 for (
unsigned int i = 0; i < dim; ++i)
144 this->vector_value(p, v);
145 this->vector_value(
q1,
v1);
147 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
157 const double h_inv_2 = 1. / (2 * h);
158 for (
unsigned int i = 0; i < dim; ++i)
162 this->vector_value(
q1,
v1);
163 this->vector_value(
q2,
v2);
165 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
175 v3(this->n_components),
v4(this->n_components);
176 const double h_inv_12 = 1. / (12 * h);
177 for (
unsigned int i = 0; i < dim; ++i)
183 this->vector_value(
q1,
v1);
184 this->vector_value(
q2,
v2);
185 this->vector_value(
q3,
v3);
186 this->vector_value(
q4,
v4);
188 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
207 const unsigned int comp)
const
209 Assert(gradients.size() == points.size(),
217 for (
unsigned int p = 0; p < points.size(); ++p)
218 for (
unsigned int i = 0; i < dim; ++i)
220 q1 = points[p] - ht[i];
222 (this->value(points[p],
comp) - this->value(
q1,
comp)) / h;
230 for (
unsigned int p = 0; p < points.size(); ++p)
231 for (
unsigned int i = 0; i < dim; ++i)
233 q1 = points[p] + ht[i];
234 q2 = points[p] - ht[i];
236 (this->value(
q1,
comp) - this->value(
q2,
comp)) / (2 * h);
244 for (
unsigned int p = 0; p < points.size(); ++p)
245 for (
unsigned int i = 0; i < dim; ++i)
247 q2 = points[p] + ht[i];
249 q3 = points[p] - ht[i];
272 Assert(gradients.size() == points.size(),
274 for (
unsigned int p = 0; p < points.size(); ++p)
275 Assert(gradients[p].
size() == this->n_components,
283 for (
unsigned int p = 0; p < points.size(); ++p)
284 for (
unsigned int i = 0; i < dim; ++i)
286 q1 = points[p] - ht[i];
287 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
288 gradients[p][
comp][i] =
289 (this->value(points[p],
comp) - this->value(
q1,
comp)) / h;
297 for (
unsigned int p = 0; p < points.size(); ++p)
298 for (
unsigned int i = 0; i < dim; ++i)
300 q1 = points[p] + ht[i];
301 q2 = points[p] - ht[i];
302 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
303 gradients[p][
comp][i] =
304 (this->value(
q1,
comp) - this->value(
q2,
comp)) / (2 * h);
312 for (
unsigned int p = 0; p < points.size(); ++p)
313 for (
unsigned int i = 0; i < dim; ++i)
315 q2 = points[p] + ht[i];
317 q3 = points[p] - ht[i];
319 for (
unsigned int comp = 0;
comp < this->n_components; ++
comp)
320 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
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)