deal.II version GIT relicensing-2238-gc05b561aad 2024-12-10 20:50:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
tensor_function.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 1999 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_tensor_function_h
16#define dealii_tensor_function_h
17
18
19#include <deal.II/base/config.h>
20
26#include <deal.II/base/point.h>
27
28#include <vector>
29
31
54template <int rank, int dim, typename Number = double>
56 : public FunctionTime<typename numbers::NumberTraits<Number>::real_type>,
58{
59public:
64
69
73 using time_type = typename FunctionTime<
75
80 TensorFunction(const time_type initial_time = time_type(0.0));
81
87 virtual ~TensorFunction() override = default;
88
92 virtual value_type
93 value(const Point<dim> &p) const;
94
100 virtual void
101 value_list(const std::vector<Point<dim>> &points,
102 std::vector<value_type> &values) const;
103
107 virtual gradient_type
108 gradient(const Point<dim> &p) const;
109
115 virtual void
116 gradient_list(const std::vector<Point<dim>> &points,
117 std::vector<gradient_type> &gradients) const;
118};
119
120
121
128template <int rank, int dim, typename Number = double>
129class ConstantTensorFunction : public TensorFunction<rank, dim, Number>
130{
131public:
136
144 ConstantTensorFunction(const ::Tensor<rank, dim, Number> &value,
145 const time_type initial_time = 0.0);
146
147 virtual ~ConstantTensorFunction() override = default;
148
149 virtual typename ::TensorFunction<rank, dim, Number>::value_type
150 value(const Point<dim> &p) const override;
151
152 virtual void
154 const std::vector<Point<dim>> &points,
155 std::vector<typename ::TensorFunction<rank, dim, Number>::value_type>
156 &values) const override;
157
158 virtual typename ::TensorFunction<rank, dim, Number>::gradient_type
159 gradient(const Point<dim> &p) const override;
160
161 virtual void
163 const std::vector<Point<dim>> &points,
164 std::vector<
165 typename ::TensorFunction<rank, dim, Number>::gradient_type>
166 &gradients) const override;
167
168private:
169 const ::Tensor<rank, dim, Number> _value;
170};
171
172
173
180template <int rank, int dim, typename Number = double>
181class ZeroTensorFunction : public ConstantTensorFunction<rank, dim, Number>
182{
183public:
187 using time_type =
189
196 ZeroTensorFunction(const time_type initial_time = 0.0);
197};
198
199
201
202#endif
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< typename ::TensorFunction< rank, dim, Number >::value_type > &values) const override
virtual ~ConstantTensorFunction() override=default
typename TensorFunction< rank, dim, Number >::time_type time_type
ConstantTensorFunction(const ::Tensor< rank, dim, Number > &value, const time_type initial_time=0.0)
virtual typename::TensorFunction< rank, dim, Number >::value_type value(const Point< dim > &p) const override
const ::Tensor< rank, dim, Number > _value
virtual typename::TensorFunction< rank, dim, Number >::gradient_type gradient(const Point< dim > &p) const override
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< typename ::TensorFunction< rank, dim, Number >::gradient_type > &gradients) const override
Definition point.h:111
virtual void value_list(const std::vector< Point< dim > > &points, std::vector< value_type > &values) const
virtual gradient_type gradient(const Point< dim > &p) const
virtual value_type value(const Point< dim > &p) const
TensorFunction(const time_type initial_time=time_type(0.0))
virtual ~TensorFunction() override=default
virtual void gradient_list(const std::vector< Point< dim > > &points, std::vector< gradient_type > &gradients) const
typename FunctionTime< typename numbers::NumberTraits< Number >::real_type >::time_type time_type
typename ConstantTensorFunction< rank, dim, Number >::time_type time_type
ZeroTensorFunction(const time_type initial_time=0.0)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499