forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12219 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
24f79216b1
commit
e4915201df
|
@ -176,6 +176,8 @@ void CommTiled::init()
|
|||
/* ----------------------------------------------------------------------
|
||||
setup spatial-decomposition communication patterns
|
||||
function of neighbor cutoff(s) & cutghostuser & current box size and tiling
|
||||
sets nsendproc, nrecvproc, sendproc, recvproc
|
||||
sets sendother, sendself, pbc_flag, pbc, sendbox
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::setup()
|
||||
|
@ -203,7 +205,12 @@ void CommTiled::setup()
|
|||
error->all(FLERR,"Communication cutoff for comm_style tiled "
|
||||
"cannot exceed periodic box length");
|
||||
|
||||
// allocate overlap
|
||||
// NOTE: allocate overlap (to Nprocs?)
|
||||
// NOTE: allocate 2nd dim of sendproc, recvproc, sendbox
|
||||
// NOTE: func pointers for box_drop and box_other
|
||||
// NOTE: write box_drop and box_other methods
|
||||
// NOTE: for tiled, must do one-time gather of RCB cuts and proc boxes
|
||||
|
||||
int *overlap;
|
||||
int noverlap,noverlap1,indexme;
|
||||
double lo1[3],hi1[3],lo2[3],hi2[3];
|
||||
|
@ -211,26 +218,43 @@ void CommTiled::setup()
|
|||
|
||||
nswap = 0;
|
||||
for (int idim = 0; idim < dimension; idim++) {
|
||||
for (int iswap = 0; iswap < 2; iswap++) {
|
||||
|
||||
// ghost box in lower direction
|
||||
|
||||
one = 1;
|
||||
lo1[0] = sublo[0]; lo1[1] = sublo[1]; lo1[2] = sublo[2];
|
||||
hi1[0] = subhi[0]; hi1[1] = subhi[1]; hi1[2] = subhi[2];
|
||||
if (iswap == 0) {
|
||||
lo1[idim] = sublo[idim] - cut;
|
||||
hi1[idim] = sublo[idim];
|
||||
} else {
|
||||
lo1[idim] = subhi[idim];
|
||||
hi1[idim] = subhi[idim] + cut;
|
||||
}
|
||||
|
||||
two = 0;
|
||||
if (periodicity[idim] && lo1[idim] < boxlo[idim]) {
|
||||
two = 1;
|
||||
if (iswap == 0 && periodicity[idim] && lo1[idim] < boxlo[idim]) two = 1;
|
||||
if (iswap == 1 && periodicity[idim] && hi1[idim] > boxhi[idim]) two = 1;
|
||||
|
||||
if (two) {
|
||||
lo2[0] = sublo[0]; lo2[1] = sublo[1]; lo2[2] = sublo[2];
|
||||
hi2[0] = subhi[0]; hi2[1] = subhi[1]; hi2[2] = subhi[2];
|
||||
if (iswap == 0) {
|
||||
lo2[idim] = lo1[idim] + prd[idim];
|
||||
hi2[idim] = hi1[idim] + prd[idim];
|
||||
if (sublo[idim] == boxlo[idim]) {
|
||||
one = 0;
|
||||
hi2[idim] = boxhi[idim];
|
||||
}
|
||||
} else {
|
||||
lo2[idim] = lo1[idim] - prd[idim];
|
||||
hi2[idim] = hi1[idim] - prd[idim];
|
||||
if (subhi[idim] == boxhi[idim]) {
|
||||
one = 0;
|
||||
lo2[idim] = boxlo[idim];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indexme = -1;
|
||||
|
@ -272,15 +296,22 @@ void CommTiled::setup()
|
|||
|
||||
nsendproc[nswap] = noverlap;
|
||||
for (i = 0; i < noverlap; i++) sendproc[nswap][i] = overlap[i];
|
||||
if (iswap == 0) {
|
||||
nrecvproc[nswap+1] = noverlap;
|
||||
for (i = 0; i < noverlap; i++) recvproc[nswap+1][i] = overlap[i];
|
||||
} else {
|
||||
nrecvproc[nswap-1] = noverlap;
|
||||
for (i = 0; i < noverlap; i++) recvproc[nswap-1][i] = overlap[i];
|
||||
}
|
||||
|
||||
// compute sendbox for each of my sends
|
||||
// ibox = intersection of ghostbox with other proc's sub-domain
|
||||
// sendbox = ibox displaced by cutoff in dim
|
||||
|
||||
// NOTE: need to extend send box in lower dims by cutoff
|
||||
// NOTE: this logic for overlapping boxes is not correct for sending
|
||||
// obox = intersection of ghostbox with other proc's sub-domain
|
||||
// sbox = what I need to send to other proc
|
||||
// = sublo to MIN(sublo+cut,subhi) in idim, for iswap = 0
|
||||
// = MIN(subhi-cut,sublo) to subhi in idim, for iswap = 1
|
||||
// = obox in other 2 dims
|
||||
// if sbox touches sub-box boundaries in lower dims,
|
||||
// extend sbox in those lower dims to include ghost atoms
|
||||
|
||||
double oboxlo[3],oboxhi[3],sbox[6];
|
||||
|
||||
|
@ -303,9 +334,6 @@ void CommTiled::setup()
|
|||
sbox[3] = MIN(oboxhi[0],hi1[0]);
|
||||
sbox[4] = MIN(oboxhi[1],hi1[1]);
|
||||
sbox[5] = MIN(oboxhi[2],hi1[2]);
|
||||
sbox[idim] += cut;
|
||||
sbox[3+idim] += cut;
|
||||
if (sbox[idim] == lo1[idim]) sbox[idim] = sublo[idim];
|
||||
} else {
|
||||
pbc_flag[nswap][i] = 1;
|
||||
pbc[nswap][i][idim] = 1;
|
||||
|
@ -315,9 +343,14 @@ void CommTiled::setup()
|
|||
sbox[3] = MIN(oboxhi[0],hi2[0]);
|
||||
sbox[4] = MIN(oboxhi[1],hi2[1]);
|
||||
sbox[5] = MIN(oboxhi[2],hi2[2]);
|
||||
sbox[idim] -= prd[idim] - cut;
|
||||
sbox[3+idim] -= prd[idim] + cut;
|
||||
if (sbox[idim] == lo1[idim]) sbox[idim] = sublo[idim];
|
||||
}
|
||||
|
||||
if (iswap == 0) {
|
||||
sbox[idim] = sublo[idim];
|
||||
sbox[3+idim] = MIN(sublo[idim]+cut,subhi[idim]);
|
||||
} else {
|
||||
sbox[idim] = MAX(subhi[idim]-cut,sublo[idim]);
|
||||
sbox[3+idim] = subhi[idim];
|
||||
}
|
||||
|
||||
if (idim >= 1) {
|
||||
|
@ -332,13 +365,8 @@ void CommTiled::setup()
|
|||
memcpy(sendbox[nswap][i],sbox,6*sizeof(double));
|
||||
}
|
||||
|
||||
// ghost box in upper direction
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nswap += 2;
|
||||
nswap++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1064,7 +1092,7 @@ int CommTiled::exchange_variable(int n, double *inbuf, double *&outbuf)
|
|||
/* ----------------------------------------------------------------------
|
||||
determine overlap list of Noverlap procs the lo/hi box overlaps
|
||||
overlap = non-zero area in common between box and proc sub-domain
|
||||
box is onwed by me and extends in dim
|
||||
box is owned by me and extends in dim
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::box_drop_uniform(int dim, double *lo, double *hi,
|
||||
|
@ -1086,7 +1114,8 @@ void CommTiled::box_drop_nonuniform(int dim, double *lo, double *hi,
|
|||
/* ----------------------------------------------------------------------
|
||||
determine overlap list of Noverlap procs the lo/hi box overlaps
|
||||
overlap = non-zero area in common between box and proc sub-domain
|
||||
recursive routine for traversing an RCB tree of cuts
|
||||
recursive method for traversing an RCB tree of cuts
|
||||
no need to split lo/hi box as recurse b/c OK if box extends outside RCB box
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void CommTiled::box_drop_tiled(double *lo, double *hi,
|
||||
|
@ -1103,7 +1132,7 @@ void CommTiled::box_drop_tiled(double *lo, double *hi,
|
|||
}
|
||||
|
||||
// drop box on each side of cut it extends beyond
|
||||
// use > and < criteria to not include procs it only touches
|
||||
// use > and < criteria so does not include a box it only touches
|
||||
// procmid = 1st processor in upper half of partition
|
||||
// = location in tree that stores this cut
|
||||
// dim = 0,1,2 dimension of cut
|
||||
|
|
Loading…
Reference in New Issue