Skip to content

Commit

Permalink
Address a clang compiler problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Jul 15, 2023
1 parent 57653ee commit 08f8e88
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
27 changes: 6 additions & 21 deletions include/aspect/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -1277,31 +1277,16 @@ namespace aspect
to_voigt_stiffness_vector(const SymmetricTensor<4,3> &input);


namespace internal
{
constexpr Tensor<3,3> create_levi_civita_tensor_3d()
{
Tensor<3,3> permutation_operator_3d;
permutation_operator_3d[0][1][2] = 1;
permutation_operator_3d[1][2][0] = 1;
permutation_operator_3d[2][0][1] = 1;
permutation_operator_3d[0][2][1] = -1;
permutation_operator_3d[1][0][2] = -1;
permutation_operator_3d[2][1][0] = -1;
return permutation_operator_3d;
}
}

/**
* The Levi-Civita tensor, also called a permutation or "totally antisymmetric" tensor.
* Return the Levi-Civita tensor, also called a permutation or "totally antisymmetric" tensor.
* See https://en.wikipedia.org/wiki/Levi-Civita_symbol for a definition.
* See https://en.wikipedia.org/wiki/Levi-Civita_symbol for more info.
*/
template<int dim>
constexpr Tensor<dim,dim> levi_civita;

template <> constexpr Tensor<3,3> levi_civita<3> = internal::create_levi_civita_tensor_3d();
template <int dim>
const Tensor<dim,dim> &levi_civita();

// Declare the existence of a specialization:
template <>
const Tensor<3,3> &levi_civita<3>();
}

}
Expand Down
21 changes: 21 additions & 0 deletions source/utilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,27 @@ namespace aspect
});

}


template <>
const Tensor<3,3> &levi_civita<3>()
{
static const Tensor<3,3> t =
[]()
{
Tensor<3,3> permutation_operator_3d;

permutation_operator_3d[0][1][2] = 1;
permutation_operator_3d[1][2][0] = 1;
permutation_operator_3d[2][0][1] = 1;
permutation_operator_3d[0][2][1] = -1;
permutation_operator_3d[1][0][2] = -1;
permutation_operator_3d[2][1][0] = -1;
return permutation_operator_3d;
}();

return t;
}
}


Expand Down

0 comments on commit 08f8e88

Please sign in to comment.