Reference documentation for deal.II version 8.4.1
tensor_function.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2015 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__tensor_function_h
17 #define dealii__tensor_function_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/subscriptor.h>
23 #include <deal.II/base/smartpointer.h>
24 #include <deal.II/base/function.h>
25 #include <deal.II/base/point.h>
26 #include <deal.II/base/function_time.h>
27 
28 #include <vector>
29 
30 DEAL_II_NAMESPACE_OPEN
31 
55 template <int rank, int dim, typename Number=double>
56 class TensorFunction : public FunctionTime<Number>,
57  public Subscriptor
58 {
59 public:
64 
66 
71  TensorFunction (const Number initial_time = Number(0.0));
72 
78  virtual ~TensorFunction ();
79 
83  virtual value_type value (const Point<dim> &p) const;
84 
90  virtual void value_list (const std::vector<Point<dim> > &points,
91  std::vector<value_type> &values) const;
92 
96  virtual gradient_type gradient (const Point<dim> &p) const;
97 
103  virtual void gradient_list (const std::vector<Point<dim> > &points,
104  std::vector<gradient_type> &gradients) const;
105 };
106 
107 
108 
116 template <int rank, int dim, typename Number=double>
117 class ConstantTensorFunction : public TensorFunction<rank, dim, Number>
118 {
119 public:
127  ConstantTensorFunction (const ::Tensor<rank, dim, Number> &value,
128  const Number initial_time = 0.0);
129 
130  virtual ~ConstantTensorFunction ();
131 
132  virtual typename ::TensorFunction<rank, dim, Number>::value_type value (const Point<dim> &p) const;
133 
134  virtual void value_list (const std::vector<Point<dim> > &points,
135  std::vector<typename ::TensorFunction<rank, dim, Number>::value_type> &values) const;
136 
137  virtual typename ::TensorFunction<rank, dim, Number>::gradient_type gradient (const Point<dim> &p) const;
138 
139  virtual void gradient_list (const std::vector<Point<dim> > &points,
140  std::vector<typename ::TensorFunction<rank, dim, Number>::gradient_type> &gradients) const;
141 
142 private:
143  const ::Tensor<rank, dim, Number> _value;
144 };
145 
146 
147 
155 template <int rank, int dim, typename Number=double>
156 class ZeroTensorFunction : public ConstantTensorFunction<rank, dim, Number>
157 {
158 public:
165  ZeroTensorFunction (const Number initial_time = 0.0);
166 };
167 
168 
169 DEAL_II_NAMESPACE_CLOSE
170 
171 #endif
ZeroTensorFunction(const Number initial_time=0.0)
TensorFunction(const Number initial_time=Number(0.0))
virtual typename::TensorFunction< rank, dim, Number >::gradient_type gradient(const Point< dim > &p) const
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< gradient_type > &gradients) const
virtual gradient_type gradient(const Point< dim > &p) const
virtual typename::TensorFunction< rank, dim, Number >::value_type value(const Point< dim > &p) const
virtual value_type value(const Point< dim > &p) const
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< value_type > &values) const
ConstantTensorFunction(const ::Tensor< rank, dim, Number > &value, const Number initial_time=0.0)
virtual ~TensorFunction()
Tensor< rank, dim, Number > value_type