Gyselalib++
 
Loading...
Searching...
No Matches
DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace > Class Template Reference

A class for describing discrete 2D mappings from the logical domain to the physical domain. More...

Public Types

using BSplineR = typename SplineEvaluator::bsplines_type1
 Indicate the bspline type of the first logical dimension.
 
using BSplineTheta = typename SplineEvaluator::bsplines_type2
 Indicate the bspline type of the second logical dimension.
 
using cartesian_tag_x = X
 Indicate the first physical coordinate.
 
using cartesian_tag_y = Y
 Indicate the second physical coordinate.
 
using curvilinear_tag_r = R
 Indicate the first logical coordinate.
 
using curvilinear_tag_theta = Theta
 Indicate the second logical coordinate.
 
using CoordArg = ddc::Coordinate< R, Theta >
 The type of the argument of the function described by this mapping.
 
using CoordResult = ddc::Coordinate< X, Y >
 The type of the result of the function described by this mapping.
 

Public Member Functions

KOKKOS_FUNCTION DiscreteToCartesian (SplineType curvilinear_to_x, SplineType curvilinear_to_y, SplineEvaluator const &evaluator, IdxRangeRTheta idx_range_singular_point)
 Instantiate a DiscreteToCartesian from the coefficients of 2D splines approximating the mapping.
 
KOKKOS_FUNCTION ddc::Coordinate< X, Yoperator() (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the physical coordinates from the logical coordinates.
 
KOKKOS_FUNCTION void jacobian_matrix (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord, Matrix_2x2 &matrix) const
 Compute full Jacobian matrix.
 
KOKKOS_FUNCTION double jacobian_11 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the (1,1) coefficient of the Jacobian matrix.
 
KOKKOS_FUNCTION double jacobian_12 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the (1,2) coefficient of the Jacobian matrix.
 
KOKKOS_FUNCTION double jacobian_21 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the (2,1) coefficient of the Jacobian matrix.
 
KOKKOS_FUNCTION double jacobian_22 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the (2,2) coefficient of the Jacobian matrix.
 
KOKKOS_FUNCTION double jacobian (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.
 
KOKKOS_INLINE_FUNCTION Matrix_2x2 first_order_jacobian_matrix_r_rtheta (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const
 Get the first order expansion of the Jacobian matrix with the theta component divided by r.
 
KOKKOS_INLINE_FUNCTION IdxRangeRTheta idx_range_singular_point () const
 Get the index range describing the points which should be used to evaluate functions at the central point.
 
KOKKOS_INLINE_FUNCTION const ddc::Coordinate< X, Ycontrol_point (ddc::DiscreteElement< BSplineR, BSplineTheta > const &el) const
 Get a control point of the mapping on B-splines.
 

Detailed Description

template<class X, class Y, class SplineEvaluator, class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
class DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >

A class for describing discrete 2D mappings from the logical domain to the physical domain.

The mapping describe here is only defined on a grid. The DiscreteToCartesian class decomposes the mapping on B-splines to evaluate it on the physical domain.

\( x(r,\theta) = \sum_k c_{x,k} B_k(r,\theta),\)

\( y(r,\theta) = \sum_k c_{y,k} B_k(r,\theta).\)

This mapping could be costly to inverse.

Constructor & Destructor Documentation

◆ DiscreteToCartesian()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::DiscreteToCartesian ( SplineType  curvilinear_to_x,
SplineType  curvilinear_to_y,
SplineEvaluator const &  evaluator,
IdxRangeRTheta  idx_range_singular_point 
)
inline

Instantiate a DiscreteToCartesian from the coefficients of 2D splines approximating the mapping.

A discrete mapping is a mapping whose values are known only at the mesh points of the grid. To interpolate the mapping, we use B-splines. The DiscreteToCartesian mapping is initialized from the coefficients in front of the basis splines which arise when we approximate the functions \( x(r,\theta) \), and \( y(r,\theta) \) (with \( x \) and \( y \) the physical dimensions in the logical domain) with Splines (using SplineBuilder2D). Then to interpolate the mapping, we will evaluate the decomposed functions on B-splines (see DiscreteToCartesian::operator()).

Here, the evaluator is given as input.

Parameters
[in]curvilinear_to_xBsplines coefficients of the first physical dimension in the logical domain.
[in]curvilinear_to_yBsplines coefficients of the second physical dimension in the logical domain.
[in]evaluatorThe evaluator used to evaluate the mapping.
[in]idx_range_singular_pointThe index range describing the points which should be used to evaluate functions at the central point.
See also
SplineBuilder2D
DiscreteToCartesian::operator()
SplineBoundaryValue

Member Function Documentation

◆ operator()()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION ddc::Coordinate< X, Y > DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::operator() ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the physical coordinates from the logical coordinates.

It evaluates the decomposed mapping on B-splines at the coordinate point with a SplineEvaluator2D.

Parameters
[in]coordThe coordinates in the logical domain.
Returns
The coordinates of the mapping in the physical domain.
See also
SplineEvaluator2D

◆ jacobian_matrix()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION void DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian_matrix ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord,
Matrix_2x2 &  matrix 
) const
inline

Compute full Jacobian matrix.

For some computations, we need the complete Jacobian matrix or just the coefficients. The coefficients can be given independently with the functions jacobian_11, jacobian_12, jacobian_21 and jacobian_22.

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
[out]matrixThe Jacobian matrix returned.

◆ jacobian_11()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION double DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian_11 ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the (1,1) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (1,1) coefficient of the Jacobian matrix is given by \( \frac{\partial x}{\partial r} \). As the mapping is decomposed on B-splines, it means it computes the derivatives of B-splines \( \frac{\partial x}{\partial r} (r,\theta)= \sum_k c_{x,k} \frac{\partial B_k}{\partial r}(r,\theta)\) (the derivatives are implemented in SplineEvaluator2D).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (1,1) coefficient of the Jacobian matrix.
See also
SplineEvaluator2D

◆ jacobian_12()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION double DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian_12 ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the (1,2) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (1,2) coefficient of the Jacobian matrix is given by \( \frac{\partial x}{\partial \theta} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial x}{\partial \theta}(r,\theta) = \sum_k c_{x,k} \frac{\partial B_k}{\partial \theta}(r,\theta) \) (the derivatives of B-splines are implemented in SplineEvaluator2D).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (1,2) coefficient of the Jacobian matrix.
See also
SplineEvaluator2D

◆ jacobian_21()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION double DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian_21 ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the (2,1) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (2,1) coefficient of the Jacobian matrix is given by \( \frac{\partial y}{\partial r} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial y}{\partial r}(r,\theta) = \sum_k c_{y,k} \frac{\partial B_k}{\partial r}(r,\theta)\) (the derivatives of B-splines are implemented in SplineEvaluator2D).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix. .
Returns
A double with the value of the (2,1) coefficient of the Jacobian matrix.
See also
SplineEvaluator2D

