Reference documentation for deal.II version GIT e22cb6a53e 2023-09-21 14:00:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
auto_derivative_function.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2001 - 2020 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/config.h>
21 
23 #include <deal.II/base/function.h>
24 
26 
81 template <int dim>
82 class AutoDerivativeFunction : public Function<dim>
83 {
84 public:
89  {
117  };
118 
133  AutoDerivativeFunction(const double h,
134  const unsigned int n_components = 1,
135  const double initial_time = 0.0);
136 
140  virtual ~AutoDerivativeFunction() override = default;
141 
146  void
148 
157  void
158  set_h(const double h);
159 
167  virtual Tensor<1, dim>
168  gradient(const Point<dim> &p,
169  const unsigned int component = 0) const override;
170 
177  virtual void
178  vector_gradient(const Point<dim> &p,
179  std::vector<Tensor<1, dim>> &gradients) const override;
180 
190  virtual void
191  gradient_list(const std::vector<Point<dim>> &points,
192  std::vector<Tensor<1, dim>> &gradients,
193  const unsigned int component = 0) const override;
194 
207  virtual void
209  const std::vector<Point<dim>> &points,
210  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
211 
215  static DifferenceFormula
216  get_formula_of_order(const unsigned int ord);
217 
218 
219 private:
223  double h;
224 
228  std::vector<Tensor<1, dim>> ht;
229 
234 };
235 
236 
238 
239 #endif
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim >> &gradients) const override
AutoDerivativeFunction(const double h, const unsigned int n_components=1, const double initial_time=0.0)
virtual ~AutoDerivativeFunction() override=default
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
virtual void gradient_list(const std::vector< Point< dim >> &points, std::vector< Tensor< 1, dim >> &gradients, const unsigned int component=0) const override
std::vector< Tensor< 1, dim > > ht
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)
static DifferenceFormula get_formula_of_order(const unsigned int ord)
const unsigned int n_components
Definition: function.h:164
Definition: point.h:112
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478