include/deal.II/base/auto_derivative_function.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: auto_derivative_function.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //---------------------------------------------------------------------------
00012 #ifndef __deal2__auto_derivative_function_h
00013 #define __deal2__auto_derivative_function_h
00014 
00015 
00016 #include <deal.II/base/exceptions.h>
00017 #include <deal.II/base/function.h>
00018 
00019 DEAL_II_NAMESPACE_OPEN
00020 
00073 template <int dim>
00074 class AutoDerivativeFunction : public Function<dim>
00075 {
00076   public:
00077 
00081     enum DifferenceFormula
00082     {
00092           Euler,
00102           UpwindEuler,
00111           FourthOrder
00112     };
00113 
00141     AutoDerivativeFunction (const double h,
00142                             const unsigned int n_components = 1,
00143                             const double       initial_time = 0.0);
00144 
00149     virtual ~AutoDerivativeFunction ();
00150 
00156     void set_formula (const DifferenceFormula formula = Euler);
00157 
00173     void set_h (const double h);
00174 
00184     virtual Tensor<1,dim> gradient (const Point<dim>   &p,
00185                                     const unsigned int  component = 0) const;
00186 
00196     virtual void vector_gradient (const Point<dim>            &p,
00197                                   std::vector<Tensor<1,dim> > &gradients) const;
00198 
00212     virtual void gradient_list (const std::vector<Point<dim> > &points,
00213                                 std::vector<Tensor<1,dim> >    &gradients,
00214                                 const unsigned int              component = 0) const;
00215 
00234     virtual void vector_gradient_list (const std::vector<Point<dim> > &points,
00235                                        std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
00236 
00242     static
00243     DifferenceFormula
00244     get_formula_of_order (const unsigned int ord);
00245 
00249     DeclException0(ExcInvalidFormula);
00250 
00251   private:
00252 
00258     double h;
00259 
00264     std::vector<Tensor<1,dim> > ht;
00265 
00270     DifferenceFormula formula;
00271 };
00272 
00273 
00274 DEAL_II_NAMESPACE_CLOSE
00275 
00276 #endif
00277 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Thu May 17 2012 20:04:34 by doxygen 1.7.3