17 #ifndef KOKKOS_BOXELEMPART_HPP
18 #define KOKKOS_BOXELEMPART_HPP
22 #include <Kokkos_Macros.hpp>
29 KOKKOS_INLINE_FUNCTION
31 const size_t boxA[][2] ,
32 const size_t boxB[][2] )
34 for (
int i = 0 ; i < 3 ; ++i ) {
35 box[i][0] = boxA[i][0] > boxB[i][0] ? boxA[i][0] : boxB[i][0] ;
36 box[i][1] = boxA[i][1] < boxB[i][1] ? boxA[i][1] : boxB[i][1] ;
37 if ( box[i][0] > box[i][1] ) box[i][1] = box[i][0] ;
41 KOKKOS_INLINE_FUNCTION
44 return size_t( box[0][1] - box[0][0] ) *
45 size_t( box[1][1] - box[1][0] ) *
46 size_t( box[2][1] - box[2][0] );
49 KOKKOS_INLINE_FUNCTION
51 const size_t local_box[][2] ,
52 const size_t ghost_layer ,
53 size_t ghost_box[][2] )
55 for (
int i = 0 ; i < 3 ; ++i ) {
56 ghost_box[i][0] = global_box[i][0] + ghost_layer > local_box[i][0] ? global_box[i][0] : local_box[i][0] - ghost_layer ;
57 ghost_box[i][1] = global_box[i][1] < local_box[i][1] + ghost_layer ? global_box[i][1] : local_box[i][1] + ghost_layer ;
62 const size_t global_rank ,
63 const size_t global_box[][2] ,
93 const size_t global_size ,
94 const size_t global_rank ,
95 const size_t elem_nx ,
96 const size_t elem_ny ,
97 const size_t elem_nz );
99 KOKKOS_INLINE_FUNCTION
103 KOKKOS_INLINE_FUNCTION
107 KOKKOS_INLINE_FUNCTION
111 KOKKOS_INLINE_FUNCTION
115 KOKKOS_INLINE_FUNCTION
121 KOKKOS_INLINE_FUNCTION
124 const size_t iz )
const
131 KOKKOS_INLINE_FUNCTION
135 const size_t ny = m_uses_elem_box[1][1] - m_uses_elem_box[1][0] ;
137 c[0] = m_uses_elem_box[0][0] + lid % nx ; lid /= nx ;
138 c[1] = m_uses_elem_box[1][0] + lid % ny ; lid /= ny ;
139 c[2] = m_uses_elem_box[2][0] + lid ;
144 KOKKOS_INLINE_FUNCTION
150 KOKKOS_INLINE_FUNCTION
159 const size_t ny = m_owns_node_box[
j][1][1] - m_owns_node_box[
j][1][0] ;
161 coord[0] = m_owns_node_box[
j][0][0] + lid % nx ; lid /= nx ;
162 coord[1] = m_owns_node_box[
j][1][0] + lid % ny ; lid /= ny ;
163 coord[2] = m_owns_node_box[
j][2][0] + lid ;
166 KOKKOS_INLINE_FUNCTION
187 KOKKOS_INLINE_FUNCTION
197 KOKKOS_INLINE_FUNCTION
200 KOKKOS_INLINE_FUNCTION
203 KOKKOS_INLINE_FUNCTION
208 KOKKOS_INLINE_FUNCTION
211 KOKKOS_INLINE_FUNCTION
214 KOKKOS_INLINE_FUNCTION
217 KOKKOS_INLINE_FUNCTION
227 KOKKOS_INLINE_FUNCTION
236 const size_t ny = m_send_node_box[
j][1][1] - m_send_node_box[
j][1][0] ;
240 c[0] = m_send_node_box[
j][0][0] + item % nx ; item /= nx ;
241 c[1] = m_send_node_box[
j][1][0] + item % ny ; item /= ny ;
242 c[2] = m_send_node_box[
j][2][0] + item ;
252 void print( std::ostream & s )
const ;
259 void local(
const size_t rank ,
260 size_t uses_elem[][2] ,
261 size_t owns_node[][2] ,
262 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]