44 #ifndef KOKKOS_BOXELEMPART_HPP
45 #define KOKKOS_BOXELEMPART_HPP
49 #include <Kokkos_Macros.hpp>
56 KOKKOS_INLINE_FUNCTION
58 const unsigned boxA[][2] ,
59 const unsigned boxB[][2] )
61 for (
unsigned 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 unsigned local_box[][2] ,
79 const unsigned ghost_layer ,
80 unsigned ghost_box[][2] )
82 for (
unsigned 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 unsigned global_rank ,
90 const unsigned global_box[][2] ,
118 const unsigned global_size ,
119 const unsigned global_rank ,
120 const unsigned elem_nx ,
121 const unsigned elem_ny ,
122 const unsigned elem_nz );
124 KOKKOS_INLINE_FUNCTION
128 KOKKOS_INLINE_FUNCTION
132 KOKKOS_INLINE_FUNCTION
136 KOKKOS_INLINE_FUNCTION
140 KOKKOS_INLINE_FUNCTION
146 KOKKOS_INLINE_FUNCTION
149 const unsigned iz )
const
156 KOKKOS_INLINE_FUNCTION
160 const unsigned ny = m_uses_elem_box[1][1] - m_uses_elem_box[1][0] ;
162 c[0] = m_uses_elem_box[0][0] + lid % nx ; lid /= nx ;
163 c[1] = m_uses_elem_box[1][0] + lid % ny ; lid /= ny ;
164 c[2] = m_uses_elem_box[2][0] + lid ;
169 KOKKOS_INLINE_FUNCTION
175 KOKKOS_INLINE_FUNCTION
184 const unsigned ny = m_owns_node_box[
j][1][1] - m_owns_node_box[
j][1][0] ;
186 coord[0] = m_owns_node_box[
j][0][0] + lid % nx ; lid /= nx ;
187 coord[1] = m_owns_node_box[
j][1][0] + lid % ny ; lid /= ny ;
188 coord[2] = m_owns_node_box[
j][2][0] + lid ;
191 KOKKOS_INLINE_FUNCTION
212 KOKKOS_INLINE_FUNCTION
222 KOKKOS_INLINE_FUNCTION
225 KOKKOS_INLINE_FUNCTION
228 KOKKOS_INLINE_FUNCTION
233 KOKKOS_INLINE_FUNCTION
236 KOKKOS_INLINE_FUNCTION
239 KOKKOS_INLINE_FUNCTION
242 KOKKOS_INLINE_FUNCTION
252 KOKKOS_INLINE_FUNCTION
261 const unsigned ny = m_send_node_box[
j][1][1] - m_send_node_box[
j][1][0] ;
265 c[0] = m_send_node_box[
j][0][0] + item % nx ; item /= nx ;
266 c[1] = m_send_node_box[
j][1][0] + item % ny ; item /= ny ;
267 c[2] = m_send_node_box[
j][2][0] + item ;
277 void print( std::ostream & s )
const ;
284 void local(
const unsigned rank ,
285 unsigned uses_elem[][2] ,
286 unsigned owns_node[][2] ,
287 unsigned uses_node[][2] )
const ;
unsigned m_send_node_count
unsigned m_send_node_box[PROC_NEIGH_MAX][3][2]
KOKKOS_INLINE_FUNCTION void uses_elem_coord(size_t lid, unsigned c[]) const
KOKKOS_INLINE_FUNCTION size_t uses_elem_count() const
KOKKOS_INLINE_FUNCTION unsigned send_node_count(unsigned msg) const
KOKKOS_INLINE_FUNCTION unsigned local_node_id(const unsigned c[]) const
KOKKOS_INLINE_FUNCTION size_t global_node_id(const unsigned c[]) const
KOKKOS_INLINE_FUNCTION size_t global_elem_count() const
unsigned m_owns_node[PROC_NEIGH_MAX][2]
unsigned m_uses_elem_box[3][2]
KOKKOS_INLINE_FUNCTION unsigned send_node_id_count() const
void print(std::ostream &s) const
unsigned m_owns_node_count
KOKKOS_INLINE_FUNCTION unsigned send_node_id(unsigned item) 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)
unsigned m_global_elem_box[3][2]
KOKKOS_INLINE_FUNCTION size_t uses_elem_offset(const unsigned ix, const unsigned iy, const unsigned iz) const
KOKKOS_INLINE_FUNCTION unsigned recv_node_msg_count() 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 void local_node_coord(size_t lid, unsigned 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 owns_node_count() const
KOKKOS_INLINE_FUNCTION unsigned send_node_msg_count() const
unsigned m_global_node_box[3][2]
unsigned m_uses_node_box[3][2]
KOKKOS_INLINE_FUNCTION unsigned send_node_rank(unsigned msg) const
KOKKOS_INLINE_FUNCTION unsigned recv_node_count(unsigned msg) const
KOKKOS_INLINE_FUNCTION unsigned global_coord_max(unsigned axis) const
KOKKOS_INLINE_FUNCTION unsigned recv_node_rank(unsigned msg) const
Partition a box of hexahedral elements among subdomains.
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
unsigned m_send_node[PROC_NEIGH_MAX][2]