57 const unsigned global_rank ,
58 const unsigned global_box[][2] ,
61 box[0][0] = global_box[0][0] ; box[0][1] = global_box[0][1] ;
62 box[1][0] = global_box[1][0] ; box[1][1] = global_box[1][1] ;
63 box[2][0] = global_box[2][0] ; box[2][1] = global_box[2][1] ;
66 unsigned np = global_size ;
75 const unsigned part = ( 0 == ( np % 5 ) ) ? 5 : (
76 ( 0 == ( np % 3 ) ) ? 3 : 2 );
78 const unsigned portion = np / part ;
80 if ( 2 < part || global_rank < ip + portion ) {
81 jip = portion * size_t(
double( global_rank - ip ) /
double(portion) );
92 const unsigned nb[3] = {
93 box[0][1] - box[0][0] ,
94 box[1][1] - box[1][0] ,
95 box[2][1] - box[2][0] };
97 const unsigned axis = nb[2] > nb[1] ? ( nb[2] > nb[0] ? 2 : 0 )
98 : ( nb[1] > nb[0] ? 1 : 0 );
100 box[ axis ][1] = box[ axis ][0] + unsigned(
double(nb[axis]) * (
double(jup) /
double(np) ));
101 box[ axis ][0] = box[ axis ][0] + unsigned(
double(nb[axis]) * (
double(jip) /
double(np) ));
117 unsigned uses_elem[][2] ,
118 unsigned owns_node[][2] ,
119 unsigned uses_node[][2] )
const
125 for (
unsigned i = 0 ; i < 3 ; ++i ) {
126 owns_node[i][0] = uses_elem[i][0] ;
127 owns_node[i][1] = uses_elem[i][1] + (
m_global_elem_box[i][1] == uses_elem[i][1] ? 1 : 0 );
132 const unsigned global_vert[3][2] =
139 for (
unsigned i = 0 ; i < 3 ; ++i ) {
140 uses_elem[i][0] = global_vert[i][0] == owns_node[i][0] ? owns_node[i][0] : owns_node[i][0] - 1 ;
141 uses_elem[i][1] = global_vert[i][1] == owns_node[i][1] ? owns_node[i][1] - 1 : owns_node[i][1] ;
145 for (
unsigned i = 0 ; i < 3 ; ++i ) {
146 uses_node[i][0] = uses_elem[i][0] ;
147 uses_node[i][1] = uses_elem[i][1] + 1 ;
151 for (
unsigned i = 0 ; i < 3 ; ++i ) {
152 owns_node[i][0] = 2 * owns_node[i][0] ;
153 uses_node[i][0] = 2 * uses_node[i][0] ;
154 owns_node[i][1] = 2 * owns_node[i][1] - 1 ;
155 uses_node[i][1] = 2 * uses_node[i][1] - 1 ;
163 const unsigned global_size ,
164 const unsigned global_rank ,
165 const unsigned elem_nx ,
166 const unsigned elem_ny ,
167 const unsigned elem_nz )
212 const unsigned rank = (
m_global_rank + rr ) % m_global_size ;
214 unsigned elem_box[3][2] , o_node_box[3][2] , u_node_box[3][2] ;
217 local( rank , elem_box , o_node_box , u_node_box );
241 unsigned test_box[3][2] ;
255 <<
" owns_node[" << rank <<
"]{"
256 <<
" [" << o_node_box[0][0] <<
"," << o_node_box[0][1] <<
")"
257 <<
" [" << o_node_box[1][0] <<
"," << o_node_box[1][1] <<
")"
258 <<
" [" << o_node_box[2][0] <<
"," << o_node_box[2][1] <<
")"
259 <<
"}" << std::endl ;
274 <<
" ElemBox[" << rank <<
"]{"
275 <<
" [" << elem_box[0][0] <<
"," << elem_box[0][1] <<
")"
276 <<
" [" << elem_box[1][0] <<
"," << elem_box[1][1] <<
")"
277 <<
" [" << elem_box[2][0] <<
"," << elem_box[2][1] <<
")"
278 <<
"}" << std::endl ;
304 <<
" error count = " << count << std::endl ;
308 if ( global_node_count != node_count ) {
309 std::cout <<
"Node count = " << global_node_count <<
" overlap error count = " << node_count << std::endl ;
312 if (
DecomposeElem == decompose && global_elem_count != elem_count ) {
313 std::cout <<
"Elem count = " << global_elem_count <<
" overlap error count = " << elem_count << std::endl ;
319 s <<
"BoxElemPart P[" <<
m_global_rank <<
":" << m_global_size <<
"]"
348 <<
" recv node_box {"
358 <<
" send node_box {"
unsigned m_send_node_count
unsigned m_owns_node[PROC_NEIGH_MAX][2]
KOKKOS_INLINE_FUNCTION size_t global_elem_count() const
void print(std::ostream &s) const
unsigned m_owns_node_count
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 box_count(const unsigned box[][2])
unsigned m_send_node_box[PROC_NEIGH_MAX][3][2]
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])
unsigned m_send_node[PROC_NEIGH_MAX][2]
unsigned m_owns_node_box[PROC_NEIGH_MAX][3][2]
unsigned m_global_elem_box[3][2]
unsigned m_uses_node_box[3][2]
unsigned m_uses_elem_box[3][2]
unsigned m_global_node_box[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