v0.14.0
src
ftensor
src
FTensor
Tensor1
Tensor1_times_generic.hpp
Go to the documentation of this file.
1
/* Multipliess a Tensor1 by a generic (or vice versa), yielding a Tensor1.
2
Usually used for doubles, but could be used for complex, etc. All
3
that it requires is that you can add an element of the Tensor1 to
4
it. */
5
6
/* A(i) * d0 -> Tensor1 */
7
8
#pragma once
9
10
namespace
FTensor
11
{
12
template
<
class
A,
class
T,
class
U,
int
Dim,
char
i>
13
class
Tensor1_times_generic
14
{
15
Tensor1_Expr<A, T, Dim, i>
iterA
;
16
U
d
;
17
18
public
:
19
typename
promote<T, U>::V
operator()
(
const
int
N
)
const
20
{
21
return
iterA
(
N
) *
d
;
22
}
23
24
Tensor1_times_generic
(
const
Tensor1_Expr<A, T, Dim, i>
&
a
,
const
U
&d0)
25
:
iterA
(
a
),
d
(d0)
26
{}
27
};
28
29
template
<
class
A,
class
T,
class
U,
int
Dim,
char
i>
30
Tensor1_Expr<Tensor1_times_generic<A, T, U, Dim, i>
,
31
typename
promote<T, U>::V
, Dim,
i
>
32
operator*
(
const
Tensor1_Expr<A, T, Dim, i>
&
a
,
const
U
&d0)
33
{
34
using
TensorExpr =
Tensor1_times_generic<A, T, U, Dim, i>
;
35
return
Tensor1_Expr<TensorExpr, typename promote<T, U>::V
, Dim,
i
>(
36
TensorExpr(
a
, d0));
37
}
38
39
/* d0 * A(i) -> Tensor1 */
40
41
template
<
class
A,
class
T,
class
U,
int
Dim,
char
i>
42
Tensor1_Expr<Tensor1_times_generic<A, T, U, Dim, i>
,
43
typename
promote<T, U>::V
, Dim,
i
>
44
operator*
(
const
U
&d0,
const
Tensor1_Expr<A, T, Dim, i>
&
a
)
45
{
46
using
TensorExpr =
Tensor1_times_generic<A, T, U, Dim, i>
;
47
return
Tensor1_Expr<TensorExpr, typename promote<T, U>::V
, Dim,
i
>(
48
TensorExpr(
a
, d0));
49
}
50
}
FTensor
JSON compatible output.
Definition:
Christof_constructor.hpp:6
FTensor::operator*
promote< T, U >::V operator*(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, k, j, l > &b)
Definition:
Ddg_times_Ddg.hpp:79
FTensor::Tensor1_times_generic
Definition:
Tensor1_times_generic.hpp:13
FTensor::Tensor1_times_generic::d
U d
Definition:
Tensor1_times_generic.hpp:16
FTensor::Tensor1_Expr
Definition:
Tensor1_Expr.hpp:27
a
constexpr double a
Definition:
approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition:
promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition:
hcurl_divergence_operator_2d.cpp:27
N
const int N
Definition:
speed_test.cpp:3
FTensor::Tensor1_times_generic::Tensor1_times_generic
Tensor1_times_generic(const Tensor1_Expr< A, T, Dim, i > &a, const U &d0)
Definition:
Tensor1_times_generic.hpp:24
Tensor1_Expr
Definition:
single.cpp:11
FTensor::Tensor1_times_generic::operator()
promote< T, U >::V operator()(const int N) const
Definition:
Tensor1_times_generic.hpp:19
EshelbianPlasticity::U
@ U
Definition:
EshelbianContact.cpp:197
FTensor::Tensor1_times_generic::iterA
Tensor1_Expr< A, T, Dim, i > iterA
Definition:
Tensor1_times_generic.hpp:15
Generated by
Doxygen
1.8.17 and hosted at