44 #ifndef KOKKOS_BOXELEMPART_HPP
45 #define KOKKOS_BOXELEMPART_HPP
49 #include <Kokkos_Macros.hpp>
56 KOKKOS_INLINE_FUNCTION
58 const size_t boxA[][2] ,
59 const size_t boxB[][2] )
61 for (
int i = 0 ; i < 3 ; ++i ) {
62 box[i][0] = boxA[i][0] > boxB[i][0] ? boxA[i][0] : boxB[i][0] ;
63 box[i][1] = boxA[i][1] < boxB[i][1] ? boxA[i][1] : boxB[i][1] ;
64 if ( box[i][0] > box[i][1] ) box[i][1] = box[i][0] ;
68 KOKKOS_INLINE_FUNCTION
71 return size_t( box[0][1] - box[0][0] ) *
72 size_t( box[1][1] - box[1][0] ) *
73 size_t( box[2][1] - box[2][0] );
76 KOKKOS_INLINE_FUNCTION
78 const size_t local_box[][2] ,
79 const size_t ghost_layer ,
80 size_t ghost_box[][2] )
82 for (
int i = 0 ; i < 3 ; ++i ) {
83 ghost_box[i][0] = global_box[i][0] + ghost_layer > local_box[i][0] ? global_box[i][0] : local_box[i][0] - ghost_layer ;
84 ghost_box[i][1] = global_box[i][1] < local_box[i][1] + ghost_layer ? global_box[i][1] : local_box[i][1] + ghost_layer ;
89 const size_t global_rank ,
90 const size_t global_box[][2] ,
120 const size_t global_size ,
121 const size_t global_rank ,
122 const size_t elem_nx ,
123 const size_t elem_ny ,
124 const size_t elem_nz );
126 KOKKOS_INLINE_FUNCTION
130 KOKKOS_INLINE_FUNCTION
134 KOKKOS_INLINE_FUNCTION
138 KOKKOS_INLINE_FUNCTION
142 KOKKOS_INLINE_FUNCTION
148 KOKKOS_INLINE_FUNCTION
151 const size_t iz )
const
158 KOKKOS_INLINE_FUNCTION
162 const size_t ny = m_uses_elem_box[1][1] - m_uses_elem_box[1][0] ;
164 c[0] = m_uses_elem_box[0][0] + lid % nx ; lid /= nx ;
165 c[1] = m_uses_elem_box[1][0] + lid % ny ; lid /= ny ;
166 c[2] = m_uses_elem_box[2][0] + lid ;
171 KOKKOS_INLINE_FUNCTION
177 KOKKOS_INLINE_FUNCTION
186 const size_t ny = m_owns_node_box[
j][1][1] - m_owns_node_box[
j][1][0] ;
188 coord[0] = m_owns_node_box[
j][0][0] + lid % nx ; lid /= nx ;
189 coord[1] = m_owns_node_box[
j][1][0] + lid % ny ; lid /= ny ;
190 coord[2] = m_owns_node_box[
j][2][0] + lid ;
193 KOKKOS_INLINE_FUNCTION
214 KOKKOS_INLINE_FUNCTION
224 KOKKOS_INLINE_FUNCTION
227 KOKKOS_INLINE_FUNCTION
230 KOKKOS_INLINE_FUNCTION
235 KOKKOS_INLINE_FUNCTION
238 KOKKOS_INLINE_FUNCTION
241 KOKKOS_INLINE_FUNCTION
244 KOKKOS_INLINE_FUNCTION
254 KOKKOS_INLINE_FUNCTION
263 const size_t ny = m_send_node_box[
j][1][1] - m_send_node_box[
j][1][0] ;
267 c[0] = m_send_node_box[
j][0][0] + item % nx ; item /= nx ;
268 c[1] = m_send_node_box[
j][1][0] + item % ny ; item /= ny ;
269 c[2] = m_send_node_box[
j][2][0] + item ;
279 void print( std::ostream & s )
const ;
286 void local(
const size_t rank ,
287 size_t uses_elem[][2] ,
288 size_t owns_node[][2] ,
289 size_t uses_node[][2] )
const ;
KOKKOS_INLINE_FUNCTION size_t local_node_id(const size_t c[]) const
unsigned m_send_node_count
unsigned m_send_node_box[PROC_NEIGH_MAX][3][2]
KOKKOS_INLINE_FUNCTION size_t send_node_rank(size_t msg) const
KOKKOS_INLINE_FUNCTION size_t uses_elem_count() const
KOKKOS_INLINE_FUNCTION size_t global_coord_max(size_t axis) const
KOKKOS_INLINE_FUNCTION size_t global_elem_count() const
KOKKOS_INLINE_FUNCTION size_t uses_elem_offset(const size_t ix, const size_t iy, const size_t iz) const
unsigned m_owns_node[PROC_NEIGH_MAX][2]
unsigned m_uses_elem_box[3][2]
void print(std::ostream &s) const
unsigned m_owns_node_count
KOKKOS_INLINE_FUNCTION size_t send_node_msg_count() const
BoxElemPart(const ElemOrder elem_order, const Decompose decompose, const unsigned global_size, const unsigned global_rank, const unsigned elem_nx, const unsigned elem_ny, const unsigned elem_nz)
KOKKOS_INLINE_FUNCTION size_t global_node_id(const size_t c[]) const
unsigned m_global_elem_box[3][2]
KOKKOS_INLINE_FUNCTION size_t recv_node_rank(size_t msg) const
KOKKOS_INLINE_FUNCTION size_t box_count(const unsigned box[][2])
KOKKOS_INLINE_FUNCTION size_t uses_node_count() const
KOKKOS_INLINE_FUNCTION void box_ghost_layer(const unsigned global_box[][2], const unsigned local_box[][2], const unsigned ghost_layer, unsigned ghost_box[][2])
KOKKOS_INLINE_FUNCTION size_t recv_node_count(size_t msg) const
KOKKOS_INLINE_FUNCTION void local_node_coord(size_t lid, size_t coord[]) const
void box_partition(const unsigned global_size, const unsigned global_rank, const unsigned global_box[][2], unsigned box[][2])
KOKKOS_INLINE_FUNCTION void box_intersect(unsigned box[][2], const unsigned boxA[][2], const unsigned boxB[][2])
KOKKOS_INLINE_FUNCTION size_t send_node_id_count() const
KOKKOS_INLINE_FUNCTION size_t owns_node_count() const
unsigned m_global_node_box[3][2]
KOKKOS_INLINE_FUNCTION size_t send_node_count(size_t msg) const
KOKKOS_INLINE_FUNCTION size_t send_node_id(size_t item) const
unsigned m_uses_node_box[3][2]
KOKKOS_INLINE_FUNCTION size_t recv_node_msg_count() const
unsigned m_owns_node_box[PROC_NEIGH_MAX][3][2]
void local(const unsigned rank, unsigned uses_elem[][2], unsigned owns_node[][2], unsigned uses_node[][2]) const
KOKKOS_INLINE_FUNCTION size_t global_node_count() const
KOKKOS_INLINE_FUNCTION void uses_elem_coord(size_t lid, size_t c[]) const
unsigned m_send_node[PROC_NEIGH_MAX][2]