Reference documentation for deal.II version 9.2.0
\(\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 - 2019 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 
82 template <int dim>
83 class AutoDerivativeFunction : public Function<dim>
84 {
85 public:
90  {
118  };
119 
134  AutoDerivativeFunction(const double h,
135  const unsigned int n_components = 1,
136  const double initial_time = 0.0);
137 
141  virtual ~AutoDerivativeFunction() override = default;
142 
147  void
149 
158  void
159  set_h(const double h);
160 
168  virtual Tensor<1, dim>
169  gradient(const Point<dim> & p,
170  const unsigned int component = 0) const override;
171 
178  virtual void
179  vector_gradient(const Point<dim> & p,
180  std::vector<Tensor<1, dim>> &gradients) const override;
181 
191  virtual void
192  gradient_list(const std::vector<Point<dim>> &points,
193  std::vector<Tensor<1, dim>> & gradients,
194  const unsigned int component = 0) const override;
195 
208  virtual void
210  const std::vector<Point<dim>> & points,
211  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
212 
216  static DifferenceFormula
217  get_formula_of_order(const unsigned int ord);
218 
219 
220 private:
224  double h;
225 
229  std::vector<Tensor<1, dim>> ht;
230 
235 };
236 
237 
239 
240 #endif
AutoDerivativeFunction
Definition: auto_derivative_function.h:83
AutoDerivativeFunction::UpwindEuler
@ UpwindEuler
Definition: auto_derivative_function.h:108
Function< dim >::n_components
const unsigned int n_components
Definition: function.h:165
AutoDerivativeFunction::get_formula_of_order
static DifferenceFormula get_formula_of_order(const unsigned int ord)
Definition: auto_derivative_function.cc:336
AutoDerivativeFunction::~AutoDerivativeFunction
virtual ~AutoDerivativeFunction() override=default
AutoDerivativeFunction::set_formula
void set_formula(const DifferenceFormula formula=Euler)
Definition: auto_derivative_function.cc:43
AutoDerivativeFunction::ht
std::vector< Tensor< 1, dim > > ht
Definition: auto_derivative_function.h:229
AutoDerivativeFunction::h
double h
Definition: auto_derivative_function.h:224
AutoDerivativeFunction::vector_gradient_list
virtual void vector_gradient_list(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override
Definition: auto_derivative_function.cc:268
AutoDerivativeFunction::vector_gradient
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim >> &gradients) const override
Definition: auto_derivative_function.cc:127
AutoDerivativeFunction::Euler
@ Euler
Definition: auto_derivative_function.h:99
Tensor< 1, dim >
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
AutoDerivativeFunction::set_h
void set_h(const double h)
Definition: auto_derivative_function.cc:65
exceptions.h
function.h
AutoDerivativeFunction::FourthOrder
@ FourthOrder
Definition: auto_derivative_function.h:117
AutoDerivativeFunction::gradient
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const override
Definition: auto_derivative_function.cc:75
Point< dim >
config.h
Function
Definition: function.h:151
AutoDerivativeFunction::AutoDerivativeFunction
AutoDerivativeFunction(const double h, const unsigned int n_components=1, const double initial_time=0.0)
Definition: auto_derivative_function.cc:26
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
AutoDerivativeFunction::gradient_list
virtual void gradient_list(const std::vector< Point< dim >> &points, std::vector< Tensor< 1, dim >> &gradients, const unsigned int component=0) const override
Definition: auto_derivative_function.cc:204
AutoDerivativeFunction::DifferenceFormula
DifferenceFormula
Definition: auto_derivative_function.h:89
AutoDerivativeFunction::formula
DifferenceFormula formula
Definition: auto_derivative_function.h:234