v0.14.0
src
ftensor
src
FTensor
Tensor2
Tensor2_or_Tensor2.hpp
Go to the documentation of this file.
1
/* Creates a Tensor2_symmetric expression by adding two Tensor2's
2
together. */
3
4
/* This version is for expressions like A(i,j)||B(i,j) */
5
6
#pragma once
7
8
namespace
FTensor
9
{
10
/* Base Template */
11
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0_0,
int
Dim1_0,
12
int
Dim0_1,
int
Dim1_1,
char
i0,
char
j0,
char
i1,
char
j1>
13
class
Tensor2_or_Tensor2
14
{};
15
16
/* A(i,j)||B(i,j) */
17
18
template
<
class
A,
class
B,
class
T,
class
U,
int
Dim,
char
i,
char
j>
19
class
Tensor2_or_Tensor2
<
A
, B, T,
U
, Dim, Dim, Dim, Dim,
i
,
j
,
i
,
j
>
20
{
21
Tensor2_Expr<A, T, Dim, Dim, i, j>
iterA
;
22
Tensor2_Expr<B, U, Dim, Dim, i, j>
iterB
;
23
24
public
:
25
typename
promote<T, U>::V
operator()
(
const
int
N1,
const
int
N2)
const
26
{
27
return
iterA(N1, N2) + iterB(N1, N2);
28
}
29
30
Tensor2_or_Tensor2
(
const
Tensor2_Expr<A, T, Dim, Dim, i, j>
&
a
,
31
const
Tensor2_Expr<B, U, Dim, Dim, i, j>
&b)
32
: iterA(
a
), iterB(b)
33
{}
34
};
35
36
/* A(i,j)||B(j,i) */
37
38
template
<
class
A,
class
B,
class
T,
class
U,
int
Dim,
char
i,
char
j>
39
class
Tensor2_or_Tensor2
<
A
, B, T,
U
, Dim, Dim, Dim, Dim,
i
,
j
,
j
,
i
>
40
{
41
Tensor2_Expr<A, T, Dim, Dim, i, j>
iterA
;
42
Tensor2_Expr<B, U, Dim, Dim, j, i>
iterB
;
43
44
public
:
45
typename
promote<T, U>::V
operator()
(
const
int
N1,
const
int
N2)
const
46
{
47
return
iterA(N1, N2) + iterB(N2, N1);
48
}
49
50
Tensor2_or_Tensor2
(
const
Tensor2_Expr<A, T, Dim, Dim, i, j>
&
a
,
51
const
Tensor2_Expr<B, U, Dim, Dim, j, i>
&b)
52
: iterA(
a
), iterB(b)
53
{}
54
};
55
56
template
<
class
A
,
class
B,
class
T,
class
U
,
int
Dim0_0,
int
Dim1_0,
57
int
Dim0_1,
int
Dim1_1,
char
i0,
char
j0,
char
i1,
char
j1>
58
Tensor2_symmetric_Expr<Tensor2_or_Tensor2<
A
, B, T,
U
, Dim0_0, Dim1_0, Dim0_1,
59
Dim1_1, i0, j0, i1, j1>,
60
typename
promote<T, U>::V
, Dim0_0, i0, j0>
61
operator||
(
const
Tensor2_Expr<A, T, Dim0_0, Dim1_0, i0, j0>
&
a
,
62
const
Tensor2_Expr<B, U, Dim0_1, Dim1_1, i1, j1>
&b)
63
{
64
using
TensorExpr =
Tensor2_or_Tensor2
<
A
, B, T,
U
, Dim0_0, Dim1_0, Dim0_1,
65
Dim1_1, i0, j0, i1, j1>;
66
static_assert(
67
!std::is_empty<TensorExpr>::value,
68
"Indexes or Dimensions are not compatible with the || operator"
);
69
return
Tensor2_symmetric_Expr<TensorExpr, typename promote<T, U>::V
,
70
Dim0_0, i0, j0>(TensorExpr(
a
, b));
71
}
72
}
FTensor
JSON compatible output.
Definition:
Christof_constructor.hpp:6
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, i, j >::Tensor2_or_Tensor2
Tensor2_or_Tensor2(const Tensor2_Expr< A, T, Dim, Dim, i, j > &a, const Tensor2_Expr< B, U, Dim, Dim, i, j > &b)
Definition:
Tensor2_or_Tensor2.hpp:30
FTensor::Tensor2_symmetric_Expr
Definition:
Tensor2_symmetric_Expr.hpp:36
FTensor::Tensor2_Expr< A, T, Dim, Dim, i, j >
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, j, i >::iterB
Tensor2_Expr< B, U, Dim, Dim, j, i > iterB
Definition:
Tensor2_or_Tensor2.hpp:42
A
constexpr AssemblyType A
Definition:
operators_tests.cpp:30
FTensor::operator||
Ddg_Expr< Ddg_or_Ddg< A, B, T, U, Dim, i, j, k, l >, typename promote< T, U >::V, Dim, Dim, i, k, j, l > operator||(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, l, k, j > &b)
Definition:
Ddg_or_Ddg.hpp:33
a
constexpr double a
Definition:
approx_sphere.cpp:30
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, j, i >::Tensor2_or_Tensor2
Tensor2_or_Tensor2(const Tensor2_Expr< A, T, Dim, Dim, i, j > &a, const Tensor2_Expr< B, U, Dim, Dim, j, i > &b)
Definition:
Tensor2_or_Tensor2.hpp:50
FTensor::promote::V
T1 V
Definition:
promote.hpp:17
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, i, j >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition:
Tensor2_or_Tensor2.hpp:25
i
FTensor::Index< 'i', SPACE_DIM > i
Definition:
hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, i, j >::iterA
Tensor2_Expr< A, T, Dim, Dim, i, j > iterA
Definition:
Tensor2_or_Tensor2.hpp:21
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, j, i >::operator()
promote< T, U >::V operator()(const int N1, const int N2) const
Definition:
Tensor2_or_Tensor2.hpp:45
j
FTensor::Index< 'j', 3 > j
Definition:
matrix_function.cpp:19
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, j, i >::iterA
Tensor2_Expr< A, T, Dim, Dim, i, j > iterA
Definition:
Tensor2_or_Tensor2.hpp:41
FTensor::Tensor2_or_Tensor2
Definition:
Tensor2_or_Tensor2.hpp:13
FTensor::Tensor2_or_Tensor2< A, B, T, U, Dim, Dim, Dim, Dim, i, j, i, j >::iterB
Tensor2_Expr< B, U, Dim, Dim, i, j > iterB
Definition:
Tensor2_or_Tensor2.hpp:22
EshelbianPlasticity::U
@ U
Definition:
EshelbianContact.cpp:197
Generated by
Doxygen
1.8.17 and hosted at