00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __deal2__tensor_function_h
00013 #define __deal2__tensor_function_h
00014
00015
00016 #include <deal.II/base/config.h>
00017 #include <deal.II/base/exceptions.h>
00018 #include <deal.II/base/subscriptor.h>
00019 #include <deal.II/base/smartpointer.h>
00020 #include <deal.II/base/function.h>
00021 #include <deal.II/base/point.h>
00022 #include <deal.II/base/function_time.h>
00023
00024 #include <vector>
00025
00026 DEAL_II_NAMESPACE_OPEN
00027
00054 template <int rank, int dim>
00055 class TensorFunction : public FunctionTime,
00056 public Subscriptor
00057 {
00058 public:
00064 typedef Tensor<rank,dim> value_type;
00065
00066 #ifdef DEAL_II_LOCAL_TYPEDEF_COMP_WORKAROUND
00067
00086 template <int dim2>
00087 struct GradientTypeHelper
00088 {
00089 typedef Tensor<rank+1,dim> type;
00090 };
00091
00104 typedef typename GradientTypeHelper<dim>::type gradient_type;
00105 #else
00106 typedef Tensor<rank+1,dim> gradient_type;
00107 #endif
00108
00115 TensorFunction (const double initial_time = 0.0);
00116
00125 virtual ~TensorFunction ();
00126
00131 virtual value_type value (const Point<dim> &p) const;
00132
00141 virtual void value_list (const std::vector<Point<dim> > &points,
00142 std::vector<value_type> &values) const;
00143
00148 virtual gradient_type gradient (const Point<dim> &p) const;
00149
00158 virtual void gradient_list (const std::vector<Point<dim> > &points,
00159 std::vector<gradient_type> &gradients) const;
00160
00164 DeclException0 (ExcPureFunctionCalled);
00168 DeclException2 (ExcVectorHasWrongSize,
00169 int, int,
00170 << "The vector has size " << arg1 << " but should have "
00171 << arg2 << " elements.");
00172
00173 };
00174
00175 DEAL_II_NAMESPACE_CLOSE
00176
00177 #endif
00178