17 #ifndef KOKKOS_BOXELEMPART_HPP 
   18 #define KOKKOS_BOXELEMPART_HPP 
   22 #include <Kokkos_Macros.hpp> 
   29 KOKKOS_INLINE_FUNCTION
 
   31                     const unsigned boxA[][2] ,
 
   32                     const unsigned boxB[][2] )
 
   34   for ( 
unsigned 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 unsigned local_box[][2] ,
 
   52                       const unsigned ghost_layer ,
 
   53                             unsigned ghost_box[][2] )
 
   55   for ( 
unsigned 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 unsigned global_rank ,
 
   63                     const unsigned global_box[][2] ,
 
   91                const unsigned global_size ,
 
   92                const unsigned global_rank ,
 
   93                const unsigned elem_nx ,
 
   94                const unsigned elem_ny ,
 
   95                const unsigned elem_nz );
 
   97   KOKKOS_INLINE_FUNCTION
 
  101   KOKKOS_INLINE_FUNCTION
 
  105   KOKKOS_INLINE_FUNCTION
 
  109   KOKKOS_INLINE_FUNCTION
 
  113   KOKKOS_INLINE_FUNCTION
 
  119   KOKKOS_INLINE_FUNCTION
 
  122                            const unsigned iz )
 const 
  129   KOKKOS_INLINE_FUNCTION
 
  133     const unsigned ny = m_uses_elem_box[1][1] - m_uses_elem_box[1][0] ;
 
  135     c[0] = m_uses_elem_box[0][0] + lid % nx ; lid /= nx ;
 
  136     c[1] = m_uses_elem_box[1][0] + lid % ny ; lid /= ny ;
 
  137     c[2] = m_uses_elem_box[2][0] + lid ;
 
  142   KOKKOS_INLINE_FUNCTION
 
  148   KOKKOS_INLINE_FUNCTION
 
  157     const unsigned ny = m_owns_node_box[
j][1][1] - m_owns_node_box[
j][1][0] ;
 
  159     coord[0] = m_owns_node_box[
j][0][0] + lid % nx ; lid /= nx ;
 
  160     coord[1] = m_owns_node_box[
j][1][0] + lid % ny ; lid /= ny ;
 
  161     coord[2] = m_owns_node_box[
j][2][0] + lid ;
 
  164   KOKKOS_INLINE_FUNCTION
 
  185   KOKKOS_INLINE_FUNCTION
 
  195   KOKKOS_INLINE_FUNCTION
 
  198   KOKKOS_INLINE_FUNCTION
 
  201   KOKKOS_INLINE_FUNCTION
 
  206   KOKKOS_INLINE_FUNCTION
 
  209   KOKKOS_INLINE_FUNCTION
 
  212   KOKKOS_INLINE_FUNCTION
 
  215   KOKKOS_INLINE_FUNCTION
 
  225   KOKKOS_INLINE_FUNCTION
 
  234     const unsigned ny = m_send_node_box[
j][1][1] - m_send_node_box[
j][1][0] ;
 
  238     c[0] = m_send_node_box[
j][0][0] + item % nx ; item /= nx ;
 
  239     c[1] = m_send_node_box[
j][1][0] + item % ny ; item /= ny ;
 
  240     c[2] = m_send_node_box[
j][2][0] + item ;
 
  250   void print( std::ostream & s ) 
const ;
 
  257   void local( 
const unsigned  rank ,
 
  258                     unsigned  uses_elem[][2] ,
 
  259                     unsigned  owns_node[][2] ,
 
  260                     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]