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>>>;
40 template <
typename T>
inline static auto getVee(T &&w1, T &&w2, T &&w3) {
43 std::forward<T>(w1), std::forward<T>(w2), std::forward<T>(w3)
48 template <
typename T>
inline static auto getHat(T &&w1, T &&w2, T &&w3) {
50 getVee(std::forward<T>(w1), std::forward<T>(w2), std::forward<T>(w3));
54 template <
typename A>
inline static auto getVee(
A &&t_w_hat) {
58 template <
typename A>
inline static auto getHat(
A &&t_w_vee) {
62 template <
typename A,
typename B>
63 inline static auto exp(
A &&t_w_vee,
B &&theta) {
64 return expImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
67 template <
typename A,
typename B>
68 inline static auto Jl(
A &&t_w_vee,
B &&theta) {
69 return JlImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
72 template <
typename A,
typename B>
73 inline static auto Jr(
A &&t_w_vee,
B &&theta) {
74 return JrImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
77 template <
typename A,
typename B,
typename C>
78 inline static auto action(
A &&t_w_vee,
B &&theta, C &&t_A) {
79 return actionImpl(std::forward<A>(t_w_vee), std::forward<B>(theta),
80 std::forward<C>(t_A));
83 template <
typename A,
typename B>
85 return dActionJlImpl(std::forward<A>(t_w_vee), std::forward<B>(t_A));
88 template <
typename A,
typename B>
90 return dActionJrImpl(std::forward<A>(t_w_vee), std::forward<B>(t_A));
93 template <
typename A,
typename B>
94 inline static auto diffJl(
A &&t_w_vee,
B &&theta) {
95 return diffJlImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
98 template <
typename A,
typename B>
99 inline static auto diffJr(
A &&t_w_vee,
B &&theta) {
100 return diffJrImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
103 template <
typename A,
typename B>
105 return diffExpImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
108 template <
typename A,
typename B>
110 return diffDiffExpImpl(std::forward<A>(t_w_vee), std::forward<B>(theta));
114 template <
typename T1,
typename T2,
typename T3>
115 inline static auto materialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee) {
117 std::forward<T3>(t_delta_w_vee));
121 template <
typename T1,
typename T2,
typename T3>
123 T3 &&t_delta_w_vee) {
125 std::forward<T3>(t_delta_w_vee));
129 template <
typename T1,
typename T2,
typename T3>
130 inline static auto deltaR(T1 &&t_w_vee, T2 theta, T3 &&t_A_hat) {
131 return deltaRImpl(std::forward<T1>(t_w_vee), theta,
132 std::forward<T3>(t_A_hat));
137 inline static constexpr int dim = 3;
145 template <
typename T>
149 t_w_vee(
k) = (levi_civita(
i,
j,
k) * t_w_hat(
i,
j)) / 2;
153 template <
typename T>
157 t_w_hat(
i,
j) = levi_civita(
i,
j,
k) * t_w_vee(
k);
161 template <
typename T1,
typename T2,
typename T3>
163 const T2 alpha,
const T3 beta) {
166 auto t_hat =
getHat(t_w_vee);
168 beta * (t_hat(
i,
k) * t_hat(
k,
j));
172 template <
typename T1,
typename T2>
175 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
178 const auto s = sin(theta);
179 const auto s_half = sin(theta / 2);
180 const auto a = s / theta;
181 const auto b = 2 * (s_half / theta) * (s_half / theta);
185 template <
typename T1,
typename T2>
189 auto get_tensor = [&t_w_vee](
auto a,
auto diff_a,
auto b,
auto diff_b) {
197 auto t_hat =
getHat(t_w_vee);
198 t_diff_exp(
i,
j,
k) =
200 a * FTensor::levi_civita<int>(
i,
j,
k)
204 diff_a * t_hat(
i,
j) * t_w_vee(
k)
208 b * (t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
209 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j))
213 diff_b * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k);
218 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
219 return get_tensor(1., -1. / 3., 1. / 2., -1. / 12);
222 const auto ss = sin(theta);
223 const auto a = ss / theta;
225 const auto theta2 = theta * theta;
226 const auto cc = cos(theta);
227 const auto diff_a = (theta * cc - ss) / (theta2 * theta);
229 const auto ss_2 = sin(theta / 2.);
231 const auto b = 2. * ss_2 * ss_2 / theta2;
232 const auto diff_b = (-2 + 2 * cc + theta * ss) / (theta2 * theta2);
234 return get_tensor(
a, diff_a, b, diff_b);
237 template <
typename T1,
typename T2>
241 auto get_tensor = [&t_w_vee](
auto a,
auto diff_a,
auto diff_diff_a,
auto b,
242 auto diff_b,
auto diff_diff_b) {
254 auto t_hat =
getHat(t_w_vee);
255 t_diff_diff_exp(
i,
j,
k,
m) =
257 diff_a * FTensor::levi_civita<int>(
i,
j,
k) * t_w_vee(
m)
264 FTensor::levi_civita<int>(
i,
j,
m) * t_w_vee(
k)
270 diff_diff_a * t_hat(
i,
j) * t_w_vee(
k) * t_w_vee(
m)
274 b * (FTensor::levi_civita<int>(
i,
l,
m) *
275 FTensor::levi_civita<int>(
l,
j,
k) +
276 FTensor::levi_civita<int>(
i,
l,
k) *
277 FTensor::levi_civita<int>(
l,
j,
m))
281 diff_b * ((t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
282 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j)) *
294 FTensor::levi_civita<int>(
i,
l,
m) * t_hat(
l,
j) * t_w_vee(
k)
298 t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
m) * t_w_vee(
k)
304 diff_diff_b * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k) * t_w_vee(
m);
306 return t_diff_diff_exp;
309 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
310 return get_tensor(1., -1. / 3., 1. / 15, 1. / 2, -1. / 12, 1. / 90);
313 const auto ss = sin(theta);
314 const auto a = ss / theta;
316 const auto theta2 = theta * theta;
317 const auto cc = cos(theta);
318 const auto diff_a = (theta * cc - ss) / (theta2 * theta);
319 const auto diff_diff_a =
320 (3. * ss - 3. * theta * cc - theta2 * ss) / (theta2 * theta2 * theta);
322 const auto ss_2 = sin(theta / 2.);
323 const auto cc_2 = cos(theta / 2.);
324 const auto b = 2. * ss_2 * ss_2 / theta2;
325 const auto diff_b = (-2 + 2 * cc + theta * ss) / (theta2 * theta2);
326 const auto diff_diff_b = (theta2 * cc - 5. * theta * ss - 8. * cc + 8.) /
327 (theta2 * theta2 * theta2);
329 return get_tensor(
a, diff_a, diff_diff_a, b, diff_b, diff_diff_b);
332 template <
typename T1,
typename T2>
335 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
338 const auto s = sin(theta);
339 const auto s_half = sin(theta / 2);
340 const auto a = 2 * (s_half / theta) * (s_half / theta);
341 const auto b = ((theta - s) / theta) / theta / theta;
345 template <
typename T1,
typename T2>
348 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
351 const auto s = sin(theta);
352 const auto s_half = sin(theta / 2);
353 const auto a = 2 * (s_half / theta) * (s_half / theta);
354 const auto b = ((theta - s) / theta) / theta / theta;
359 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
362 const T3 diff_alpha,
const T4 beta,
const T5 diff_beta) {
371 auto t_hat =
getHat(t_w_vee);
375 alpha * FTensor::levi_civita<int>(
i,
j,
k)
379 diff_alpha * t_hat(
i,
j) * t_w_vee(
k)
383 beta * (t_hat(
i,
l) * FTensor::levi_civita<int>(
l,
j,
k) +
384 FTensor::levi_civita<int>(
i,
l,
k) * t_hat(
l,
j))
388 diff_beta * t_hat(
i,
l) * t_hat(
l,
j) * t_w_vee(
k);
393 template <
typename T1,
typename T2>
396 if (fabs(theta) < std::numeric_limits<T2>::epsilon()) {
405 const auto s = sin(theta);
406 const auto c = cos(theta);
408 const auto theta2 = theta * theta;
409 const auto theta4 = theta2 * theta2;
410 const auto theta5 = theta4 * theta;
413 const auto a = (1. -
c) / theta2;
414 const auto diff_a = (theta * s + 2. *
c - 2.) / theta4;
416 const auto b = (theta - s) / (theta2 * theta);
417 const auto diff_b = (3. * s - theta *
c - 2. * theta) / theta5;
422 template <
typename T1,
typename T2,
typename T3>
428 t_B(
i,
j) =
exp(t_w_vee, theta)(
i,
k) * t_A(
k,
j);
432 template <
typename T1,
typename T2,
typename T3>
438 auto t_Jr =
Jr(t_w_vee, theta);
439 t_a(
i) = t_Jr(
i,
j) * t_delta_w_vee(
j);
443 template <
typename T1,
typename T2,
typename T3>
452 template <
typename T1,
typename T2,
typename T3>
458 auto t_R =
exp(t_w_vee, theta);
459 t_delta_R(
i,
j) = t_R(
i,
k) * t_A_hat(
k,
j);
464 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 dActionJr(A &&t_w_vee, B &&t_A)
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 materialSpin(T1 &&t_w_vee, T2 theta, T3 &&t_delta_w_vee)
static auto dActionJl(A &&t_w_vee, B &&t_A)
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 materialSpinHat(T1 &&t_w_vee, T2 theta, T3 &&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)