v0.14.0
Loading...
Searching...
No Matches
ddTensor1.hpp
Go to the documentation of this file.
1/* Takes a second derivative of a Tensor1, yielding a Dg, but
2 with it's indices switched around so that it has the symmetries of
3 a Christof. */
4
5#pragma once
6
7namespace FTensor
8{
9 template <class T, int Dim0, int Dim12, char i, char j, char k>
11 {
15
16 public:
17 /* Note the indices switch here. */
18
20 operator()(const int N2, const int N3, const int N1) const
21 {
22 return N2 == N3 ? (*(a.ptr(N1) + d_ijk(N2)) - 2 * a(N1)
23 + *(a.ptr(N1) - d_ijk(N2)))
24 * d_xyz(N2) * d_xyz(N2)
25 : (*(a.ptr(N1) + d_ijk(N2) + d_ijk(N3))
26 - *(a.ptr(N1) - d_ijk(N2) + d_ijk(N3))
27 - *(a.ptr(N1) + d_ijk(N2) - d_ijk(N3))
28 + *(a.ptr(N1) - d_ijk(N2) - d_ijk(N3)))
29 * d_xyz(N2) * d_xyz(N3) * 0.25;
30 }
32 const Tensor1<double, Dim12> &D_xyz)
33 : a(A), d_ijk(D_ijk), d_xyz(D_xyz)
34 {}
35 };
36
37 /* Note that the indices are mixed up here to convert between being
38 symmetric on the last two indices to the first two indices. */
39
40 template <class T, int Dim0, int Dim12, char i, char j, char k>
41 const Dg_Expr<const ddTensor1<T, Dim0, Dim12, i, j, k>,
42 typename promote<T, double>::V, Dim0, Dim12, i, j, k>
43 dd(const Tensor1<T *, Dim0> &a, const Index<k, Dim0> index0,
44 const Index<i, Dim12> index1, const Index<j, Dim12> index2,
45 const Tensor1<int, Dim12> &d_ijk, const Tensor1<double, Dim12> &d_xyz)
46 {
47 using TensorExpr = ddTensor1<T, Dim0, Dim12, i, j, k>;
49 j, k>(TensorExpr(a, d_ijk, d_xyz));
50 }
51}
constexpr double a
const Tensor1< T *, Dim0 > & a
Definition ddTensor1.hpp:12
const Tensor1< double, Dim12 > & d_xyz
Definition ddTensor1.hpp:14
promote< T, double >::V operator()(const int N2, const int N3, const int N1) const
Definition ddTensor1.hpp:20
ddTensor1(const Tensor1< T *, Dim0 > &A, const Tensor1< int, Dim12 > &D_ijk, const Tensor1< double, Dim12 > &D_xyz)
Definition ddTensor1.hpp:31
const Tensor1< int, Dim12 > & d_ijk
Definition ddTensor1.hpp:13
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
Tensors class implemented by Walter Landry.
Definition FTensor.hpp:51
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition ddTensor0.hpp:33