79#ifndef ESHELBIAN_LOGARITHMIC_DIRECTIONAL_DERIVATIVES_HPP
80#define ESHELBIAN_LOGARITHMIC_DIRECTIONAL_DERIVATIVES_HPP
94namespace LogarithmicDirectionalDerivatives {
132 auto t_r = result.
begin();
138 block(
i,
j) =
a[mask](
i,
k) * b[0](
k,
j);
139 for (
int s = (mask - 1) & mask; mask != 0; s = (s - 1) & mask) {
140 block(
i,
j) +=
a[s](
i,
k) * b[mask ^ s](
k,
j);
144 t_r(
i,
j) = block(
i,
j);
158 result(
i,
j) = epsilon(
i,
j,
k) *
v(
k);
167 result(
k) = 0.5 * (epsilon(
i,
j,
k) * block(
i,
j));
174 std::array<double, factorialTableSize> table{};
191template <std::
size_t K>
194 for (
auto p : points)
197 constexpr int terms = 12;
198 std::array<double, terms>
h{};
200 for (
auto p : points) {
201 const double d = p - mean;
202 for (
int n = 1;
n != terms; ++
n)
203 h[
n] += d *
h[
n - 1];
206 for (
int n = terms - 1;
n >= 0; --
n)
208 return std::exp(mean) * sum;
232 "Cannot diagonalise symmetric exponential argument");
268 result(
i,
j) = (block(
i,
j) || block(
j,
i)) / 2.;
279 result.
data.fill(0.);
281 std::array<Tensor, N> e;
282 std::array<bool, N>
active{};
283 for (
int d = 0; d !=
N; ++d) {
284 const auto block =
symmetric(argument[1 << d]);
291 for (
int d1 = 0; d1 !=
N; ++d1)
292 for (
int d2 = d1 + 1; d2 !=
N; ++d2)
294 result[(1 << d1) | (1 << d2)](
i,
j) =
296 if constexpr (
N == 3)
330 result(
i,
j) = (full(
i,
j) || full(
j,
i)) / 2.;
336 for (
int a = 0;
a != 3; ++
a)
337 for (
int b = 0; b != 3; ++b)
344 for (
int a = 0;
a != 3; ++
a)
345 for (
int b = 0; b != 3; ++b) {
347 for (
int c = 0;
c != 3; ++
c)
356 for (
int a = 0;
a != 3; ++
a)
357 for (
int b = 0; b != 3; ++b) {
359 for (
int c = 0;
c != 3; ++
c)
360 for (
int d = 0; d != 3; ++d)
362 (x(
a,
c) * y(
c, d) * z(d, b) + x(
a,
c) * z(
c, d) * y(d, b) +
363 y(
a,
c) * x(
c, d) * z(d, b) + y(
a,
c) * z(
c, d) * x(d, b) +
364 z(
a,
c) * x(
c, d) * y(d, b) + z(
a,
c) * y(
c, d) * x(d, b));
378 THROW_MESSAGE(
"Eigenvalues are expected in ascending order");
380 const auto l = [&](
int a) {
return values(
a); };
381 const auto close = [](
double spread) {
384 const double e[3] = {std::exp(
l(0)), std::exp(
l(1)), std::exp(
l(2))};
385 for (
int a = 0;
a != 3; ++
a)
386 for (
int b =
a; b != 3; ++b)
389 std::array<double, 2>{
l(
a),
l(b)})
390 : (e[b] - e[
a]) / (
l(b) -
l(
a));
391 for (
int a = 0;
a != 3; ++
a)
392 for (
int b =
a; b != 3; ++b)
393 for (
int c = b;
c != 3; ++
c)
397 std::array<double, 3>{
l(
a),
l(b),
l(
c)})
399 for (
int a = 0;
a != 3; ++
a)
400 for (
int b = 0; b != 3; ++b)
401 for (
int c = 0;
c != 3; ++
c) {
402 std::array<int, 3> s{
a, b,
c};
403 std::sort(s.begin(), s.end());
406 for (
int a = 0;
a != 3; ++
a)
407 for (
int b =
a; b != 3; ++b)
408 for (
int c = b;
c != 3; ++
c)
409 for (
int d =
c; d != 3; ++d)
413 std::array<double, 4>{
l(
a),
l(b),
l(
c),
l(d)})
415 for (
int a = 0;
a != 3; ++
a)
416 for (
int b = 0; b != 3; ++b)
417 for (
int c = 0;
c != 3; ++
c)
418 for (
int d = 0; d != 3; ++d) {
419 std::array<int, 4> s{
a, b,
c, d};
420 std::sort(s.begin(), s.end());
466 r(
i,
j) = dddR(
i,
j,
k,
l) *
a(
k) * b(
l);
476 result.
data.fill(0.);
477 result[0](
i,
j) =
R(
i,
j);
478 std::array<Vector, N>
v;
479 std::array<bool, N>
active{};
480 for (
int d = 0; d !=
N; ++d) {
481 v[d] =
axial(argument[1 << d]);
486 for (
int d1 = 0; d1 !=
N; ++d1)
487 for (
int d2 = d1 + 1; d2 !=
N; ++d2)
489 result[(1 << d1) | (1 << d2)](
i,
j) =
second(
v[d1],
v[d2])(
i,
j);
490 if constexpr (
N == 3)
538 if (!row_mode && !col_mode)
571 constexpr auto t_diff_deviator = FTensor::diff_deviator<int, 3>();
572 const auto deviator = [&](
const Symmetric &
t) {
574 result(
i,
j) = 2. * (t_diff_deviator(
i,
j,
k,
l) *
t(
k,
l));
577 const auto a = deviator(
h), dp = deviator(p), ds = deviator(s);
Lie algebra implementation.
#define FTENSOR_INDEXES(DIM,...)
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
FTensor::Index< 'i', SPACE_DIM > i
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (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
boost::function< T(const T)> Fun
auto getMat(A &&t_val, B &&t_vec, Fun< double > f)
Get the Mat object.
double expDividedDifferenceSeries(const std::array< double, K > &points)
constexpr std::array< double, factorialTableSize > inverseFactorials()
constexpr double closeSpread
constexpr auto inverseFactorial
constexpr int factorialTableSize
DeviatorCurvature deviatorCurvature(double c10, const Symmetric &h, const Symmetric &p, const Symmetric &s)
FTensor::Tensor2< FTensor::CursorPtr< double *, 9 >, 3, 3 > View
void product(const Matrix< N > &a, const Matrix< N > &b, Matrix< N > &result)
MoFEMErrorCode computeEigenValuesSymmetric(const MatrixDouble &mat, VectorDouble &eig, MatrixDouble &eigen_vec)
compute eigenvalues of a symmetric matrix using lapack dsyev
constexpr double t
plate stiffness
FTensor::Index< 'm', 3 > m
std::array< double, size > data
static constexpr int size
View operator[](int mask) const
static constexpr int count
static constexpr int blockSize
FTensor::Tensor3< double, 3, 3, 3 > dR
Tensor first(const Vector &a) const
RotationExponential(const Vector &w)
Tensor third(const Vector &a, const Vector &b, const Vector &c) const
FTensor::Tensor4< double, 3, 3, 3, 3 > ddR
Tensor second(const Vector &a, const Vector &b) const
void fill(const Matrix< N > &argument, Matrix< N > &result) const
Tensor first(const Vector &da, const Vector &dq) const
RotationExponential higher
auto firstTensor(const int mode) const
auto secondTensor(const int row_mode, const int col_mode) const
RotationExponential constant
SplitRotation(const Vector &a, const Vector &q)
void fill(const Matrix< N > &a, const Matrix< N > &q, Matrix< N > &result) const
Symmetric second(const Symmetric &e1, const Symmetric &e2) const
FTensor::Tensor1< double, 3 > values
double fourth_[3][3][3][3]
Tensor firstInBasis(const Tensor &x) const
Tensor secondInBasis(const Tensor &x, const Tensor &y) const
static const EigenMatrix::Fun< double > & expFun()
void fill(const Matrix< N > &argument, Matrix< N > &result) const
Tensor thirdInBasis(const Tensor &x, const Tensor &y, const Tensor &z) const
Symmetric third(const Symmetric &e1, const Symmetric &e2, const Symmetric &e3) const
SymmetricExponential negated() const
void prepareDifferences()
static Symmetric symmetric(View block)
Symmetric first(const Symmetric &e) const
Symmetric fromEigenbasis(const Tensor &t) const
SymmetricExponential(const A &a)
FTensor::Tensor2< double, 3, 3 > vectors
Tensor toEigenbasis(const Symmetric &e) const
FTensor::Tensor1< double, 6 > stretchResult
FTensor::Tensor1< double, 5 > stressResult
FTensor::Tensor1< double, 5 > stressAdjoint
FTensor::Tensor2_symmetric< double, 3 > stretch
FTensor::Tensor1< double, 5 > stressDirection
FTensor::Tensor2_symmetric< double, 3 > adjoint
FTensor::Tensor2_symmetric< double, 3 > direction
static auto diffDiffDiffExp(A &&t_w_vee, B &&theta, C &&t_delta_w_vee)
static auto diffDiffExp(A &&t_w_vee, B &&theta)
static auto diffExp(A &&t_w_vee, B &&theta)
static auto exp(A &&t_w_vee, B &&theta)