8#ifndef SRC_GRID_ITERATORS_GRID_DIST_ID_ITERATOR_UTIL_HPP_
9#define SRC_GRID_ITERATORS_GRID_DIST_ID_ITERATOR_UTIL_HPP_
23template<
typename Decomposition>
31 if (gdb_ext.get(g_c).Dbox.isValid() ==
false)
36 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
38 long int start_p = gdb_ext.get(g_c).Dbox.getP1().get(i) + gdb_ext.get(g_c).origin.get(i);
39 long int stop_p = gdb_ext.get(g_c).Dbox.getP2().get(i) + gdb_ext.get(g_c).origin.get(i);
40 if (start.
get(i) <= start_p)
41 {start_c.
set_d(i,gdb_ext.get(g_c).Dbox.getP1().get(i));}
42 else if (start.
get(i) <= stop_p)
43 {start_c.
set_d(i,start.
get(i) - gdb_ext.get(g_c).origin.get(i));}
47 if (stop.
get(i) >= stop_p)
48 {stop_c.
set_d(i,gdb_ext.get(g_c).Dbox.getP2().get(i));}
49 else if (stop.
get(i) >= start_p)
50 {stop_c.
set_d(i,stop.
get(i) - gdb_ext.get(g_c).origin.get(i));}
69template<
typename Decomposition>
79 for (
size_t i = 0 ; i < Decomposition::dims ; i++)
81 long int start_p = gdb_ext.get(g_c).GDbox.getP1().get(i) + gdb_ext.get(g_c).origin.get(i);
82 long int stop_p = gdb_ext.get(g_c).GDbox.getP2().get(i) + gdb_ext.get(g_c).origin.get(i);
83 if (start.
get(i) < start_p)
84 {start_c.
set_d(i,gdb_ext.get(g_c).GDbox.getP1().get(i));}
85 else if (start.
get(i) <= stop_p)
86 {start_c.
set_d(i,start.
get(i) - gdb_ext.get(g_c).origin.get(i));}
90 if (stop.
get(i) > stop_p)
91 {stop_c.
set_d(i,gdb_ext.get(g_c).GDbox.getP2().get(i));}
92 else if (stop.
get(i) >= start_p)
93 {stop_c.
set_d(i,stop.
get(i) - gdb_ext.get(g_c).origin.get(i));}
101template<
typename Decomposition,
bool ghost_or_domain>
109 if (ghost_or_domain ==
false)
110 {
return compute_subset_domain<Decomposition>(gdb_ext,g_c,start,stop,start_c,stop_c);}
112 return compute_subset_ghost<Decomposition>(gdb_ext,g_c,start,stop,start_c,stop_c);
grid_key_dx is the key to access any element in the grid
__device__ __host__ void set_d(index_type i, index_type id)
Set the i index.
__device__ __host__ index_type get(index_type i) const
Get the i index.
Implementation of 1-D std::vector like structure.
This structure store the Box that define the domain inside the Ghost + domain box.