8#include "mapping_tools.hpp"
11template <
class R,
class Theta,
class X,
class Y>
38template <
class X,
class Y,
class R,
class Theta>
104 KOKKOS_FUNCTION ddc::Coordinate<R, Theta>
operator()(ddc::Coordinate<X, Y>
const& coord)
const
106 const double x = ddc::get<X>(coord);
107 const double y = ddc::get<Y>(coord);
108 const double r = Kokkos::sqrt(x * x + y * y);
109 const double theta = Kokkos::atan2(y, x);
110 return ddc::Coordinate<R, Theta>(r, theta);
121 KOKKOS_FUNCTION
double jacobian(ddc::Coordinate<X, Y>
const& coord)
123 const double x = ddc::get<X>(coord);
124 const double y = ddc::get<Y>(coord);
125 return 2. * (x * x - y * y) / Kokkos::pow(x * x + y * y, 1.5);
147 KOKKOS_FUNCTION
void jacobian_matrix(ddc::Coordinate<X, Y>
const& coord, Matrix_2x2& matrix)
150 const double x = ddc::get<X>(coord);
151 const double y = ddc::get<Y>(coord);
152 matrix[0][0] = 2 * x / Kokkos::pow(x * x + y * y, 0.5);
153 matrix[0][1] = 2 * y / Kokkos::pow(x * x + y * y, 0.5);
154 matrix[1][0] = -y / Kokkos::pow(x * x + y * y, 2.);
155 matrix[1][1] = x / Kokkos::pow(x * x + y * y, 2.);
169 KOKKOS_FUNCTION
double jacobian_11(ddc::Coordinate<X, Y>
const& coord)
171 const double x = ddc::get<X>(coord);
172 const double y = ddc::get<Y>(coord);
173 return 2 * x / Kokkos::pow(x * x + y * y, 0.5);
188 KOKKOS_FUNCTION
double jacobian_12(ddc::Coordinate<X, Y>
const& coord)
190 const double x = ddc::get<X>(coord);
191 const double y = ddc::get<Y>(coord);
192 return 2 * y / Kokkos::pow(x * x + y * y, 0.5);
206 KOKKOS_FUNCTION
double jacobian_21(ddc::Coordinate<X, Y>
const& coord)
208 const double x = ddc::get<X>(coord);
209 const double y = ddc::get<Y>(coord);
210 return -y / Kokkos::pow(x * x + y * y, 2.);
224 KOKKOS_FUNCTION
double jacobian_22(ddc::Coordinate<X, Y>
const& coord)
226 const double x = ddc::get<X>(coord);
227 const double y = ddc::get<Y>(coord);
228 return x / Kokkos::pow(x * x + y * y, 2.);
242namespace mapping_detail {
243template <
class X,
class Y,
class R,
class Theta,
class ExecSpace>
A class for describing the circular 2D mapping.
Definition cartesian_to_circular.hpp:40
KOKKOS_FUNCTION double jacobian_22(ddc::Coordinate< X, Y > const &coord)
Compute the (2,2) coefficient of the Jacobian matrix.
Definition cartesian_to_circular.hpp:224
KOKKOS_FUNCTION double jacobian(ddc::Coordinate< X, Y > const &coord)
Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.
Definition cartesian_to_circular.hpp:121
CircularToCartesian< R, Theta, X, Y > get_inverse_mapping() const
Get the inverse mapping.
Definition cartesian_to_circular.hpp:236
KOKKOS_FUNCTION CartesianToCircular(CartesianToCircular const &other)
Instantiate a CartesianToCircular from another CartesianToCircular (lvalue).
Definition cartesian_to_circular.hpp:65
CartesianToCircular & operator=(CartesianToCircular &&x)=default
Assign a CartesianToCircular from another temporary CartesianToCircular (rvalue).
ddc::Coordinate< R, Theta > CoordResult
The type of the result of the function described by this mapping.
Definition cartesian_to_circular.hpp:54
KOKKOS_FUNCTION void jacobian_matrix(ddc::Coordinate< X, Y > const &coord, Matrix_2x2 &matrix)
Compute full Jacobian matrix.
Definition cartesian_to_circular.hpp:147
KOKKOS_FUNCTION ddc::Coordinate< R, Theta > operator()(ddc::Coordinate< X, Y > const &coord) const
Convert the coordinate (x,y) to the equivalent coordinate.
Definition cartesian_to_circular.hpp:104
KOKKOS_FUNCTION double jacobian_11(ddc::Coordinate< X, Y > const &coord)
Compute the (1,1) coefficient of the Jacobian matrix.
Definition cartesian_to_circular.hpp:169
KOKKOS_FUNCTION double jacobian_21(ddc::Coordinate< X, Y > const &coord)
Compute the (2,1) coefficient of the Jacobian matrix.
Definition cartesian_to_circular.hpp:206
KOKKOS_FUNCTION double jacobian_12(ddc::Coordinate< X, Y > const &coord)
Compute the (1,2) coefficient of the Jacobian matrix.
Definition cartesian_to_circular.hpp:188
ddc::Coordinate< X, Y > CoordArg
The type of the argument of the function described by this mapping.
Definition cartesian_to_circular.hpp:52
CartesianToCircular(CartesianToCircular &&x)=default
Instantiate a Curvilinear2DToCartesian from another temporary CartesianToCircular (rvalue).
CartesianToCircular & operator=(CartesianToCircular const &x)=default
Assign a CartesianToCircular from another CartesianToCircular (lvalue).
A class for describing the circular 2D mapping.
Definition circular_to_cartesian.hpp:43
Define non periodic real R dimension.
Definition geometry.hpp:31
Define periodic real Theta dimension.
Definition geometry.hpp:42
Define non periodic real X dimension.
Definition geometry.hpp:278
Define non periodic real Y dimension.
Definition geometry.hpp:289