26 const double initial_time)
52 ExcMessage(
"The argument passed to this function does not "
53 "match any known difference formula."));
65 for (
unsigned int i = 0; i < dim; ++i)
73 const unsigned int comp)
const
81 for (
unsigned int i = 0; i < dim; ++i)
84 grad[i] = (this->
value(p, comp) - this->
value(q1, comp)) /
h;
91 for (
unsigned int i = 0; i < dim; ++i)
96 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
103 for (
unsigned int i = 0; i < dim; ++i)
109 grad[i] = (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
110 8 * this->
value(q3, comp) + this->
value(q4, comp)) /
128 Assert(gradients.size() == this->n_components,
137 const double h_inv = 1. /
h;
138 for (
unsigned int i = 0; i < dim; ++i)
144 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
145 gradients[comp][i] = (v(comp) - v1(comp)) * h_inv;
154 const double h_inv_2 = 1. / (2 *
h);
155 for (
unsigned int i = 0; i < dim; ++i)
162 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
163 gradients[comp][i] = (v1(comp) - v2(comp)) * h_inv_2;
173 const double h_inv_12 = 1. / (12 *
h);
174 for (
unsigned int i = 0; i < dim; ++i)
185 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
187 (-v1(comp) + 8 * v2(comp) - 8 * v3(comp) + v4(comp)) *
204 const unsigned int comp)
const
206 Assert(gradients.size() == points.size(),
214 for (
unsigned int p = 0; p < points.size(); ++p)
215 for (
unsigned int i = 0; i < dim; ++i)
217 q1 = points[p] -
ht[i];
219 (this->
value(points[p], comp) - this->
value(q1, comp)) /
h;
227 for (
unsigned int p = 0; p < points.size(); ++p)
228 for (
unsigned int i = 0; i < dim; ++i)
230 q1 = points[p] +
ht[i];
231 q2 = points[p] -
ht[i];
233 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
241 for (
unsigned int p = 0; p < points.size(); ++p)
242 for (
unsigned int i = 0; i < dim; ++i)
244 q2 = points[p] +
ht[i];
246 q3 = points[p] -
ht[i];
249 (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
250 8 * this->
value(q3, comp) + this->
value(q4, comp)) /
269 Assert(gradients.size() == points.size(),
271 for (
unsigned int p = 0; p < points.size(); ++p)
280 for (
unsigned int p = 0; p < points.size(); ++p)
281 for (
unsigned int i = 0; i < dim; ++i)
283 q1 = points[p] -
ht[i];
284 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
285 gradients[p][comp][i] =
286 (this->
value(points[p], comp) - this->
value(q1, comp)) /
h;
294 for (
unsigned int p = 0; p < points.size(); ++p)
295 for (
unsigned int i = 0; i < dim; ++i)
297 q1 = points[p] +
ht[i];
298 q2 = points[p] -
ht[i];
299 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
300 gradients[p][comp][i] =
301 (this->
value(q1, comp) - this->
value(q2, comp)) / (2 *
h);
309 for (
unsigned int p = 0; p < points.size(); ++p)
310 for (
unsigned int i = 0; i < dim; ++i)
312 q2 = points[p] +
ht[i];
314 q3 = points[p] -
ht[i];
316 for (
unsigned int comp = 0; comp < this->
n_components; ++comp)
317 gradients[p][comp][i] =
318 (-this->
value(q1, comp) + 8 * this->
value(q2, comp) -
319 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 DEAL_II_NOT_IMPLEMENTED()
#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