6#include "mapping_tools.hpp"
16template <
class Mapping,
class PositionCoordinate =
typename Mapping::CoordArg>
45 KOKKOS_INLINE_FUNCTION Matrix_2x2
operator()(PositionCoordinate
const& coord)
const
48 if constexpr (has_2d_inv_jacobian_v<Mapping, PositionCoordinate>) {
49 m_mapping.inv_jacobian_matrix(coord, matrix);
51 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
52 double jacob = m_mapping.jacobian(coord);
53 assert(fabs(jacob) > 1e-15);
54 matrix[0][0] = m_mapping.jacobian_22(coord) / jacob;
55 matrix[0][1] = -m_mapping.jacobian_12(coord) / jacob;
56 matrix[1][0] = -m_mapping.jacobian_21(coord) / jacob;
57 matrix[1][1] = m_mapping.jacobian_11(coord) / jacob;
72 KOKKOS_INLINE_FUNCTION
double inv_jacobian_11(PositionCoordinate
const& coord)
const
74 if constexpr (has_2d_inv_jacobian_v<Mapping, PositionCoordinate>) {
75 return m_mapping.inv_jacobian_11(coord);
77 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
78 double jacob = m_mapping.jacobian(coord);
79 assert(fabs(jacob) > 1e-15);
80 return m_mapping.jacobian_22(coord) / jacob;
94 KOKKOS_INLINE_FUNCTION
double inv_jacobian_12(PositionCoordinate
const& coord)
const
96 if constexpr (has_2d_inv_jacobian_v<Mapping, PositionCoordinate>) {
97 return m_mapping.inv_jacobian_12(coord);
99 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
100 double jacob = m_mapping.jacobian(coord);
101 assert(fabs(jacob) > 1e-15);
102 return -m_mapping.jacobian_12(coord) / jacob;
117 if constexpr (has_2d_inv_jacobian_v<Mapping, PositionCoordinate>) {
118 return m_mapping.inv_jacobian_21(coord);
120 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
121 double jacob = m_mapping.jacobian(coord);
122 assert(fabs(jacob) > 1e-15);
123 return -m_mapping.jacobian_21(coord) / jacob;
139 if constexpr (has_2d_inv_jacobian_v<Mapping, PositionCoordinate>) {
140 return m_mapping.inv_jacobian_22(coord);
142 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
143 double jacob = m_mapping.jacobian(coord);
144 assert(fabs(jacob) > 1e-15);
145 return m_mapping.jacobian_11(coord) / jacob;
A class to calculate the inverse of the Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:18
KOKKOS_INLINE_FUNCTION double inv_jacobian_11(PositionCoordinate const &coord) const
Compute the (1,1) coefficient of the inverse Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:72
KOKKOS_FUNCTION InverseJacobianMatrix(Mapping const &mapping)
A constructor for the InverseJacobianMatrix.
Definition inverse_jacobian_matrix.hpp:27
KOKKOS_INLINE_FUNCTION double inv_jacobian_21(PositionCoordinate const &coord) const
Compute the (2,1) coefficient of the inverse Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:115
KOKKOS_INLINE_FUNCTION Matrix_2x2 operator()(PositionCoordinate const &coord) const
Compute full inverse Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:45
KOKKOS_INLINE_FUNCTION double inv_jacobian_12(PositionCoordinate const &coord) const
Compute the (1,2) coefficient of the inverse Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:94
KOKKOS_INLINE_FUNCTION double inv_jacobian_22(PositionCoordinate const &coord) const
Compute the (2,2) coefficient of the inverse Jacobian matrix.
Definition inverse_jacobian_matrix.hpp:137