57 const size_t global_rank ,
58 const size_t 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 size_t np = global_size ;
75 const size_t part = ( 0 == ( np % 5 ) ) ? 5 : (
76 ( 0 == ( np % 3 ) ) ? 3 : 2 );
78 const size_t portion = np / part ;
80 if ( 2 < part || global_rank < ip + portion ) {
81 jip = portion * size_t(
double( global_rank - ip ) /
double(portion) );
92 const size_t 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 int 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] + size_t(
double(nb[axis]) * (
double(jup) /
double(np) ));
101 box[ axis ][0] = box[ axis ][0] + size_t(
double(nb[axis]) * (
double(jip) /
double(np) ));
117 size_t uses_elem[][2] ,
118 size_t owns_node[][2] ,
119 size_t uses_node[][2] )
const
125 for (
int 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 size_t global_vert[3][2] =
139 for (
int 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 (
int 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 (
int 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 size_t global_size ,
164 const size_t global_rank ,
165 const size_t elem_nx ,
166 const size_t elem_ny ,
167 const size_t elem_nz )
221 size_t elem_box[3][2] , o_node_box[3][2] , u_node_box[3][2] ;
224 local( rank , elem_box , o_node_box , u_node_box );
234 std::cout <<
"BoxElemPart exceeded maximum neighbor count" << std::endl ;
252 std::cout <<
"BoxElemPart exceeded maximum neighbor count" << std::endl ;
263 size_t test_box[3][2] ;
272 std::cout <<
"Box partitioning error" << std::endl ;
278 <<
" owns_node[" << rank <<
"]{"
279 <<
" [" << o_node_box[0][0] <<
"," << o_node_box[0][1] <<
")"
280 <<
" [" << o_node_box[1][0] <<
"," << o_node_box[1][1] <<
")"
281 <<
" [" << o_node_box[2][0] <<
"," << o_node_box[2][1] <<
")"
282 <<
"}" << std::endl ;
293 std::cout <<
"Box partitioning error" << std::endl ;
299 <<
" ElemBox[" << rank <<
"]{"
300 <<
" [" << elem_box[0][0] <<
"," << elem_box[0][1] <<
")"
301 <<
" [" << elem_box[1][0] <<
"," << elem_box[1][1] <<
")"
302 <<
" [" << elem_box[2][0] <<
"," << elem_box[2][1] <<
")"
303 <<
"}" << std::endl ;
331 <<
" error count = " << count << std::endl ;
336 if ( global_node_count != node_count ) {
337 std::cout <<
"Node count = " << global_node_count <<
" overlap error count = " << node_count << std::endl ;
341 if (
DecomposeElem == decompose && global_elem_count != elem_count ) {
342 std::cout <<
"Elem count = " << global_elem_count <<
" overlap error count = " << elem_count << std::endl ;
347 for (
int i = 0 ; i < 3 ; ++i ) {
for (
int j = 0 ;
j < 2 ; ++
j ) {
389 <<
" recv node_box {"
399 <<
" send node_box {"
unsigned m_send_node_count
unsigned m_send_node_box[PROC_NEIGH_MAX][3][2]
KOKKOS_INLINE_FUNCTION size_t global_elem_count() 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
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 box_count(const unsigned box[][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_global_node_box[3][2]
unsigned m_uses_node_box[3][2]
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]