30 const unsigned global_rank ,
31 const unsigned global_box[][2] ,
34 box[0][0] = global_box[0][0] ; box[0][1] = global_box[0][1] ;
35 box[1][0] = global_box[1][0] ; box[1][1] = global_box[1][1] ;
36 box[2][0] = global_box[2][0] ; box[2][1] = global_box[2][1] ;
39 unsigned np = global_size ;
48 const unsigned part = ( 0 == ( np % 5 ) ) ? 5 : (
49 ( 0 == ( np % 3 ) ) ? 3 : 2 );
51 const unsigned portion = np / part ;
53 if ( 2 < part || global_rank < ip + portion ) {
54 jip = portion * size_t(
double( global_rank - ip ) /
double(portion) );
65 const unsigned nb[3] = {
66 box[0][1] - box[0][0] ,
67 box[1][1] - box[1][0] ,
68 box[2][1] - box[2][0] };
70 const unsigned axis = nb[2] > nb[1] ? ( nb[2] > nb[0] ? 2 : 0 )
71 : ( nb[1] > nb[0] ? 1 : 0 );
73 box[ axis ][1] = box[ axis ][0] + unsigned(
double(nb[axis]) * (
double(jup) /
double(np) ));
74 box[ axis ][0] = box[ axis ][0] + unsigned(
double(nb[axis]) * (
double(jip) /
double(np) ));
90 unsigned uses_elem[][2] ,
91 unsigned owns_node[][2] ,
92 unsigned uses_node[][2] )
const
98 for (
unsigned i = 0 ;
i < 3 ; ++
i ) {
99 owns_node[
i][0] = uses_elem[
i][0] ;
105 const unsigned global_vert[3][2] =
112 for (
unsigned i = 0 ;
i < 3 ; ++
i ) {
113 uses_elem[
i][0] = global_vert[
i][0] == owns_node[
i][0] ? owns_node[
i][0] : owns_node[
i][0] - 1 ;
114 uses_elem[
i][1] = global_vert[
i][1] == owns_node[
i][1] ? owns_node[
i][1] - 1 : owns_node[
i][1] ;
118 for (
unsigned i = 0 ;
i < 3 ; ++
i ) {
119 uses_node[
i][0] = uses_elem[
i][0] ;
120 uses_node[
i][1] = uses_elem[
i][1] + 1 ;
124 for (
unsigned i = 0 ;
i < 3 ; ++
i ) {
125 owns_node[
i][0] = 2 * owns_node[
i][0] ;
126 uses_node[
i][0] = 2 * uses_node[
i][0] ;
127 owns_node[
i][1] = 2 * owns_node[
i][1] - 1 ;
128 uses_node[
i][1] = 2 * uses_node[
i][1] - 1 ;
136 const unsigned global_size ,
137 const unsigned global_rank ,
138 const unsigned elem_nx ,
139 const unsigned elem_ny ,
140 const unsigned elem_nz )
185 const unsigned rank = (
m_global_rank + rr ) % m_global_size ;
187 unsigned elem_box[3][2] , o_node_box[3][2] , u_node_box[3][2] ;
190 local( rank , elem_box , o_node_box , u_node_box );
214 unsigned test_box[3][2] ;
228 <<
" owns_node[" << rank <<
"]{"
229 <<
" [" << o_node_box[0][0] <<
"," << o_node_box[0][1] <<
")"
230 <<
" [" << o_node_box[1][0] <<
"," << o_node_box[1][1] <<
")"
231 <<
" [" << o_node_box[2][0] <<
"," << o_node_box[2][1] <<
")"
232 <<
"}" << std::endl ;
247 <<
" ElemBox[" << rank <<
"]{"
248 <<
" [" << elem_box[0][0] <<
"," << elem_box[0][1] <<
")"
249 <<
" [" << elem_box[1][0] <<
"," << elem_box[1][1] <<
")"
250 <<
" [" << elem_box[2][0] <<
"," << elem_box[2][1] <<
")"
251 <<
"}" << std::endl ;
277 <<
" error count = " << count << std::endl ;
281 if ( global_node_count != node_count ) {
282 std::cout <<
"Node count = " << global_node_count <<
" overlap error count = " << node_count << std::endl ;
285 if (
DecomposeElem == decompose && global_elem_count != elem_count ) {
286 std::cout <<
"Elem count = " << global_elem_count <<
" overlap error count = " << elem_count << std::endl ;
321 <<
" recv node_box {"
331 <<
" 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