Reference documentation for deal.II version Git d9b14c2d54 2019-09-14 18:13:29 -0600
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
tensor_function.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 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.md at
12 // the top level directory of deal.II.
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 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/function.h>
24 #include <deal.II/base/function_time.h>
25 #include <deal.II/base/point.h>
26 #include <deal.II/base/smartpointer.h>
27 #include <deal.II/base/subscriptor.h>
28 
29 #include <vector>
30 
31 DEAL_II_NAMESPACE_OPEN
32 
56 template <int rank, int dim, typename Number = double>
58  : public FunctionTime<typename numbers::NumberTraits<Number>::real_type>,
59  public Subscriptor
60 {
61 public:
66 
71 
75  using time_type = typename FunctionTime<
77 
82  TensorFunction(const time_type initial_time = time_type(0.0));
83 
89  virtual ~TensorFunction() override = default;
90 
94  virtual value_type
95  value(const Point<dim> &p) const;
96 
102  virtual void
103  value_list(const std::vector<Point<dim>> &points,
104  std::vector<value_type> & values) const;
105 
109  virtual gradient_type
110  gradient(const Point<dim> &p) const;
111 
117  virtual void
118  gradient_list(const std::vector<Point<dim>> &points,
119  std::vector<gradient_type> & gradients) const;
120 };
121 
122 
123 
131 template <int rank, int dim, typename Number = double>
132 class ConstantTensorFunction : public TensorFunction<rank, dim, Number>
133 {
134 public:
139 
147  ConstantTensorFunction(const ::Tensor<rank, dim, Number> &value,
148  const time_type initial_time = 0.0);
149 
150  virtual ~ConstantTensorFunction() override = default;
151 
152  virtual typename ::TensorFunction<rank, dim, Number>::value_type
153  value(const Point<dim> &p) const override;
154 
155  virtual void
156  value_list(
157  const std::vector<Point<dim>> &points,
158  std::vector<typename ::TensorFunction<rank, dim, Number>::value_type>
159  &values) const override;
160 
161  virtual typename ::TensorFunction<rank, dim, Number>::gradient_type
162  gradient(const Point<dim> &p) const override;
163 
164  virtual void
166  const std::vector<Point<dim>> &points,
167  std::vector<
168  typename ::TensorFunction<rank, dim, Number>::gradient_type>
169  &gradients) const override;
170 
171 private:
172  const ::Tensor<rank, dim, Number> _value;
173 };
174 
175 
176 
184 template <int rank, int dim, typename Number = double>
185 class ZeroTensorFunction : public ConstantTensorFunction<rank, dim, Number>
186 {
187 public:
191  using time_type =
193 
200  ZeroTensorFunction(const time_type initial_time = 0.0);
201 };
202 
203 
204 DEAL_II_NAMESPACE_CLOSE
205 
206 #endif
virtual void gradient_list(const std::vector< Point< dim >> &points, std::vector< gradient_type > &gradients) const
virtual value_type value(const Point< dim > &p) const
typename FunctionTime< typename numbers::NumberTraits< Number >::real_type >::time_type time_type
typename TensorFunction< rank, dim, Number >::time_type time_type
TensorFunction(const time_type initial_time=time_type(0.0))
virtual ~TensorFunction() override=default
virtual gradient_type gradient(const Point< dim > &p) const
numbers::NumberTraits< RangeNumberType >::real_type time_type
Definition: tensor.h:422
virtual void value_list(const std::vector< Point< dim >> &points, std::vector< value_type > &values) const