v0.14.0
src
ftensor
src
FTensor
Tensor1
diffusion_Tensor1.hpp
Go to the documentation of this file.
1
/* Computes 2*del^2 of a Tensor1_ptr but uses diagonal derivatives for
2
half of it. Yields a Tensor1. */
3
4
#pragma once
5
6
namespace
FTensor
7
{
8
template
<
class
T,
int
Dim,
char
i>
class
diffusion_Tensor1
9
{
10
const
Tensor1<T *, Dim>
&
a
;
11
const
int
di
,
dj
,
dk
;
12
const
double
dx
;
13
14
public
:
15
typename
promote<T, double>::V
operator()
(
const
int
N1)
const
16
{
17
return
((*(
a
.ptr(N1) +
di
) - 2 *
a
(N1) + *(
a
.ptr(N1) -
di
))
18
+ (*(
a
.ptr(N1) +
dj
) - 2 *
a
(N1) + *(
a
.ptr(N1) -
dj
))
19
+ (*(
a
.ptr(N1) +
dk
) - 2 *
a
(N1) + *(
a
.ptr(N1) -
dk
))
20
+ ((*(
a
.ptr(N1) +
di
+
dj
) + *(
a
.ptr(N1) +
di
-
dj
)
21
+ *(
a
.ptr(N1) -
di
+
dj
) + *(
a
.ptr(N1) -
di
-
dj
)
22
- 4 *
a
(N1))
23
+ (*(
a
.ptr(N1) +
di
+
dk
) + *(
a
.ptr(N1) +
di
-
dk
)
24
+ *(
a
.ptr(N1) -
di
+
dk
) + *(
a
.ptr(N1) -
di
-
dk
)
25
- 4 *
a
(N1))
26
+ (*(
a
.ptr(N1) +
dj
+
dk
) + *(
a
.ptr(N1) +
dj
-
dk
)
27
+ *(
a
.ptr(N1) -
dj
+
dk
) + *(
a
.ptr(N1) -
dj
-
dk
)
28
- 4 *
a
(N1)))
29
/ (std::sqrt(2.0)))
30
*
dx
*
dx
;
31
}
32
diffusion_Tensor1
(
const
Tensor1<T *, Dim>
&
A
,
const
int
Di,
const
int
Dj,
33
const
int
Dk,
const
double
Dx)
34
:
a
(
A
),
di
(Di),
dj
(Dj),
dk
(Dk),
dx
(Dx)
35
{}
36
};
37
38
template
<
class
T,
int
Dim,
char
i>
39
const
Tensor1_Expr<const diffusion_Tensor1<T, Dim, i>
,
40
typename
promote<T, double>::V
, Dim,
i
>
41
diffusion
(
const
Tensor1<T *, Dim>
&
a
,
const
Index<i, Dim>
index1,
42
const
int
&di,
const
int
&dj,
const
int
&dk,
const
double
&dx)
43
{
44
using
Tensor_Expr =
diffusion_Tensor1<T, Dim, i>
;
45
return
Tensor1_Expr<Tensor_Expr, typename promote<T, double>::V
, Dim,
i
>(
46
Tensor_Expr(
a
, di, dj, dk, dx));
47
}
48
}
FTensor
JSON compatible output.
Definition:
Christof_constructor.hpp:6
FTensor::Tensor1< T *, Dim >
FTensor::diffusion
promote< T, double >::V diffusion(const Tensor0< T * > &a, const int &di, const int &dj, const int &dk, const double &dx)
Definition:
diffusion_Tensor0.hpp:10
A
constexpr AssemblyType A
Definition:
operators_tests.cpp:30
FTensor::diffusion_Tensor1::operator()
promote< T, double >::V operator()(const int N1) const
Definition:
diffusion_Tensor1.hpp:15
FTensor::diffusion_Tensor1::dx
const double dx
Definition:
diffusion_Tensor1.hpp:12
FTensor::diffusion_Tensor1::di
const int di
Definition:
diffusion_Tensor1.hpp:11
FTensor::diffusion_Tensor1::diffusion_Tensor1
diffusion_Tensor1(const Tensor1< T *, Dim > &A, const int Di, const int Dj, const int Dk, const double Dx)
Definition:
diffusion_Tensor1.hpp:32
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
FTensor::diffusion_Tensor1::a
const Tensor1< T *, Dim > & a
Definition:
diffusion_Tensor1.hpp:10
FTensor::diffusion_Tensor1
Definition:
diffusion_Tensor1.hpp:8
FTensor::diffusion_Tensor1::dk
const int dk
Definition:
diffusion_Tensor1.hpp:11
FTensor::diffusion_Tensor1::dj
const int dj
Definition:
diffusion_Tensor1.hpp:11
i
FTensor::Index< 'i', SPACE_DIM > i
Definition:
hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition:
Index.hpp:23
Tensor1_Expr
Definition:
single.cpp:11
Generated by
Doxygen
1.8.17 and hosted at