17 std::remove_cv_t<std::remove_reference_t<std::remove_pointer_t<T>>>;
20template <
class T,
int I>
23 std::remove_cv_t<std::remove_reference_t<std::remove_pointer_t<T>>>;
26template <
class T,
int G>
29 std::remove_cv_t<std::remove_reference_t<std::remove_pointer_t<T>>>;
46 template <
typename T>
inline static auto getVee(T &&w1, T &&w2, T &&w3) {
49 std::forward<T>(w1), std::forward<T>(w2), std::forward<T>(w3)
54 template <
typename T>
inline static auto getHat(T &&w1, T &&w2, T &&w3) {
56 getVee(std::forward<T>(w1), std::forward<T>(w2), std::forward<T>(w3));
60 template <
typename A>
inline static auto getVee(
A &&t_w_hat) {
64 template <
typename A>
inline static auto getHat(
A &&t_w_vee) {
68 template <
typename A,
typename B>
69 inline static auto exp(
A &&t_w_vee,
B &&theta) {
70 return expImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
73 template <
typename A,
typename B>
74 inline static auto Jl(
A &&t_w_vee,
B &&theta) {
75 return JlImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
78 template <
typename A,
typename B>
79 inline static auto Jr(
A &&t_w_vee,
B &&theta) {
80 return JrImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
83 template <
typename A,
typename B,
typename C>
84 inline static auto action(
A &&t_w_vee,
B &&theta, C &&t_A) {
85 return actionImpl(std::forward<A>(t_w_vee), std::forward<B>(theta),
86 std::forward<C>(t_A));
89 template <
typename A,
typename B>
90 inline static auto diffJl(
A &&t_w_vee,
B &&theta) {
91 return diffJlImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
94 template <
typename A,
typename B>
95 inline static auto diffJr(
A &&t_w_vee,
B &&theta) {
96 return diffJrImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
99 template <
typename A,
typename B>
101 return diffExpImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
104 template <
typename A,
typename B>
106 return diffDiffExpImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
110 template <
typename T1,
typename T2,
typename T3>
111 inline static auto spatialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee) {
113 std::forward<T3>(t_delta_w_vee));
117 template <
typename T1,
typename T2,
typename T3>
119 T3 &&t_delta_w_vee) {
121 std::forward<T3>(t_delta_w_vee));
125 template <
typename T1,
typename T2,
typename T3>
126 inline static auto materialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee) {
128 std::forward<T3>(t_delta_w_vee));
132 template <
typename T1,
typename T2,
typename T3>
134 T3 &&t_delta_w_vee) {
136 std::forward<T3>(t_delta_w_vee));
140 template <
typename T1,
typename T2,
typename T3>
141 inline static auto deltaR(T1 &&t_w_vee, T2 theta, T3 &&t_A_hat) {
142 return deltaRImpl(std::forward<T1>(t_w_vee), theta,
143 std::forward<T3>(t_A_hat));
148 inline static constexpr int dim = 3;
156 template <
typename T>
160 t_w_vee(
k) = (levi_civita(
i,
j,
k) * t_w_hat(
i,
j)) / 2;
164 template <
typename T>
168 t_w_hat(
i,
j) = levi_civita(
i,
j,
k) * t_w_vee(
k);
172 template <
typename T1,
typename T2,
typename T3>
174 const T2 alpha,
const T3 beta) {
177 auto t_hat =
getHat(t_w_vee);
179 beta * (t_hat(
i,
k) * t_hat(
k,
j));
183 template <
typename T1,
typename T2>
186 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
189 const auto s = sin(theta);
190 const auto s_half = sin(theta / 2);
191 const auto a = s / theta;
192 const auto b = 2 * (s_half / theta) * (s_half / theta);
196 template <
typename T1,
typename T2>
200 auto get_tensor = [&t_w_vee](
auto a,
auto diff_a,
auto b,
auto diff_b) {
208 auto t_hat =
getHat(t_w_vee);
209 t_diff_exp(
i,
j,
k) =
211 a * FTensor::levi_civita<int>(
i,
j,
k)
215 diff_a * t_hat(
i,
j) * t_w_vee(
k)
219 b * (t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
220 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j))
224 diff_b * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k);
229 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
230 return get_tensor(1., -1. / 3., 1. / 2., -1. / 12);
233 const auto ss = sin(theta);
234 const auto a = ss / theta;
236 const auto theta2 = theta * theta;
237 const auto cc = cos(theta);
238 const auto diff_a = (theta * cc - ss) / (theta2 * theta);
240 const auto ss_2 = sin(theta / 2.);
242 const auto b = 2. * ss_2 * ss_2 / theta2;
243 const auto diff_b = (-2 + 2 * cc + theta * ss) / (theta2 * theta2);
245 return get_tensor(
a, diff_a, b, diff_b);
248 template <
typename T1,
typename T2>
252 auto get_tensor = [&t_w_vee](
auto a,
auto diff_a,
auto diff_diff_a,
auto b,
253 auto diff_b,
auto diff_diff_b) {
265 auto t_hat =
getHat(t_w_vee);
266 t_diff_diff_exp(
i,
j,
k,
m) =
268 diff_a * FTensor::levi_civita<int>(
i,
j,
k) * t_w_vee(
m)
275 FTensor::levi_civita<int>(
i,
j,
m) * t_w_vee(
k)
281 diff_diff_a * t_hat(
i,
j) * t_w_vee(
k) * t_w_vee(
m)
285 b * (FTensor::levi_civita<int>(
i,
l,
m) *
286 FTensor::levi_civita<int>(
l,
j,
k) +
287 FTensor::levi_civita<int>(
i,
l,
k) *
288 FTensor::levi_civita<int>(
l,
j,
m))
292 diff_b * ((t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
293 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j)) *
305 FTensor::levi_civita<int>(
i,
l,
m) * t_hat(
l,
j) * t_w_vee(
k)
309 t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
m) * t_w_vee(
k)
315 diff_diff_b * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k) * t_w_vee(
m);
317 return t_diff_diff_exp;
320 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
321 return get_tensor(1., -1. / 3., 1. / 15, 1. / 2, -1. / 12, 1. / 90);
324 const auto ss = sin(theta);
325 const auto a = ss / theta;
327 const auto theta2 = theta * theta;
328 const auto cc = cos(theta);
329 const auto diff_a = (theta * cc - ss) / (theta2 * theta);
330 const auto diff_diff_a =
331 (3. * ss - 3. * theta * cc - theta2 * ss) / (theta2 * theta2 * theta);
333 const auto ss_2 = sin(theta / 2.);
334 const auto b = 2. * ss_2 * ss_2 / theta2;
335 const auto diff_b = (-2 + 2 * cc + theta * ss) / (theta2 * theta2);
336 const auto diff_diff_b = (theta2 * cc - 5. * theta * ss - 8. * cc + 8.) /
337 (theta2 * theta2 * theta2);
339 return get_tensor(
a, diff_a, diff_diff_a, b, diff_b, diff_diff_b);
342 template <
typename T1,
typename T2>
345 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
348 const auto s = sin(theta);
349 const auto s_half = sin(theta / 2);
350 const auto a = 2 * (s_half / theta) * (s_half / theta);
351 const auto b = ((theta - s) / theta) / theta / theta;
355 template <
typename T1,
typename T2>
358 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
361 const auto s = sin(theta);
362 const auto s_half = sin(theta / 2);
363 const auto a = 2 * (s_half / theta) * (s_half / theta);
364 const auto b = ((theta - s) / theta) / theta / theta;
369 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
372 const T3 diff_alpha,
const T4 beta,
const T5 diff_beta) {
381 auto t_hat =
getHat(t_w_vee);
385 alpha * FTensor::levi_civita<int>(
i,
j,
k)
389 diff_alpha * t_hat(
i,
j) * t_w_vee(
k)
393 beta * (t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
394 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j))
398 diff_beta * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k);
403 template <
typename T1,
typename T2>
406 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
415 const auto s = sin(theta);
416 const auto c = cos(theta);
418 const auto theta2 = theta * theta;
419 const auto theta4 = theta2 * theta2;
420 const auto theta5 = theta4 * theta;
423 const auto a = (1. -
c) / theta2;
424 const auto diff_a = (theta * s + 2. *
c - 2.) / theta4;
426 const auto b = (theta - s) / (theta2 * theta);
427 const auto diff_b = (3. * s - theta *
c - 2. * theta) / theta5;
432 template <
typename T1,
typename T2>
435 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
444 const auto s = sin(theta);
445 const auto c = cos(theta);
447 const auto theta2 = theta * theta;
448 const auto theta4 = theta2 * theta2;
449 const auto theta5 = theta4 * theta;
453 const auto alpha = -(1. -
c) / theta2;
454 const auto diff_alpha = (2. - 2. *
c - theta * s) / theta4;
458 const auto beta = (theta - s) / (theta2 * theta);
459 const auto diff_beta = (3. * s - theta *
c - 2. * theta) / theta5;
464 template <
typename T1,
typename T2,
typename T3>
470 t_B(
i,
j) =
exp(t_w_vee, theta)(
i,
k) * t_A(
k,
j);
474 template <
typename T1,
typename T2,
typename T3>
480 auto t_Jl =
Jl(t_w_vee, theta);
481 t_w(
i) = t_Jl(
i,
j) * t_delta_w_vee(
j);
485 template <
typename T1,
typename T2,
typename T3>
493 template <
typename T1,
typename T2,
typename T3>
499 auto t_Jr =
Jr(t_w_vee, theta);
500 t_a(
i) = t_Jr(
i,
j) * t_delta_w_vee(
j);
504 template <
typename T1,
typename T2,
typename T3>
513 template <
typename T1,
typename T2,
typename T3>
519 auto t_R =
exp(t_w_vee, theta);
520 t_delta_R(
i,
j) = t_R(
i,
k) * t_A_hat(
k,
j);
525 template <
typename T1,
typename T2,
typename T3>
#define FTENSOR_INDEX(DIM, I)
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double n
refractive index of diffusive medium
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
Tensors class implemented by Walter Landry.
FTensor::Index< 'm', 3 > m
static auto diffDiffExp(A &&t_w_vee, B &&theta)
static auto spatialSpinHatImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor1< T3, dim > &t_delta_w_vee)
static auto Jr(A &&t_w_vee, B &&theta)
static auto diffJlImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)
static auto genericFormImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 alpha, const T3 beta)
static auto genericDiffFormImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 alpha, const T3 diff_alpha, const T4 beta, const T5 diff_beta)
static auto deltaR(T1 &&t_w_vee, T2 theta, T3 &&t_A_hat)
static auto Jl(A &&t_w_vee, B &&theta)
static auto action(A &&t_w_vee, B &&theta, C &&t_A)
static auto actionImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor2_symmetric< T3, dim > &t_A)
static FTENSOR_INDEX(dim, l)
static FTENSOR_INDEX(dim, k)
static auto getVee(A &&t_w_hat)
static auto getHatImpl(const FTensor::Tensor1< T, dim > &t_w_vee)
static auto JlImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 &theta)
static auto getHat(T &&w1, T &&w2, T &&w3)
static auto deltaRImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor1< T3, dim > &t_delta_w_vee)
static auto deltaRImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor2< T3, dim, dim > &t_A_hat)
static auto JrImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)
static auto diffJr(A &&t_w_vee, B &&theta)
static FTENSOR_INDEX(dim, j)
static auto expImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)
static auto diffJl(A &&t_w_vee, B &&theta)
static auto getVeeImpl(const FTensor::Tensor2< T, dim, dim > &t_w_hat)
static auto diffExp(A &&t_w_vee, B &&theta)
static auto spatialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee)
static auto materialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee)
static auto spatialSpinHat(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee)
static auto materialSpinHatImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor1< T3, dim > &t_delta_w_vee)
static auto diffExpImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)
static auto diffJrImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)
static auto materialSpinHat(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee)
static auto spatialSpinImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor1< T3, dim > &t_delta_w_vee)
static auto getHat(A &&t_w_vee)
static FTENSOR_INDEX(dim, n)
static FTENSOR_INDEX(dim, m)
static FTENSOR_INDEX(dim, i)
static auto materialSpinImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta, const FTensor::Tensor1< T3, dim > &t_delta_w_vee)
static auto getVee(T &&w1, T &&w2, T &&w3)
static auto exp(A &&t_w_vee, B &&theta)
static auto diffDiffExpImpl(const FTensor::Tensor1< T1, dim > &t_w_vee, const T2 theta)