6#include "ddc_aliases.hpp"
8#include "interface.hpp"
11namespace connectivity_details {
18template <
class Patch,
class InterfaceTypeSeq>
26 using type = ddc::detail::TypeSeq<>;
30template <
class Patch,
class InterfaceType>
34 using type = std::conditional_t<
35 InterfaceType::template connected_to_patch<Patch>(),
36 ddc::detail::TypeSeq<InterfaceType>,
37 ddc::detail::TypeSeq<>>;
41template <
class Patch,
class InterfaceType1,
class... RemainingInterfaceTypes>
45 using type = ddc::type_seq_merge_t<
56template <
class TypeSeq>
60template <
class EdgeType>
64 using type = std::conditional_t<
65 std::is_same_v<EdgeType, OutsideEdge>,
66 ddc::detail::TypeSeq<>,
67 ddc::detail::TypeSeq<EdgeType>>;
71template <
class EdgeType1,
class... RemainingEdgeTypes>
75 using type = ddc::type_seq_merge_t<
84template <
class TypeSeq>
92 using type = std::tuple<I...>;
99template <
class TypeSeq>
107 using type = ddc::detail::TypeSeq<>;
111template <
class EdgeType1,
class... EdgeTypes>
115 using type = ddc::type_seq_merge_t<
116 ddc::detail::TypeSeq<typename EdgeType1::associated_patch>,
117 typename ExtractPatches<ddc::detail::TypeSeq<EdgeTypes...>>::type>;
125template <
class Gr
id1D,
class PatchTypeSeq>
129template <
class Gr
id1D>
134 static_assert(!std::is_same_v<Grid1D, Grid1D>,
"No patches found using dimension.");
141template <
class QueryGrid1D,
class OGrid,
class BSpl1,
class BSpl2,
class... RemainingPatchTypes>
144 ddc::detail::TypeSeq<Patch<QueryGrid1D, OGrid, BSpl1, BSpl2>, RemainingPatchTypes...>>
154template <
class QueryGrid1D,
class OGrid,
class BSpl1,
class BSpl2,
class... RemainingPatchTypes>
157 ddc::detail::TypeSeq<Patch<OGrid, QueryGrid1D, BSpl1, BSpl2>, RemainingPatchTypes...>>
164template <
class Grid1D,
class Patch1,
class... RemainingPatchTypes>
165struct FindPatch<Grid1D, ddc::detail::TypeSeq<Patch1, RemainingPatchTypes...>>
168 static_assert(!std::is_same_v<typename Patch1::Grid1, Grid1D>);
169 static_assert(!std::is_same_v<typename Patch1::Grid2, Grid1D>);
171 using type =
typename FindPatch<Grid1D, ddc::detail::TypeSeq<RemainingPatchTypes...>>::type;
179template <
class Edge,
class InterfaceTypeSeq>
188 static_assert(!std::is_same_v<Edge, Edge>,
"Edge not found in collection of interfaces.");
192template <
class Edge,
class Interface1,
class... RemainingInterfaceTypes>
196 static_assert(!std::is_same_v<Edge, typename Interface1::Edge1>);
197 static_assert(!std::is_same_v<Edge, typename Interface1::Edge2>);
200 typename FindInterface<
Edge, ddc::detail::TypeSeq<RemainingInterfaceTypes...>>::type;
204template <
class Edge,
class OEdge,
bool Orientations,
class... RemainingInterfaceTypes>
207 ddc::detail::TypeSeq<Interface<Edge, OEdge, Orientations>, RemainingInterfaceTypes...>>
214template <
class Edge,
class OEdge,
bool Orientations,
class... RemainingInterfaceTypes>
217 ddc::detail::TypeSeq<Interface<OEdge, Edge, Orientations>, RemainingInterfaceTypes...>>
228template <
class InterfaceType,
class FirstEdge>
232template <
class FirstEdge,
class Edge2,
bool Orientations>
240template <
class FirstEdge,
class Edge2,
bool Orientations>
248template <
class InterfaceType,
class FirstEdge>
249using enforce_first_interface_edge_t =
256template <
class EdgeType>
260template <
class Patch,
class Gr
id1D>
268template <
class Patch,
class Gr
id1D>
283template <
class StartEdge,
class InterfaceTypeSeq>
284using equivalent_edge_t =
typename connectivity_details::
285 FindInterface<StartEdge, InterfaceTypeSeq>::type::template OtherEdge<StartEdge>;
287namespace connectivity_details {
291enum InsertPosition { FrontInsert, BackInsert };
299template <
class ToInsert,
class TypeSeq, InsertPosition insert_pos>
303template <
class ToInsert,
class TypeSeq>
307 using type = ddc::type_seq_merge_t<TypeSeq, ddc::detail::TypeSeq<ToInsert>>;
311template <
class ToInsert,
class TypeSeq>
315 using type = ddc::type_seq_merge_t<ddc::detail::TypeSeq<ToInsert>, TypeSeq>;
330 class InterfaceTypeSeq,
331 InsertPosition insert_pos,
332 class FoundInterfaces = ddc::detail::TypeSeq<>,
333 class MatchingEdge = equivalent_edge_t<StartEdge, InterfaceTypeSeq>,
334 bool interface_already_found
336 enforce_first_interface_edge_t<
338 std::conditional_t<StartEdge::extremity == FRONT, MatchingEdge, StartEdge>>,
345 class InterfaceTypeSeq,
346 InsertPosition insert_pos,
347 class FoundInterfaces,
359 enforce_first_interface_edge_t<
361 std::conditional_t<StartEdge::extremity == FRONT, MatchingEdge, StartEdge>>,
375 class InterfaceTypeSeq,
376 InsertPosition insert_pos,
377 class FoundInterfaces,
392template <
class StartEdge,
class InterfaceTypeSeq, InsertPosition insert_pos,
class FoundInterfaces>
403 enforce_first_interface_edge_t<
405 std::conditional_t<StartEdge::extremity == FRONT, OutsideEdge, StartEdge>>,
422 class InterfaceTypeSeq,
423 InsertPosition insert_pos,
424 class FoundGrids = ddc::detail::TypeSeq<>,
425 class MatchingEdge = equivalent_edge_t<StartEdge, InterfaceTypeSeq>,
426 bool grid_already_found
427 = ddc::in_tags_v<typename StartEdge::perpendicular_grid, FoundGrids>>
433 class InterfaceTypeSeq,
434 InsertPosition insert_pos,
460 class InterfaceTypeSeq,
461 InsertPosition insert_pos,
471template <
class StartEdge,
class InterfaceTypeSeq, InsertPosition insert_pos,
class FoundGr
ids>
488template <
class StartPatch,
class Gr
id1D,
class InterfaceTypeSeq>
503 using type = ddc::type_seq_merge_t<
521template <
class StartPatch,
class Gr
id1D,
class InterfaceTypeSeq>
536 using type = ddc::type_seq_merge_t<
551template <
class QueryGr
id1D,
class IdxRangeType>
555template <
class QueryGrid1D,
class... IdxRangeGrids>
559 using type = std::conditional_t<
560 ddc::in_tags_v<QueryGrid1D, ddc::detail::TypeSeq<IdxRangeGrids...>>,
561 ddc::detail::TypeSeq<IdxRange<IdxRangeGrids...>>,
562 ddc::detail::TypeSeq<>>;
574template <
class QueryGr
id1D,
class IdxRangeTuple>
578template <
class QueryGr
id1D>
582 using type = ddc::detail::TypeSeq<>;
586template <
class QueryGrid1D,
class IdxRangeHead,
class... IdxRangeTypes>
590 using type = ddc::type_seq_merge_t<
598template <
class TypeSeq>
602template <
class... EdgeType>
603using strip_outside_edges_t =
607template <
class EdgeTypeSeq>
611template <
class StartPatch,
class InterfaceTypeSeq>
612using interfaces_of_patch_t =
616template <
class Gr
id1D,
class PatchTypeSeq>
620template <
class EdgeType,
class InterfaceTypeSeq>
621using find_associated_interface_t =
625template <
class StartPatch,
class Gr
id1D,
class InterfaceTypeSeq>
626using collect_grids_on_dim_t =
typename connectivity_details::
627 CollectAllGridsOnDim<StartPatch, Grid1D, InterfaceTypeSeq>::type;
630template <
class StartPatch,
class Gr
id1D,
class InterfaceTypeSeq>
631using collect_interfaces_on_dim_t =
typename connectivity_details::
632 CollectAllInterfacesOnDim<StartPatch, Grid1D, InterfaceTypeSeq>::type;
635template <
class QueryGr
id1D,
class IdxRangeTuple>
636using find_relevant_idx_range_t = ddc::type_seq_element_t<
Define an edge of a given patch.
Definition edge.hpp:25
Represent a simple sticking of two edges.
Definition interface.hpp:21
Define an edge for the outside index range.
Definition edge.hpp:47
Base tag for a patch.
Definition patch.hpp:14
ddc::type_seq_merge_t< ddc::detail::TypeSeq< ToInsert >, TypeSeq > type
The type found by the class.
Definition connectivity_details.hpp:315
ddc::type_seq_merge_t< TypeSeq, ddc::detail::TypeSeq< ToInsert > > type
The type found by the class.
Definition connectivity_details.hpp:307
A class which helps insert an element into a type sequence.
Definition connectivity_details.hpp:300
A class which collects all grids along a given dimension in both directions.
Definition connectivity_details.hpp:490
ddc::type_seq_merge_t< BackwardTypeSeq, typename CollectGridsAlongDim< Edge< StartPatch, Grid1D, BACK >, InterfaceTypeSeq, FrontInsert, BackwardTypeSeq >::type > type
The type found by the class.
Definition connectivity_details.hpp:510
typename CollectGridsAlongDim< Edge< StartPatch, Grid1D, FRONT >, InterfaceTypeSeq, BackInsert >::type BackwardTypeSeq
The type sequence describing all grids found by iterating along this dimension in the backwards direc...
Definition connectivity_details.hpp:501
A class which collects all grids along a given dimension in both directions.
Definition connectivity_details.hpp:523
ddc::type_seq_merge_t< BackwardTypeSeq, typename CollectInterfacesAlongDim< Edge< StartPatch, Grid1D, BACK >, InterfaceTypeSeq, FrontInsert, BackwardTypeSeq >::type > type
The type found by the class.
Definition connectivity_details.hpp:543
typename CollectInterfacesAlongDim< Edge< StartPatch, Grid1D, FRONT >, InterfaceTypeSeq, BackInsert >::type BackwardTypeSeq
The type sequence describing all grids found by iterating along this dimension in the backwards direc...
Definition connectivity_details.hpp:534
typename AddToTypeSeq< typename StartEdge::perpendicular_grid, FoundGrids, insert_pos >::type type
The type found by the class.
Definition connectivity_details.hpp:477
FoundGrids type
The type found by the class.
Definition connectivity_details.hpp:467
typename AddToTypeSeq< typename StartEdge::perpendicular_grid, FoundGrids, insert_pos >::type NewGridList
The new list of grids that have been found including the grid from the current patch.
Definition connectivity_details.hpp:448
typename CollectGridsAlongDim< typename SwapExtremity< MatchingEdge >::type, InterfaceTypeSeq, insert_pos, NewGridList >::type type
The type found by the class.
Definition connectivity_details.hpp:454
A class which collects grids along a given dimension on a specified direction from a starting edge.
Definition connectivity_details.hpp:428
FoundInterfaces type
The type found by the class.
Definition connectivity_details.hpp:388
typename CollectInterfacesAlongDim< typename SwapExtremity< MatchingEdge >::type, InterfaceTypeSeq, insert_pos, NewInterfaceList >::type type
The type found by the class.
Definition connectivity_details.hpp:369
typename AddToTypeSeq< enforce_first_interface_edge_t< typename FindInterface< StartEdge, InterfaceTypeSeq >::type, std::conditional_t< StartEdge::extremity==FRONT, MatchingEdge, StartEdge > >, FoundInterfaces, insert_pos >::type NewInterfaceList
The new list of interfaces that have been found including the interface from the current patch.
Definition connectivity_details.hpp:363
typename AddToTypeSeq< enforce_first_interface_edge_t< typename FindInterface< StartEdge, InterfaceTypeSeq >::type, std::conditional_t< StartEdge::extremity==FRONT, OutsideEdge, StartEdge > >, FoundInterfaces, insert_pos >::type type
The type found by the class.
Definition connectivity_details.hpp:407
A class which collects interfaces along a given dimension on a specified direction from a starting ed...
Definition connectivity_details.hpp:340
A class to flip the edges in an interface to ensure that the correct edge comes first.
Definition connectivity_details.hpp:229
typename FindInterface< Edge, ddc::detail::TypeSeq< RemainingInterfaceTypes... > >::type type
The type found by the class.
Definition connectivity_details.hpp:200
A class to locate an interface which contains the specified edge.
Definition connectivity_details.hpp:180
typename FindPatch< Grid1D, ddc::detail::TypeSeq< RemainingPatchTypes... > >::type type
The type found by the class.
Definition connectivity_details.hpp:171
A class to locate a patch which contains the specified grid.
Definition connectivity_details.hpp:126
ddc::type_seq_merge_t< typename SelectRelevantIdxRangeType< QueryGrid1D, IdxRangeHead >::type, typename FindRelevantIdxRangeType< QueryGrid1D, std::tuple< IdxRangeTypes... > >::type > type
The type found by the class.
Definition connectivity_details.hpp:592
ddc::detail::TypeSeq<> type
The type found by the class.
Definition connectivity_details.hpp:582
A class to find any index range types which contain an index range defined on the provided grid.
Definition connectivity_details.hpp:575
ddc::type_seq_merge_t< typename PatchConnection< Patch, ddc::detail::TypeSeq< InterfaceType1 > >::type, typename PatchConnection< Patch, ddc::detail::TypeSeq< RemainingInterfaceTypes... > >::type > type
The type found by the class.
Definition connectivity_details.hpp:48
std::conditional_t< InterfaceType::template connected_to_patch< Patch >(), ddc::detail::TypeSeq< InterfaceType >, ddc::detail::TypeSeq<> > type
The type found by the class.
Definition connectivity_details.hpp:37
ddc::detail::TypeSeq<> type
The type found by the class.
Definition connectivity_details.hpp:26
A class which finds all interfaces connected to a given patch.
Definition connectivity_details.hpp:19
std::conditional_t< ddc::in_tags_v< QueryGrid1D, ddc::detail::TypeSeq< IdxRangeGrids... > >, ddc::detail::TypeSeq< IdxRange< IdxRangeGrids... > >, ddc::detail::TypeSeq<> > type
The type found by the class.
Definition connectivity_details.hpp:562
A class to create a type sequence which contains the index range if it can be used to index the grid.
Definition connectivity_details.hpp:552
ddc::type_seq_merge_t< typename StripOutsideEdges< ddc::detail::TypeSeq< EdgeType1 > >::type, typename StripOutsideEdges< ddc::detail::TypeSeq< RemainingEdgeTypes... > >::type > type
The type found by the class.
Definition connectivity_details.hpp:77
std::conditional_t< std::is_same_v< EdgeType, OutsideEdge >, ddc::detail::TypeSeq<>, ddc::detail::TypeSeq< EdgeType > > type
The type found by the class.
Definition connectivity_details.hpp:67
A class which finds all edges which are not OutsideEdge types.
Definition connectivity_details.hpp:57
A class to get the opposite edge of a grid line from one of the edges.
Definition connectivity_details.hpp:257
std::tuple< I... > type
The type found by the class.
Definition connectivity_details.hpp:92
A class to convert a type sequence to a tuple type.
Definition connectivity_details.hpp:85