v0.16.0
Loading...
Searching...
No Matches
DiffTensor.hpp
Go to the documentation of this file.
1/**
2 * @file DiffTensor.hpp
3 *
4 */
5
6#pragma once
7
8namespace FTensor {
9
10/**
11 * @brief Fourth-order differential tensor symmetric in both index pairs
12 *
13 * @tparam T
14 */
15template <class T = int> class DiffTensor {
16public:
18
19 constexpr value_type operator()(const int N0, const int N1, const int N2,
20 const int N3) const {
21 const auto first =
22 (N0 == N2 && N1 == N3) ? value_type(1) : value_type(0);
23 const auto second =
24 (N0 == N3 && N1 == N2) ? value_type(1) : value_type(0);
25 return (first + second) / value_type(2);
26 }
27
28 template <char i, char j, char k, char l, int Dim01, int Dim23>
29 Ddg_Expr<DiffTensor<T>, value_type, Dim01, Dim23, i, j, k, l>
31 const Index<k, Dim23> &, const Index<l, Dim23> &) const {
32 return Ddg_Expr<DiffTensor<T>, value_type, Dim01, Dim23, i, j, k, l>(
33 *this);
34 };
35};
36
37template <class T = int> constexpr auto diff_tensor() {
38 return DiffTensor<T>();
39}
40
41template <class T = int, char i, char j, char k, char l, int Dim01, int Dim23>
42Ddg_Expr<DiffTensor<T>, typename DiffTensor<T>::value_type, Dim01, Dim23, i, j,
43 k, l>
49
50} // namespace FTensor
Fourth-order differential tensor symmetric in both index pairs.
Ddg_Expr< DiffTensor< T >, value_type, Dim01, Dim23, i, j, k, l > operator()(const Index< i, Dim01 > &, const Index< j, Dim01 > &, const Index< k, Dim23 > &, const Index< l, Dim23 > &) const
typename promote< T, double >::V value_type
constexpr value_type operator()(const int N0, const int N1, const int N2, const int N3) const
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
Tensors class implemented by Walter Landry.
Definition FTensor.hpp:51
constexpr auto diff_tensor()