v0.14.0
ddTensor2_symmetric.hpp
Go to the documentation of this file.
1 /* Takes a second derivative of a Tensor2_symmetric, yielding a
2  Ddg. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  template <class T, int Dim01, int Dim23, char i, char j, char k, char l>
10  {
14 
15  public:
16  typename promote<T, double>::V
17  operator()(const int N1, const int N2, const int N3, const int N4) const
18  {
19  return N3 == N4 ? (*(a.ptr(N1, N2) + d_ijk(N3)) - 2 * a(N1, N2)
20  + *(a.ptr(N1, N2) - d_ijk(N3)))
21  * d_xyz(N3) * d_xyz(N3)
22  : (*(a.ptr(N1, N2) + d_ijk(N3) + d_ijk(N4))
23  - *(a.ptr(N1, N2) - d_ijk(N3) + d_ijk(N4))
24  - *(a.ptr(N1, N2) + d_ijk(N3) - d_ijk(N4))
25  + *(a.ptr(N1, N2) - d_ijk(N3) - d_ijk(N4)))
26  * d_xyz(N3) * d_xyz(N4) * 0.25;
27  }
29  const Tensor1<int, Dim23> &D_ijk,
30  const Tensor1<double, Dim23> &D_xyz)
31  : a(A), d_ijk(D_ijk), d_xyz(D_xyz)
32  {}
33  };
34 
35  template <class T, int Dim01, int Dim23, char i, char j, char k, char l>
36  const Ddg_Expr<const ddTensor2_symmetric<T, Dim01, Dim23, i, j, k, l>,
37  typename promote<T, double>::V, Dim01, Dim23, i, j, k, l>
39  const Index<j, Dim01> index2, const Index<k, Dim23> index3,
40  const Index<l, Dim23> index4, const Tensor1<int, Dim23> &d_ijk,
41  const Tensor1<double, Dim23> &d_xyz)
42  {
45  i, j, k, l>(Tensor_Expr(a, d_ijk, d_xyz));
46  }
47 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor1< int, Dim23 >
FTensor::ddTensor2_symmetric::d_ijk
const Tensor1< int, Dim23 > & d_ijk
Definition: ddTensor2_symmetric.hpp:12
FTensor::ddTensor2_symmetric::a
const Tensor2_symmetric< T *, Dim01 > & a
Definition: ddTensor2_symmetric.hpp:11
FTensor::ddTensor2_symmetric::ddTensor2_symmetric
ddTensor2_symmetric(const Tensor2_symmetric< T *, Dim01 > &A, const Tensor1< int, Dim23 > &D_ijk, const Tensor1< double, Dim23 > &D_xyz)
Definition: ddTensor2_symmetric.hpp:28
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor2_symmetric< T *, Dim01 >
FTensor::Ddg_Expr
Definition: Ddg_Expr.hpp:28
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::ddTensor2_symmetric
Definition: ddTensor2_symmetric.hpp:9
FTensor::promote::V
T1 V
Definition: promote.hpp:17
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition: Index.hpp:23
FTensor::dd
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
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::ddTensor2_symmetric::operator()
promote< T, double >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Definition: ddTensor2_symmetric.hpp:17
FTensor::ddTensor2_symmetric::d_xyz
const Tensor1< double, Dim23 > & d_xyz
Definition: ddTensor2_symmetric.hpp:13
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21