◆ jacobian_22()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION double DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian_22 ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the (2,2) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (2,2) coefficient of the Jacobian matrix is given by \( \frac{\partial y}{\partial \theta} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial y}{\partial \theta} (r,\theta) = \sum_k c_{y,k} \frac{\partial B_k}{\partial \theta}(r,\theta) \) (the derivatives of B-splines are implemented in SplineEvaluator2D).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (2,2) coefficient of the Jacobian matrix.
See also
SplineEvaluator2D

◆ jacobian()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_FUNCTION double DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::jacobian ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.

Parameters
[in]coordThe coordinate where we evaluate the Jacobian.
Returns
A double with the value of the determinant of the Jacobian matrix.

◆ first_order_jacobian_matrix_r_rtheta()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_INLINE_FUNCTION Matrix_2x2 DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::first_order_jacobian_matrix_r_rtheta ( ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &  coord) const
inline

Get the first order expansion of the Jacobian matrix with the theta component divided by r.

The expansion is carried out around \( r=0 \). The returned matrix \( J\) is defined as: \( J_{00} = \frac{\partial x}{\partial r}(r, \theta) \) \( J_{01} = \frac{1}{r} \frac{\partial x}{\partial \theta}(r, \theta) + O(r^2) = \frac{\partial^2 x}{\partial r \partial \theta}(0, \theta) \) \( J_{10} = \frac{\partial y}{\partial r}(r, \theta) \) \( J_{11} = \frac{1}{r} \frac{\partial y}{\partial \theta}(r, \theta) + O(r^2) = \frac{\partial^2 y}{\partial r \partial \theta}(0, \theta) \)

Parameters
[in]coordThe coordinate where we evaluate the Jacobian.
Returns
The first order expansion of the Jacobian matrix with the theta component divided by r.

◆ idx_range_singular_point()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_INLINE_FUNCTION IdxRangeRTheta DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::idx_range_singular_point ( ) const
inline

Get the index range describing the points which should be used to evaluate functions at the central point.

Returns
An index range covering the O-point.

◆ control_point()

template<class X , class Y , class SplineEvaluator , class R = typename SplineEvaluator::continuous_dimension_type1, class Theta = typename SplineEvaluator::continuous_dimension_type2, class MemorySpace = typename SplineEvaluator::memory_space>
KOKKOS_INLINE_FUNCTION const ddc::Coordinate< X, Y > DiscreteToCartesian< X, Y, SplineEvaluator, R, Theta, MemorySpace >::control_point ( ddc::DiscreteElement< BSplineR, BSplineTheta > const &  el) const
inline

Get a control point of the mapping on B-splines.

The mapping \( (r,\theta) \mapsto (x,y) \) decomposed on B-splines can be identified by its control points \( \{(c_{x,k}, c_{y,k})\}_{k} \) where \( c_{x,k} \) and \( c_{y,k} \) are the B-splines coefficients:

\( x(r,\theta) = \sum_{k=0}^{N_r\times N_{\theta}-1} c_{x, k} B_k{r,\theta} \),

\( y(r,\theta) = \sum_{k=0}^{N_r\times N_{\theta}-1} c_{y, k} B_k{r,\theta} \),

where \( N_r\times N_{\theta} \) is the number of B-splines.

The control points can be obtained by interpolating the mapping on interpolation points (see GrevilleInterpolationPoints or KnotsAsInterpolationPoints). We can also note that the first control points \( \{(c_{x,k}, c_{y,k})\}_{k=0}^{N_{\theta}} \) are equal to the pole \( (c_{x,k}, c_{y,k}) = (x_0,y_0) \), \( \forall k = 0, ..., N_{\theta}-1 \) where \( x(0,\theta), y(0,\theta) = (x_0,y_0) \) \( \forall \theta \).

Parameters
[in]elThe number of the control point.
Returns
The el-th control point.
See also
GrevilleInterpolationPoints
KnotsAsInterpolationPoints

The documentation for this class was generated from the following file: