Reference documentation for deal.II version 8.1.0
auto_derivative_function.h
1 // ---------------------------------------------------------------------
2 // @f$Id: auto_derivative_function.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 2001 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__auto_derivative_function_h
18 #define __deal2__auto_derivative_function_h
19 
20 
22 #include <deal.II/base/function.h>
23 
25 
78 template <int dim>
79 class AutoDerivativeFunction : public Function<dim>
80 {
81 public:
82 
87  {
117  };
118 
146  AutoDerivativeFunction (const double h,
147  const unsigned int n_components = 1,
148  const double initial_time = 0.0);
149 
154  virtual ~AutoDerivativeFunction ();
155 
162 
178  void set_h (const double h);
179 
189  virtual Tensor<1,dim> gradient (const Point<dim> &p,
190  const unsigned int component = 0) const;
191 
201  virtual void vector_gradient (const Point<dim> &p,
202  std::vector<Tensor<1,dim> > &gradients) const;
203 
217  virtual void gradient_list (const std::vector<Point<dim> > &points,
218  std::vector<Tensor<1,dim> > &gradients,
219  const unsigned int component = 0) const;
220 
239  virtual void vector_gradient_list (const std::vector<Point<dim> > &points,
240  std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
241 
247  static
249  get_formula_of_order (const unsigned int ord);
250 
254  DeclException0(ExcInvalidFormula);
255 
256 private:
257 
263  double h;
264 
269  std::vector<Tensor<1,dim> > ht;
270 
276 };
277 
278 
279 DEAL_II_NAMESPACE_CLOSE
280 
281 #endif
virtual void vector_gradient_list(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
virtual ~AutoDerivativeFunction()
virtual Tensor< 1, dim > gradient(const Point< dim > &p, const unsigned int component=0) const
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
static DifferenceFormula get_formula_of_order(const unsigned int ord)
virtual void vector_gradient(const Point< dim > &p, std::vector< Tensor< 1, dim > > &gradients) const
DeclException0(ExcInvalidFormula)
const unsigned int n_components
Definition: function.h:130
void set_h(const double h)
AutoDerivativeFunction(const double h, const unsigned int n_components=1, const double initial_time=0.0)
std::vector< Tensor< 1, dim > > ht