Dune-Functions 2.11
Loading...
Searching...
No Matches
squeezetensor.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6#ifndef DUNE_FUNCTIONS_COMMON_SQUEEZETENSOR_HH
7#define DUNE_FUNCTIONS_COMMON_SQUEEZETENSOR_HH
8
9#include <dune/common/fvector.hh>
10#include <dune/common/fmatrix.hh>
11
12namespace Dune::Functions
13{
14 namespace Impl
15 {
20 template<class Object>
21 constexpr Object& squeezeTensor(Object& o){
22 return o;
23 }
24
29 template<class Object>
30 constexpr Object const& squeezeTensor(Object const& o){
31 return o;
32 }
33
38 template<class K>
39 constexpr K const& squeezeTensor(Dune::FieldVector<K,1> const& v){
40 return v[0];
41 }
42
45 template<class K>
46 constexpr K& squeezeTensor(Dune::FieldVector<K,1>& v){
47 return v[0];
48 }
49
52 template<class K, int N>
53 constexpr Dune::FieldVector<K, N> const& squeezeTensor(Dune::FieldMatrix<K,1,N> const& m){
54 return m[0];
55 }
56
59 template<class K, int N>
60 constexpr Dune::FieldVector<K, N>& squeezeTensor(Dune::FieldMatrix<K,1,N>& m){
61 return m[0];
62 }
63
66 template<class K, int N, int M>
67 constexpr Dune::FieldMatrix<K, N, M> const& squeezeTensor(std::array<Dune::FieldMatrix<K,N,M>, 1> const& m){
68 return m[0];
69 }
70
73 template<class K, int N, int M>
74 constexpr Dune::FieldMatrix<K, N, M>& squeezeTensor(std::array<Dune::FieldMatrix<K,N,M>, 1>& m){
75 return m[0];
76 }
77
78 } // namespace Impl
79
80} // namespace Dune::Functions
81
82#endif // DUNE_FUNCTIONS_COMMON_SQUEEZETENSOR_HH
Definition monomialset.hh:19