include/deal.II/base/function_derivative.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: function_derivative.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2000, 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__function_derivative_h
00013 #define __deal2__function_derivative_h
00014 
00015 #include <deal.II/base/config.h>
00016 #include <deal.II/base/exceptions.h>
00017 #include <deal.II/base/function.h>
00018 #include <deal.II/base/auto_derivative_function.h>
00019 
00020 DEAL_II_NAMESPACE_OPEN
00021 
00022 
00039 template <int dim>
00040 class FunctionDerivative : public AutoDerivativeFunction<dim>
00041 {
00042   public:
00051     FunctionDerivative (const Function<dim> &f,
00052                         const Point<dim>    &direction,
00053                         const double         h = 1.e-6);
00054 
00075     FunctionDerivative (const Function<dim>            &f,
00076                         const std::vector<Point<dim> > &direction,
00077                         const double                    h = 1.e-6);
00078 
00092     void set_formula (typename AutoDerivativeFunction<dim>::DifferenceFormula formula
00093                       = AutoDerivativeFunction<dim>::Euler);
00098     void set_h (const double h);
00099 
00100     virtual double value (const Point<dim>& p,
00101                           const unsigned int component = 0) const;
00102 
00103     virtual void vector_value(const Point<dim>& p,
00104                               Vector<double>& value) const;
00105 
00106     virtual void value_list (const std::vector<Point<dim> > &points,
00107                              std::vector<double>            &values,
00108                              const unsigned int              component = 0) const;
00109 
00126     std::size_t memory_consumption () const;
00127 
00134     DeclException0(ExcInvalidFormula);
00136   private:
00140     const Function<dim>& f;
00141 
00146     double h;
00147 
00151     typename AutoDerivativeFunction<dim>::DifferenceFormula formula;
00152 
00158     std::vector<Point<dim> > incr;
00159 };
00160 
00161 DEAL_II_NAMESPACE_CLOSE
00162 
00163 #endif
00164 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Tue May 22 2012 12:06:05 by doxygen 1.7.3