Gyselalib++
 
Loading...
Searching...
No Matches
EdgeTransformation< Interface > Class Template Reference

Transform a coordinate or an index from one edge to the one on the other edge. More...

Public Member Functions

 EdgeTransformation (IdxRangeEdge1 const &idx_range_patch_1, IdxRangeEdge2 const &idx_range_patch_2)
 Instantiate an EdgeTransformation.
 
template<class CurrentDim >
Coord< std::conditional_t< std::is_same_v< CurrentDim, EdgeDim1 >, EdgeDim2, EdgeDim1 > > operator() (Coord< CurrentDim > const &current_coord) const
 Transform a coordinate on the edge in the dimension of the current patch to the analogous coordinate on the target patch.
 
template<class CurrentIdx >
auto operator() (CurrentIdx const &current_idx) const
 Transform an index on the edge in the dimension of the current patch to the analogous index on the target patch.
 
template<class CurrentIdx >
bool is_match_available (CurrentIdx const &current_idx) const
 Check if a given index has an equivalent index on the other patch of an interface.
 
template<class CurrentGrid , class TargetGrid >
bool search_for_match (Idx< TargetGrid > &target_idx, Idx< CurrentGrid > const &current_idx) const
 Check if a given index has an equivalent index and transform an index on the edge in the dimension of the current patch to the analogous index on the target patch.
 

Detailed Description

template<class Interface>
class EdgeTransformation< Interface >

Transform a coordinate or an index from one edge to the one on the other edge.

According to the orientation of the interface, we compute the equivalent coordinate

  • if True, \( \\ t \mapsto min_2 + \frac{t - min_1}{max_1 - min_1}(max_2 - min_2) \)
  • if False, \( \\ t \mapsto max_2 - \frac{t - min_1}{max_1 - min_1}(max_2 - min_2) \)

where \( min_i \) and \( max_i \) are the minimum and maximum coordinates of the edge \( i \).

For the indices, we look for an equivalent index corresponding to a coordinate equivalent to the coordinate of the initial index.

Template Parameters
InterfaceThe Interface type where we want to compute the transformation.

Constructor & Destructor Documentation

◆ EdgeTransformation()

template<class Interface >
EdgeTransformation< Interface >::EdgeTransformation ( IdxRangeEdge1 const &  idx_range_patch_1,
IdxRangeEdge2 const &  idx_range_patch_2 
)
inline

Instantiate an EdgeTransformation.

Parameters
idx_range_patch_11D index range on the patch 1 of the interface.
idx_range_patch_21D index range on the patch 2 of the interface.

Member Function Documentation

◆ operator()() [1/2]

template<class Interface >
template<class CurrentDim >
Coord< std::conditional_t< std::is_same_v< CurrentDim, EdgeDim1 >, EdgeDim2, EdgeDim1 > > EdgeTransformation< Interface >::operator() ( Coord< CurrentDim > const &  current_coord) const
inline

Transform a coordinate on the edge in the dimension of the current patch to the analogous coordinate on the target patch.

Parameters
current_coordA coordinate on the edge of the current patch.
Template Parameters
CurrentDimThe current continuous dimension of the given coordinate coord.
Returns
The analogous coordinate on the target patch.

◆ operator()() [2/2]

template<class Interface >
template<class CurrentIdx >
auto EdgeTransformation< Interface >::operator() ( CurrentIdx const &  current_idx) const
inline

Transform an index on the edge in the dimension of the current patch to the analogous index on the target patch.

If the grids are uniform, we can simplify the algorithm by using modulo. Otherwise, we need to check all the indices of the target grid. We suppose the coordinate transformation bijective, so we can use a dichotomy method.

This method mainly calls search_for_match.

Parameters
current_idxA index on the edge of the current patch.
Template Parameters
CurrentIdxThe current index type of the given coordinate index.
Returns
The analogous index on the target patch.

◆ is_match_available()

template<class Interface >
template<class CurrentIdx >
bool EdgeTransformation< Interface >::is_match_available ( CurrentIdx const &  current_idx) const
inline

Check if a given index has an equivalent index on the other patch of an interface.

If the grids are uniform, we can simplify the algorithm by using modulo. Otherwise, we need to check all the indices of the target grid. We suppose the coordinate transformation bijective, so we can use a dichotomy method.

This method mainly calls search_for_match.

Parameters
current_idxA index on the edge of the current patch.
Template Parameters
CurrentIdxThe current index type of the given coordinate index.
Returns
Boolean stating if there is an equivalent index.

◆ search_for_match()

template<class Interface >
template<class CurrentGrid , class TargetGrid >
bool EdgeTransformation< Interface >::search_for_match ( Idx< TargetGrid > &  target_idx,
Idx< CurrentGrid > const &  current_idx 
) const
inline

Check if a given index has an equivalent index and transform an index on the edge in the dimension of the current patch to the analogous index on the target patch.

If the grids are uniform, we can simplify the algorithm by using modulo. Otherwise, we need to check all the indices of the target grid. We suppose the coordinate transformation bijective, so we can use a dichotomy method.

Warning
target_idx is always replaced by the suspected index. If there is not equivalent index, the returned index is wrong but the closest that the algorithm found.
Template Parameters
CurrentGridThe grid where the input index is defined.
TargetGridThe grid where the output index is defined.
Parameters
[out]target_idxA index on the edge of the target patch.
[in]current_idxA index on the edge of the current patch.
Template Parameters
CurrentIdxThe current index type of the given coordinate index.
Returns
Boolean stating if there is an equivalent index.

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