opm-common
SymmTensor.hpp
1 /*
2  Copyright 2025 Equinor ASA
3 
4  This file is part of the Open Porous Media Project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_UTIL_SYMM_TENSOR_HPP
21 #define OPM_UTIL_SYMM_TENSOR_HPP
22 
23 namespace Dune {
24 template<class K, int Size> class FieldVector;
25 }
26 
27 #include <opm/common/utility/VoigtArray.hpp>
28 
29 #include <utility>
30 
31 namespace Opm {
32 
33 template<class T>
34 class SymmTensor : public VoigtContainer<T>
35 {
36 public:
37  using field_type = T;
38 
39  SymmTensor() = default;
40  SymmTensor(std::initializer_list<T> value)
41  : VoigtContainer<T>(std::move(value))
42  {}
43 
44  void operator+=(const T data);
45  void operator+=(const SymmTensor<T>& data);
46 
47  void operator*=(const T data);
48 
49  SymmTensor<T>& operator=(const T value);
50 
51  void reset();
52 
53  T trace() const;
54 #if HAVE_DUNE_COMMON
55  T traction(const Dune::FieldVector<T,3>& normal) const;
56 #endif
57 };
58 
59 template<class T1, class T2>
60 SymmTensor<T1> operator*(const T2 value, SymmTensor<T1> t1);
61 template<class T1, class T2>
62 SymmTensor<T1> operator*(SymmTensor<T1> t1, const T2 value);
63 template<class T>
64 SymmTensor<T> operator+(SymmTensor<T> t1, const SymmTensor<T>& t2);
65 
66 } // namespace Opm
67 
68 #endif // OPM_UTIL_SYMM_TENSOR_HPP
Definition: SymmTensor.hpp:34
Definition: SymmTensor.hpp:23
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: SymmTensor.hpp:24
Definition: VoigtArray.hpp:39