Transform a coordinate or an index from one edge to the one on the other edge.
More...
|
| 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 ¤t_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 ¤t_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 ¤t_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 ¤t_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.
|
|
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
-
template<class CurrentIdx >
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_idx | A index on the edge of the current patch. |
- Template Parameters
-
CurrentIdx | The current index type of the given coordinate index. |
- Returns
- The analogous index on the target patch.
template<class CurrentIdx >
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_idx | A index on the edge of the current patch. |
- Template Parameters
-
CurrentIdx | The current index type of the given coordinate index. |
- Returns
- Boolean stating if there is an equivalent index.
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
-
CurrentGrid | The grid where the input index is defined. |
TargetGrid | The grid where the output index is defined. |
- Parameters
-
[out] | target_idx | A index on the edge of the target patch. |
[in] | current_idx | A index on the edge of the current patch. |
- Template Parameters
-
CurrentIdx | The current index type of the given coordinate index. |
- Returns
- Boolean stating if there is an equivalent index.