Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
auto_derivative_function.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2001 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_auto_derivative_function_h
17 #define dealii_auto_derivative_function_h
18 
19 
20 #include <deal.II/base/exceptions.h>
21 #include <deal.II/base/function.h>
22 
23 DEAL_II_NAMESPACE_OPEN
24 
80 template <int dim>
81 class AutoDerivativeFunction : public Function<dim>
82 {
83 public:
88  {
116  };
117 
132  AutoDerivativeFunction(const double h,
133  const unsigned int n_components = 1,
134  const double initial_time = 0.0);
135 
139  virtual ~AutoDerivativeFunction() override = default;
140 
145  void
147 
156  void
157  set_h(const double h);
158 
166  virtual Tensor<1, dim>
167  gradient(const Point<dim> & p,
168  const unsigned int component = 0) const override;
169 
176  virtual void
177  vector_gradient(const Point<dim> & p,
178  std::vector<Tensor<1, dim>> &gradients) const override;
179 
189  virtual void
190  gradient_list(const std::vector<Point<dim>> &points,
191  std::vector<Tensor<1, dim>> & gradients,
192  const unsigned int component = 0) const override;
193 
206  virtual void
208  const std::vector<Point<dim>> & points,
209  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
210 
214  static DifferenceFormula
215  get_formula_of_order(const unsigned int ord);
216 
217 
218 private:
222  double h;
223 
227  std::vector<Tensor<1, dim>> ht;
228 
233 };
234 
235 
236 DEAL_II_NAMESPACE_CLOSE
237 
238 #endif
virtual void gradient_list(const std::vector< Point< dim >> &points, std::vector< Tensor< 1, dim >> &gradients, const unsigned int component=0) const override
const unsigned int n_components
Definition: function.h:162
static DifferenceFormula get_formula_of_order(const unsigned int ord)
std::vector< Tensor< 1, dim > > ht
void set_formula(const DifferenceFormula formula=Euler)
virtual void vector_gradient_list(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim >> &gradients) const override
virtual ~AutoDerivativeFunction() override=default
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