11#include "mapping_tools.hpp"
14template <
class X,
class Y,
class R,
class Theta>
41template <
class R,
class Theta,
class X,
class Y>
107 KOKKOS_FUNCTION ddc::Coordinate<X, Y>
operator()(ddc::Coordinate<R, Theta>
const& coord)
const
109 const double r = ddc::get<R>(coord);
110 const double theta = ddc::get<Theta>(coord);
111 const double x = r * Kokkos::cos(theta);
112 const double y = r * Kokkos::sin(theta);
113 return ddc::Coordinate<X, Y>(x, y);
124 KOKKOS_FUNCTION
double jacobian(ddc::Coordinate<R, Theta>
const& coord)
const
126 double r = ddc::get<R>(coord);
143 KOKKOS_FUNCTION
void jacobian_matrix(ddc::Coordinate<R, Theta>
const& coord, Matrix_2x2& matrix)
146 const double r = ddc::get<R>(coord);
147 const double theta = ddc::get<Theta>(coord);
148 matrix[0][0] = Kokkos::cos(theta);
149 matrix[0][1] = -r * Kokkos::sin(theta);
150 matrix[1][0] = Kokkos::sin(theta);
151 matrix[1][1] = r * Kokkos::cos(theta);
165 KOKKOS_FUNCTION
double jacobian_11(ddc::Coordinate<R, Theta>
const& coord)
const
167 const double theta = ddc::get<Theta>(coord);
168 return Kokkos::cos(theta);
182 KOKKOS_FUNCTION
double jacobian_12(ddc::Coordinate<R, Theta>
const& coord)
const
184 const double r = ddc::get<R>(coord);
185 const double theta = ddc::get<Theta>(coord);
186 return -r * Kokkos::sin(theta);
200 KOKKOS_FUNCTION
double jacobian_21(ddc::Coordinate<R, Theta>
const& coord)
const
202 const double theta = ddc::get<Theta>(coord);
203 return Kokkos::sin(theta);
217 KOKKOS_FUNCTION
double jacobian_22(ddc::Coordinate<R, Theta>
const& coord)
const
219 const double r = ddc::get<R>(coord);
220 const double theta = ddc::get<Theta>(coord);
221 return r * Kokkos::cos(theta);
245 ddc::Coordinate<R, Theta>
const& coord,
246 Matrix_2x2& matrix)
const
248 const double r = ddc::get<R>(coord);
249 const double theta = ddc::get<Theta>(coord);
250 assert(fabs(r) >= 1e-15);
251 matrix[0][0] = Kokkos::cos(theta);
252 matrix[0][1] = Kokkos::sin(theta);
253 matrix[1][0] = -1 / r * Kokkos::sin(theta);
254 matrix[1][1] = 1 / r * Kokkos::cos(theta);
269 const double theta = ddc::get<Theta>(coord);
270 return Kokkos::cos(theta);
285 const double theta = ddc::get<Theta>(coord);
286 return Kokkos::sin(theta);
301 const double r = ddc::get<R>(coord);
302 const double theta = ddc::get<Theta>(coord);
303 assert(fabs(r) >= 1e-15);
304 return -1 / r * Kokkos::sin(theta);
319 const double r = ddc::get<R>(coord);
320 const double theta = ddc::get<Theta>(coord);
321 assert(fabs(r) >= 1e-15);
322 return 1 / r * Kokkos::cos(theta);
336namespace mapping_detail {
337template <
class X,
class Y,
class R,
class Theta,
class ExecSpace>
342template <
class X,
class Y,
class R,
class Theta>
347template <
class X,
class Y,
class R,
class Theta>
A class for describing the circular 2D mapping.
Definition cartesian_to_circular.hpp:40
A class for describing the circular 2D mapping.
Definition circular_to_cartesian.hpp:43
ddc::Coordinate< R, Theta > CoordArg
The type of the argument of the function described by this mapping.
Definition circular_to_cartesian.hpp:55
CircularToCartesian & operator=(CircularToCartesian &&x)=default
Assign a CircularToCartesian from another temporary CircularToCartesian (rvalue).
KOKKOS_FUNCTION double jacobian_12(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,2) coefficient of the Jacobian matrix.
Definition circular_to_cartesian.hpp:182
KOKKOS_FUNCTION double jacobian_22(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,2) coefficient of the Jacobian matrix.
Definition circular_to_cartesian.hpp:217
KOKKOS_FUNCTION double inv_jacobian_22(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,2) coefficient of the inverse Jacobian matrix.
Definition circular_to_cartesian.hpp:317
ddc::Coordinate< X, Y > CoordResult
The type of the result of the function described by this mapping.
Definition circular_to_cartesian.hpp:57
KOKKOS_FUNCTION double jacobian(ddc::Coordinate< R, Theta > const &coord) const
Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.
Definition circular_to_cartesian.hpp:124
CircularToCartesian & operator=(CircularToCartesian const &x)=default
Assign a CircularToCartesian from another CircularToCartesian (lvalue).
KOKKOS_FUNCTION double inv_jacobian_12(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,2) coefficient of the inverse Jacobian matrix.
Definition circular_to_cartesian.hpp:283
KOKKOS_FUNCTION ddc::Coordinate< X, Y > operator()(ddc::Coordinate< R, Theta > const &coord) const
Convert the coordinate to the equivalent (x,y) coordinate.
Definition circular_to_cartesian.hpp:107
KOKKOS_FUNCTION double jacobian_11(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,1) coefficient of the Jacobian matrix.
Definition circular_to_cartesian.hpp:165
KOKKOS_FUNCTION double jacobian_21(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,1) coefficient of the Jacobian matrix.
Definition circular_to_cartesian.hpp:200
CartesianToCircular< X, Y, R, Theta > get_inverse_mapping() const
Get the inverse mapping.
Definition circular_to_cartesian.hpp:330
CircularToCartesian(CircularToCartesian &&x)=default
Instantiate a CircularToCartesian from another temporary CircularToCartesian (rvalue).
KOKKOS_FUNCTION void jacobian_matrix(ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
Compute full Jacobian matrix.
Definition circular_to_cartesian.hpp:143
KOKKOS_FUNCTION void inv_jacobian_matrix(ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
Compute full inverse Jacobian matrix.
Definition circular_to_cartesian.hpp:244
KOKKOS_FUNCTION double inv_jacobian_11(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,1) coefficient of the inverse Jacobian matrix.
Definition circular_to_cartesian.hpp:267
KOKKOS_FUNCTION double inv_jacobian_21(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,1) coefficient of the inverse Jacobian matrix.
Definition circular_to_cartesian.hpp:299
KOKKOS_FUNCTION CircularToCartesian(CircularToCartesian const &other)
Instantiate a CircularToCartesian from another CircularToCartesian (lvalue).
Definition circular_to_cartesian.hpp:68
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