|
| v0.14.0
|
Go to the documentation of this file.
57 template <
int N1,
int N2,
int Dim>
60 if constexpr (N1 > N2)
61 return N1 + (N2 * (2 * Dim - N2 - 1)) / 2;
63 return N2 + (N1 * (2 * Dim - N1 - 1)) / 2;
68 return N1 + (N2 * (2 * Dim - N2 - 1)) / 2;
70 return N2 + (N1 * (2 * Dim - N1 - 1)) / 2;
73 template <
int N1,
int N2,
int Dim>
76 static_assert(N1 != N2,
"Bad index");
77 if constexpr (N2 > N1)
78 return (Dim - 1) * N1 + N2 - 1;
80 return (Dim - 1) * N1 + N2;
85 return (Dim - 1) * N1 + N2 - 1;
87 return (Dim - 1) * N1 + N2;
103 template <
int a,
int b>
105 const int j,
const int k,
const int l,
109 e.fVal(
a) *
e.aF(
a, b);
112 template <
int a,
int b>
114 const int j,
const int k,
const int l,
116 if constexpr (
a == 1 || b == 1)
122 template <
int a,
int b>
124 const int j,
const int k,
const int l,
128 e.dfVal(
a) /
static_cast<C
>(2);
132 template <
typename E,
typename C,
typename G>
struct d2MImpl {
142 template <
int b,
int a>
143 inline C
term(
const int i,
const int j,
const int k,
const int l)
const {
144 if constexpr (
a != b) {
146 typename E::NumberNb());
151 template <
int nb,
int a>
153 const int k,
const int l)
const {
160 const int k,
const int l)
const {
161 return term<0, a>(
i,
j,
k,
l);
177 template <
int A,
int a,
int b,
int I,
int J,
int K,
int L>
183 template <
int a,
int b,
int i,
int j,
int k,
int l,
int m,
int n>
187 if constexpr (
i ==
j &&
k ==
l) {
199 }
else if constexpr (
i ==
j)
203 fd2M<a, a, b, i, k, m, n>() *
209 fd2M<b, a, b, i, k, m, n>() *
214 else if constexpr (
k ==
l)
218 fd2M<a, a, b, i, k, m, n>() *
220 fd2M<b, a, b, j, l, m, n>() *
225 fd2M<b, a, b, i, k, m, n>() *
244 template <
int NB,
int a,
int b,
int i,
int j,
int k,
int l,
int m,
int n>
250 if constexpr (NB == 1) {
253 }
else if constexpr (NB == 2) {
255 if constexpr (
a == 1 || b == 1) {
286 template <
int nb,
int a,
int i,
int j,
int k,
int l,
int m,
int n>
290 if constexpr (
a != nb - 1)
300 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
304 if constexpr (
a != 0)
311 template <
int nb,
int a,
int i,
int j,
int k,
int l,
int m,
int n>
315 if constexpr (
a != nb - 1)
327 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
331 if constexpr (
a != 0)
339 template <
int nb,
int a,
int i,
int j,
int k,
int l,
int m,
int n>
366 template <
int a,
int i,
int j>
inline C
term()
const {
370 template <
int nb,
int i,
int j>
373 return term<nb - 1,
i,
j>() +
377 template <
int i,
int j>
379 return term<0, i, j>();
394 template <
int a,
int i,
int j,
int k,
int l>
inline C
term()
const {
404 template <
int nb,
int i,
int j,
int k,
int l>
412 template <
int i,
int j,
int k,
int l>
415 return term<0, i, j, k, l>();
432 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
438 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
444 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
450 template <
int a,
int i,
int j,
int k,
int l,
int m,
int n>
455 (term1<a, i, j, k, l, m, n>() + term2<a, i, j, k, l, m, n>() +
456 term3<a, i, j, k, l, m, n>()) *
472 template <
int nb,
int i,
int j,
int k,
int l,
int m,
int n>
484 template <
int i,
int j,
int k,
int l,
int m,
int n>
488 return term<0, i, j, k, l, m, n>();
492 template <
typename E,
typename C,
typename T>
struct GetMatImpl {
506 template <
int i,
int j>
543 template <
int i,
int j,
int k,
int l>
554 template <
int j,
int k,
int l>
565 template <
int k,
int l>
595 template <
typename E,
typename C,
typename T1,
typename T2>
612 template <
int I,
int J,
int K,
int L,
int M,
int N>
615 if constexpr (
N !=
M)
616 return (
tS(
M - 1,
N - 1) +
tS(
N - 1,
M - 1)) *
637 template <
int I,
int J,
int K,
int L,
int M>
640 return (
tS(
M - 1, 0) +
tS(0,
M - 1)) *
653 template <
int I,
int J,
int K,
int L>
661 template <
int I,
int J,
int K,
int L>
668 if constexpr (
K !=
I ||
L !=
J)
669 tA(
K - 1,
L - 1,
I - 1,
J - 1) =
tA(
I - 1,
J - 1,
K - 1,
L - 1);
672 template <
int I,
int J,
int K>
678 template <
int I,
int J>
684 template <
int I,
int K>
694 template <
typename E,
typename C,
typename T1,
typename VT2,
int DimT2>
712 template <
int I,
int J,
int K,
int L,
int M,
int N>
716 if constexpr (
N !=
M)
738 template <
int I,
int J,
int K,
int L,
int M>
752 template <
int I,
int J,
int K,
int L>
760 template <
int I,
int J,
int K,
int L>
771 if constexpr (
K !=
I ||
L !=
J)
777 template <
int I,
int J,
int K>
783 template <
int I,
int J>
789 template <
int I,
int K>
819 for (
auto aa = 0; aa != Dim; ++aa) {
821 for (
auto ii = 0; ii != Dim; ++ii)
822 for (
auto jj = 0; jj <= ii; ++jj)
826 for (
auto aa = 0; aa != Dim; ++aa) {
827 for (
auto bb = 0; bb != Dim; ++bb) {
830 auto &MM =
aMM[aa][bb];
831 MM(
i,
j,
k,
l) = Ma(
i,
j) * Mb(
k,
l);
835 for (
auto aa = 0; aa != Dim; ++aa) {
836 for (
auto bb = 0; bb != Dim; ++bb) {
838 auto &MM =
aMM[aa][bb];
839 auto &
G =
aG[aa][bb];
845 for (
auto aa = 0; aa != Dim; ++aa) {
846 for (
auto bb = 0; bb != Dim; ++bb) {
848 auto &Gab =
aG[aa][bb];
849 auto &Gba =
aG[bb][aa];
876 for (
auto aa = 0; aa != Dim; ++aa)
902 for (
auto aa = 0; aa != Dim; ++aa)
905 for (
auto aa = 0; aa != Dim; ++aa)
908 for (
auto aa = 0; aa != Dim; ++aa)
909 for (
auto bb = 0; bb != aa; ++bb) {
911 aF(bb, aa) = -
aF(aa, bb);
912 aF2(aa, bb) =
aF(aa, bb) *
aF(aa, bb);
939 template <
typename T>
942 for (
auto aa = 0; aa != Dim; ++aa)
945 for (
auto aa = 0; aa != Dim; ++aa)
948 for (
auto aa = 0; aa != Dim; ++aa)
951 for (
auto aa = 0; aa != Dim; ++aa)
952 for (
auto bb = 0; bb != aa; ++bb) {
954 aF(bb, aa) = -
aF(aa, bb);
955 aF2(aa, bb) =
aF(aa, bb) *
aF(aa, bb);
963 for (
auto aa = 0; aa != Dim; ++aa) {
964 for (
auto bb = 0; bb != Dim; ++bb) {
967 const auto &
M =
aM[aa];
969 for (
auto mm = 0; mm != Dim; ++mm) {
970 for (
auto nn = mm; nn != Dim; ++nn) {
972 S(
i,
j,
k,
l) *
M(mm, nn);
979 for (
auto aa = 0; aa != Dim; ++aa) {
980 for (
auto mm = 0; mm != Dim; ++mm) {
981 for (
auto nn = mm; nn != Dim; ++nn) {
987 if constexpr (NB == 3)
988 for (
auto aa = 0; aa != Dim; ++aa) {
989 for (
auto bb = 0; bb != Dim; ++bb) {
992 for (
auto mm = 0; mm != Dim; ++mm) {
993 for (
auto nn = mm; nn != Dim; ++nn) {
1003 if constexpr (NB == 2)
1004 for (
auto aa = 0; aa != Dim; ++aa) {
1005 for (
auto bb = 0; bb != Dim; ++bb) {
1008 if (aa == 1 || bb == 1)
1012 for (
auto mm = 0; mm != Dim; ++mm) {
1013 for (
auto nn = mm; nn != Dim; ++nn) {
1023 if constexpr (NB == 1)
1024 for (
auto aa = 0; aa != Dim; ++aa) {
1025 for (
auto bb = 0; bb != Dim; ++bb) {
1028 for (
auto mm = 0; mm != Dim; ++mm) {
1029 for (
auto nn = mm; nn != Dim; ++nn) {
1039 for (
auto aa = 0; aa != Dim; ++aa) {
1040 for (
auto mm = 0; mm != Dim; ++mm) {
1041 for (
auto nn = 0; nn != Dim; ++nn) {
1048 if constexpr (NB == 3)
1049 for (
auto aa = 0; aa != Dim; ++aa) {
1050 for (
auto bb = 0; bb != Dim; ++bb) {
1053 const auto v0 =
aF(aa, bb);
1054 for (
auto cc = 0; cc != Dim; ++cc) {
1055 for (
auto dd = 0;
dd != Dim; ++
dd) {
1057 const double v1 =
fVal(cc) *
aF(cc,
dd);
1059 (v1 * v0) * S(
i,
j,
k,
l);
1067 if constexpr (NB == 2)
1068 for (
auto aa = 0; aa != Dim; ++aa) {
1069 for (
auto bb = 0; bb != Dim; ++bb) {
1071 for (
auto cc = 0; cc != Dim; ++cc) {
1072 for (
auto dd = 0;
dd != Dim; ++
dd)
1077 if ((cc == 1 ||
dd == 1) && (aa == 1 || bb == 1))
1079 else if (cc != 1 &&
dd != 1 && aa != 1 && bb != 1) {
1081 if ((aa != bb && bb !=
dd) && (aa !=
dd && bb != cc))
1086 }
else if ((cc != 1 &&
dd != 1) && (aa == 1 || bb == 1))
1088 else if ((cc == 1 ||
dd == 1) && (aa != 1 && bb != 1)) {
1090 if ((cc == 2 &&
dd == 1) || (cc == 2 &&
dd == 1))
1114 if constexpr (NB == 1)
1115 for (
auto aa = 0; aa != Dim; ++aa) {
1116 for (
auto bb = 0; bb != Dim; ++bb) {
1118 for (
auto cc = 0; cc != Dim; ++cc) {
1119 for (
auto dd = 0;
dd != Dim; ++
dd) {
1121 if ((bb !=
dd) && (aa !=
dd && bb != cc)) {
1122 const double r =
ddfVal(cc) / 4;
1159 template <
typename E,
typename C,
typename G>
friend struct d2MImpl;
1165 template <
typename E,
typename C,
typename T3,
typename T4>
GetDiffMatImpl(E &e, T &t_a)
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< 1 > &, const Number< 1 > &)
FTensor::Tensor1< V, Dim > ddfVal
void set(const Number< 1 > &, const Number< 1 > &, const Number< 1 > &, const Number< l > &)
auto getMat(Fun f)
Get matrix.
C eval(const Number< 1 > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &) const
C eval_fdS2(const Number< 1 > &, const Number< a > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
C eval(const Number< 1 > &, const Number< i > &, const Number< j > &) const
C eval(const Number< nb > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
C eval_SM(const Number< nb > &, const Number< a > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
typename E::NumberNb NumberNb
SecondMatrixDirectiveImpl< E, C > r
typename E::NumberDim NumberDim
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< M > &, const Number< N > &)
C eval(const Number< 1 > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
C eval(const Number< nb > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &) const
void set(const Number< 1 > &, const Number< 1 > &, const Number< k > &, const Number< l > &)
ReconstructMatImpl< E, C > r
auto get_sym_index(const Number< N1 > &, const Number< N2 > &, const Number< Dim > &)
FirstMatrixDirectiveImpl< E, C > r
typename E::NumberNb NumberNb
FTensor::Index< 'J', DIM1 > J
void set(const Number< 0 > &, const Number< 0 > &, const Number< 0 > &, const Number< 0 > &)
void set(const Number< i > &, const Number< 1 > &)
typename E::NumberNb NumberNb
void set(const Number< I > &, const Number< J > &, const Number< K > &, const Number< 0 > &)
void set(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &)
auto term_fd2S(const Number< a > &, const Number< b > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
C eval_SM(const Number< 1 > &, const Number< a > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
FTensor::Tensor2_symmetric< V, Dim > aM[Dim]
typename E::NumberDim NumberDim
void set(const Number< 0 > &, const Number< 0 > &, const Number< 0 > &, const Number< 0 > &)
constexpr IntegrationType I
boost::function< double(const double)> Fun
C eval(const Number< 1 > &, const Number< a > &, const int i, const int j, const int k, const int l) const
GetDiffDiffMatImpl(E &e, T1 &t_a, T2 &t_S)
FTensor::Ddg< V, Dim, Dim > aSM[(Dim - 1) *Dim][(Dim *(Dim+1))/2]
typename E::NumberDim NumberDim
FTensor::Index< 'M', 3 > M
C eval(const Number< nb > &, const Number< i > &, const Number< j > &) const
auto get(const Number< a > &, const Number< b > &, const int i, const int j, const int k, const int l, const Number< 2 > &) const
FTensor::Ddg< V, Dim, Dim > aMM[Dim][Dim]
void set(const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &)
auto getDiffMat(Fun f, Fun d_f)
Get derivative of matrix.
SecondMatrixDirectiveImpl(E &e)
SecondMatrixDirectiveImpl< E, C > r
auto get(const Number< a > &, const Number< b > &, const int i, const int j, const int k, const int l, const Number< 3 > &) const
void set(const Number< I > &, const Number< J > &, const Number< K > &, const Number< 0 > &)
const FTensor::Tensor1< T, Dim > Val
FirstMatrixDirectiveImpl(E &e)
void set(const Number< 1 > &, const Number< 1 > &, const Number< 1 > &, const Number< 1 > &)
C eval(const Number< nb > &, const Number< a > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
FTensor::Tensor2_symmetric< VT2, DimT2 > & tS
void set(const Number< I > &, const Number< J > &, const Number< 0 > &, const Number< 0 > &)
FTensor::Index< 'i', SPACE_DIM > i
auto getDiffDiffMat(Fun f, Fun d_f, Fun dd_f, T &t_S)
Get second directive of matrix.
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< 1 > &, const Number< 1 > &)
C eval(const Number< nb > &, const Number< a > &, const int i, const int j, const int k, const int l) const
FTensor::Tensor2< V, Dim, Dim > aF
FTensor::Ddg< V, Dim, Dim > d2MType1[Dim][(Dim *(Dim+1))/2]
typename E::NumberNb NumberNb
FTensor::Ddg< V, Dim, Dim > d2MType0[Dim][(Dim *(Dim+1))/2]
C term(const int i, const int j, const int k, const int l) const
EigenMatrixImp(Val &t_val, Vec &t_vec)
void set(const Number< I > &, const Number< J > &, const Number< 0 > &, const Number< 0 > &)
const double v
phase velocity of light in medium (cm/ns)
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< M > &, const Number< 1 > &)
typename E::NumberNb NumberNb
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)
C eval_fdS2(const Number< nb > &, const Number< a > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
auto get_nodiag_index(const Number< N1 > &, const Number< N2 > &, const Number< Dim > &)
FTensor::Ddg< V, Dim, Dim > aS[(Dim *(Dim+1))/2]
typename E::NumberDim NumberDim
void set(const Number< 1 > &, const Number< 1 > &)
void set(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &)
void set(const Number< i > &, const Number< j > &)
d2MImpl< E, C, d2MCoefficients< E, C > > r
FTensor::Index< 'j', 3 > j
FTensor::Tensor2_symmetric< V, Dim > aF2
auto get(const Number< a > &, const Number< b > &, const int i, const int j, const int k, const int l, const Number< 1 >) const
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< M > &, const Number< N > &)
constexpr IntegrationType G
void set(const Number< 1 > &, const Number< j > &, const Number< k > &, const Number< l > &)
const FTensor::Tensor2< T, Dim, Dim > Vec
auto add(const Number< I > &, const Number< J > &, const Number< K > &, const Number< L > &, const Number< M > &, const Number< 1 > &)
FTensor::Tensor1< V, Dim > fVal
FTensor::Tensor1< V, Dim > dfVal
boost::function< T(const T)> Fun
C term_SM(const Number< a > &, const Number< b > &, const Number< NB > &, const Number< i > &, const Number< j > &, const Number< k > &, const Number< l > &, const Number< m > &, const Number< n > &) const
typename FTensor::Index< c, Dim > I
FTensor::Index< 'm', 3 > m
FTensor::Ddg< V, Dim, Dim > aG[Dim][Dim]
typename E::NumberDim NumberDim
void set(const Number< I > &, const Number< 0 > &, const Number< K > &, const Number< 0 > &)
typename E::NumberNb NumberNb
FTensor::Index< 'k', 3 > k
void set(const Number< I > &, const Number< 0 > &, const Number< K > &, const Number< 0 > &)
typename E::NumberDim NumberDim
typename E::NumberDim NumberDim
GetDiffDiffMatImpl(E &e, T1 &t_a, FTensor::Tensor2_symmetric< VT2, DimT2 > &t_S)
FTensor::Index< 'l', 3 > l