5#include "mapping_tools.hpp"
20template <
class Corner1Tag,
class Corner2Tag,
class Corner3Tag,
class X,
class Y>
25 using CoordArg = ddc::Coordinate<Corner1Tag, Corner2Tag, Corner3Tag>;
31 using CartesianCoord = ddc::Coordinate<X, Y>;
34 CartesianCoord m_corner1;
35 CartesianCoord m_corner2;
36 CartesianCoord m_corner3;
47 CartesianCoord
const& corner1,
48 CartesianCoord
const& corner2,
49 CartesianCoord
const& corner3)
94 const double l1 = ddc::get<Corner1Tag>(pos);
95 const double l2 = ddc::get<Corner2Tag>(pos);
96 const double l3 = ddc::get<Corner3Tag>(pos);
98 const double x1 = ddc::get<X>(m_corner1);
99 const double x2 = ddc::get<X>(m_corner2);
100 const double x3 = ddc::get<X>(m_corner3);
101 const double y1 = ddc::get<Y>(m_corner1);
102 const double y2 = ddc::get<Y>(m_corner2);
103 const double y3 = ddc::get<Y>(m_corner3);
105 const double x = x1 * l1 + x2 * l2 + x3 * l3;
106 const double y = y1 * l1 + y2 * l2 + y3 * l3;
108 return CartesianCoord(x, y);
A class to convert barycentric coordinates to cartesian coordinates on a triangle.
Definition barycentric_to_cartesian.hpp:22
BarycentricToCartesian(BarycentricToCartesian const &other)=default
A copy operator for the mapping operator.
ddc::Coordinate< Corner1Tag, Corner2Tag, Corner3Tag > CoordArg
The type of a coordinate in the barycentric coordinate system.
Definition barycentric_to_cartesian.hpp:25
BarycentricToCartesian & operator=(BarycentricToCartesian &&x)=default
A r-value copy operator for the mapping operator.
KOKKOS_FUNCTION CoordResult operator()(CoordArg const &pos) const
The operator to get the equivalent cartesian coordinate of the barycentric coordinate.
Definition barycentric_to_cartesian.hpp:92
BarycentricToCartesian(CartesianCoord const &corner1, CartesianCoord const &corner2, CartesianCoord const &corner3)
Construct the operator which converts between the coordinate systems.
Definition barycentric_to_cartesian.hpp:46
BarycentricToCartesian & operator=(BarycentricToCartesian const &x)=default
A copy operator for the mapping operator.
~BarycentricToCartesian()=default
The destructor of the mapping operator.
BarycentricToCartesian(BarycentricToCartesian &&x)=default
A r-value copy operator for the mapping operator.
ddc::Coordinate< X, Y > CoordResult
The type of a coordinate in the cartesian coordinate system.
Definition barycentric_to_cartesian.hpp:28