v0.16.0
Loading...
Searching...
No Matches
src
ftensor
src
FTensor
DiffSymmetrize.hpp
Go to the documentation of this file.
1
/**
2
* @file DiffSymmetrize.hpp
3
*
4
*/
5
6
#pragma once
7
8
namespace
FTensor
{
9
10
/**
11
* @brief Fourth-order symmetrization tensor
12
*
13
* @tparam T
14
*/
15
template
<
class
T =
int
>
class
DiffSymmetrize
{
16
public
:
17
using
value_type
=
typename
promote<T, double>::V
;
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
Dim0,
int
Dim1,
int
Dim2,
29
int
Dim3>
30
Tensor4_Expr<DiffSymmetrize<T>
,
value_type
, Dim0, Dim1, Dim2, Dim3,
i
,
j
,
k
,
31
l
>
32
operator()
(
const
Index<i, Dim0>
&,
const
Index<j, Dim1>
&,
33
const
Index<k, Dim2>
&,
const
Index<l, Dim3>
&)
const
{
34
return
Tensor4_Expr<DiffSymmetrize<T>
,
value_type
, Dim0, Dim1, Dim2, Dim3,
35
i
,
j
,
k
,
l
>(*this);
36
};
37
};
38
39
template
<
class
T =
int
>
constexpr
auto
diff_symmetrize
() {
40
return
DiffSymmetrize<T>
();
41
}
42
43
template
<
class
T = int,
char
i
,
char
j
,
char
k
,
char
l
,
int
Dim0,
int
Dim1,
44
int
Dim2,
int
Dim3>
45
Tensor4_Expr<DiffSymmetrize<T>,
typename
DiffSymmetrize<T>::value_type
, Dim0,
46
Dim1, Dim2, Dim3,
i
,
j
,
k
,
l
>
47
diff_symmetrize
(
const
Index<i, Dim0>
&,
const
Index<j, Dim1>
&,
48
const
Index<k, Dim2>
&,
const
Index<l, Dim3>
&) {
49
return
DiffSymmetrize<T>
()(
Index<i, Dim0>
(),
Index<j, Dim1>
(),
50
Index<k, Dim2>
(),
Index<l, Dim3>
());
51
}
52
53
}
// namespace FTensor
FTensor::DiffSymmetrize
Fourth-order symmetrization tensor.
Definition
DiffSymmetrize.hpp:15
FTensor::DiffSymmetrize::operator()
Tensor4_Expr< DiffSymmetrize< T >, value_type, Dim0, Dim1, Dim2, Dim3, i, j, k, l > operator()(const Index< i, Dim0 > &, const Index< j, Dim1 > &, const Index< k, Dim2 > &, const Index< l, Dim3 > &) const
Definition
DiffSymmetrize.hpp:32
FTensor::DiffSymmetrize::operator()
constexpr value_type operator()(const int N0, const int N1, const int N2, const int N3) const
Definition
DiffSymmetrize.hpp:19
FTensor::DiffSymmetrize::value_type
typename promote< T, double >::V value_type
Definition
DiffSymmetrize.hpp:17
FTensor::Index
Definition
Index.hpp:24
FTensor::Tensor4_Expr
Definition
Tensor4_Expr.hpp:26
FTensor::promote::V
T1 V
Definition
promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition
hcurl_divergence_operator_2d.cpp:27
l
FTensor::Index< 'l', 3 > l
Definition
matrix_function.cpp:23
j
FTensor::Index< 'j', 3 > j
Definition
matrix_function.cpp:21
k
FTensor::Index< 'k', 3 > k
Definition
matrix_function.cpp:22
FTensor
Tensors class implemented by Walter Landry.
Definition
FTensor.hpp:51
FTensor::diff_symmetrize
constexpr auto diff_symmetrize()
Definition
DiffSymmetrize.hpp:39
Generated by
Doxygen
1.9.8 and hosted at