Reference documentation for deal.II version 8.5.1
auto_derivative_function.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2001 - 2016 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 at
12 // the top level of the deal.II distribution.
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 
75 template <int dim>
76 class AutoDerivativeFunction : public Function<dim>
77 {
78 public:
79 
84  {
112  };
113 
128  AutoDerivativeFunction (const double h,
129  const unsigned int n_components = 1,
130  const double initial_time = 0.0);
131 
135  virtual ~AutoDerivativeFunction ();
136 
142 
151  void set_h (const double h);
152 
160  virtual Tensor<1,dim> gradient (const Point<dim> &p,
161  const unsigned int component = 0) const;
162 
169  virtual void vector_gradient (const Point<dim> &p,
170  std::vector<Tensor<1,dim> > &gradients) const;
171 
181  virtual void gradient_list (const std::vector<Point<dim> > &points,
182  std::vector<Tensor<1,dim> > &gradients,
183  const unsigned int component = 0) const;
184 
197  virtual void vector_gradient_list (const std::vector<Point<dim> > &points,
198  std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
199 
203  static
205  get_formula_of_order (const unsigned int ord);
206 
207 
208 private:
209 
213  double h;
214 
218  std::vector<Tensor<1,dim> > ht;
219 
224 };
225 
226 
227 DEAL_II_NAMESPACE_CLOSE
228 
229 #endif
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim > > &gradients) const
static DifferenceFormula get_formula_of_order(const unsigned int ord)
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< Tensor< 1, dim > > &gradients, const unsigned int component=0) const
void set_formula(const DifferenceFormula formula=Euler)
const unsigned int n_components
Definition: function.h:144
virtual void vector_gradient_list(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
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
std::vector< Tensor< 1, dim > > ht