git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12225 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -70,9 +70,9 @@ CommTiled::CommTiled(LAMMPS *lmp, Comm *oldcomm) : Comm(*oldcomm)
|
|||||||
|
|
||||||
CommTiled::~CommTiled()
|
CommTiled::~CommTiled()
|
||||||
{
|
{
|
||||||
memory->destroy(overlap);
|
|
||||||
memory->destroy(buf_send);
|
memory->destroy(buf_send);
|
||||||
memory->destroy(buf_recv);
|
memory->destroy(buf_recv);
|
||||||
|
memory->destroy(overlap);
|
||||||
deallocate_swap(nswap);
|
deallocate_swap(nswap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +83,6 @@ CommTiled::~CommTiled()
|
|||||||
|
|
||||||
void CommTiled::init_buffers()
|
void CommTiled::init_buffers()
|
||||||
{
|
{
|
||||||
memory->create(overlap,nprocs,"comm:overlap");
|
|
||||||
|
|
||||||
maxexchange = maxexchange_atom + maxexchange_fix;
|
maxexchange = maxexchange_atom + maxexchange_fix;
|
||||||
bufextra = maxexchange + BUFEXTRA;
|
bufextra = maxexchange + BUFEXTRA;
|
||||||
|
|
||||||
@ -93,6 +91,9 @@ void CommTiled::init_buffers()
|
|||||||
maxrecv = BUFMIN;
|
maxrecv = BUFMIN;
|
||||||
memory->create(buf_recv,maxrecv,"comm:buf_recv");
|
memory->create(buf_recv,maxrecv,"comm:buf_recv");
|
||||||
|
|
||||||
|
maxoverlap = 0;
|
||||||
|
overlap = NULL;
|
||||||
|
|
||||||
nswap = 2 * domain->dimension;
|
nswap = 2 * domain->dimension;
|
||||||
allocate_swap(nswap);
|
allocate_swap(nswap);
|
||||||
}
|
}
|
||||||
@ -174,13 +175,16 @@ void CommTiled::setup()
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// domain properties used in setup and methods it calls
|
||||||
|
|
||||||
|
prd = domain->prd;
|
||||||
|
boxlo = domain->boxlo;
|
||||||
|
boxhi = domain->boxhi;
|
||||||
|
sublo = domain->sublo;
|
||||||
|
subhi = domain->subhi;
|
||||||
|
|
||||||
int dimension = domain->dimension;
|
int dimension = domain->dimension;
|
||||||
int *periodicity = domain->periodicity;
|
int *periodicity = domain->periodicity;
|
||||||
double *prd = domain->prd;
|
|
||||||
double *boxlo = domain->boxlo;
|
|
||||||
double *boxhi = domain->boxhi;
|
|
||||||
double *sublo = domain->sublo;
|
|
||||||
double *subhi = domain->subhi;
|
|
||||||
|
|
||||||
// set function pointers
|
// set function pointers
|
||||||
|
|
||||||
@ -220,7 +224,7 @@ void CommTiled::setup()
|
|||||||
// sets nsendproc, nrecvproc, sendproc, recvproc
|
// sets nsendproc, nrecvproc, sendproc, recvproc
|
||||||
// sets sendother, sendself, pbc_flag, pbc, sendbox
|
// sets sendother, sendself, pbc_flag, pbc, sendbox
|
||||||
|
|
||||||
int noverlap,noverlap1,indexme;
|
int noverlap1,indexme;
|
||||||
double lo1[3],hi1[3],lo2[3],hi2[3];
|
double lo1[3],hi1[3],lo2[3],hi2[3];
|
||||||
int one,two;
|
int one,two;
|
||||||
|
|
||||||
@ -273,9 +277,9 @@ void CommTiled::setup()
|
|||||||
|
|
||||||
indexme = -1;
|
indexme = -1;
|
||||||
noverlap = 0;
|
noverlap = 0;
|
||||||
if (one) (this->*box_drop)(idim,lo1,hi1,noverlap,indexme);
|
if (one) (this->*box_drop)(idim,lo1,hi1,indexme);
|
||||||
noverlap1 = noverlap;
|
noverlap1 = noverlap;
|
||||||
if (two) (this->*box_drop)(idim,lo2,hi2,noverlap,indexme);
|
if (two) (this->*box_drop)(idim,lo2,hi2,indexme);
|
||||||
|
|
||||||
// if self is in overlap list, move it to end of list
|
// if self is in overlap list, move it to end of list
|
||||||
|
|
||||||
@ -1101,17 +1105,10 @@ int CommTiled::exchange_variable(int n, double *inbuf, double *&outbuf)
|
|||||||
box is owned by me and extends in dim
|
box is owned by me and extends in dim
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void CommTiled::box_drop_brick(int idim, double *lo, double *hi,
|
void CommTiled::box_drop_brick(int idim, double *lo, double *hi, int &indexme)
|
||||||
int &noverlap, int &indexme)
|
|
||||||
{
|
{
|
||||||
// NOTE: this is not triclinic compatible
|
// NOTE: this is not triclinic compatible
|
||||||
|
|
||||||
double *prd = domain->prd;
|
|
||||||
double *boxlo = domain->boxlo;
|
|
||||||
double *boxhi = domain->boxhi;
|
|
||||||
double *sublo = domain->sublo;
|
|
||||||
double *subhi = domain->subhi;
|
|
||||||
|
|
||||||
int index,dir;
|
int index,dir;
|
||||||
if (hi[idim] == sublo[idim]) {
|
if (hi[idim] == sublo[idim]) {
|
||||||
index = myloc[idim] - 1;
|
index = myloc[idim] - 1;
|
||||||
@ -1153,6 +1150,11 @@ void CommTiled::box_drop_brick(int idim, double *lo, double *hi,
|
|||||||
else if (idim == 1) proc = grid2proc[other1][index][other2];
|
else if (idim == 1) proc = grid2proc[other1][index][other2];
|
||||||
else proc = grid2proc[other1][other2][idim];
|
else proc = grid2proc[other1][other2][idim];
|
||||||
|
|
||||||
|
if (noverlap == maxoverlap) {
|
||||||
|
maxoverlap += DELTA_PROCS;
|
||||||
|
memory->grow(overlap,maxoverlap,"comm:overlap");
|
||||||
|
}
|
||||||
|
|
||||||
if (proc == me) indexme = noverlap;
|
if (proc == me) indexme = noverlap;
|
||||||
overlap[noverlap++] = proc;
|
overlap[noverlap++] = proc;
|
||||||
index += dir;
|
index += dir;
|
||||||
@ -1167,20 +1169,24 @@ void CommTiled::box_drop_brick(int idim, double *lo, double *hi,
|
|||||||
no need to split lo/hi box as recurse b/c OK if box extends outside RCB box
|
no need to split lo/hi box as recurse b/c OK if box extends outside RCB box
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void CommTiled::box_drop_tiled(int idim, double *lo, double *hi,
|
void CommTiled::box_drop_tiled(int idim, double *lo, double *hi, int &indexme)
|
||||||
int &noverlap, int &indexme)
|
|
||||||
{
|
{
|
||||||
box_drop_tiled_recurse(lo,hi,0,nprocs-1,noverlap,indexme);
|
box_drop_tiled_recurse(lo,hi,0,nprocs-1,indexme);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommTiled::box_drop_tiled_recurse(double *lo, double *hi,
|
void CommTiled::box_drop_tiled_recurse(double *lo, double *hi,
|
||||||
int proclower, int procupper,
|
int proclower, int procupper,
|
||||||
int &noverlap, int &indexme)
|
int &indexme)
|
||||||
{
|
{
|
||||||
// end recursion when partition is a single proc
|
// end recursion when partition is a single proc
|
||||||
// add proc to overlap list
|
// add proc to overlap list
|
||||||
|
|
||||||
if (proclower == procupper) {
|
if (proclower == procupper) {
|
||||||
|
if (noverlap == maxoverlap) {
|
||||||
|
maxoverlap += DELTA_PROCS;
|
||||||
|
memory->grow(overlap,maxoverlap,"comm:overlap");
|
||||||
|
}
|
||||||
|
|
||||||
if (proclower == me) indexme = noverlap;
|
if (proclower == me) indexme = noverlap;
|
||||||
overlap[noverlap++] = proclower;
|
overlap[noverlap++] = proclower;
|
||||||
return;
|
return;
|
||||||
@ -1198,9 +1204,9 @@ void CommTiled::box_drop_tiled_recurse(double *lo, double *hi,
|
|||||||
int idim = rcbinfo[procmid].dim;
|
int idim = rcbinfo[procmid].dim;
|
||||||
|
|
||||||
if (lo[idim] < cut)
|
if (lo[idim] < cut)
|
||||||
box_drop_tiled_recurse(lo,hi,proclower,procmid-1,noverlap,indexme);
|
box_drop_tiled_recurse(lo,hi,proclower,procmid-1,indexme);
|
||||||
if (hi[idim] > cut)
|
if (hi[idim] > cut)
|
||||||
box_drop_tiled_recurse(lo,hi,procmid,procupper,noverlap,indexme);
|
box_drop_tiled_recurse(lo,hi,procmid,procupper,indexme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -1210,12 +1216,6 @@ void CommTiled::box_drop_tiled_recurse(double *lo, double *hi,
|
|||||||
void CommTiled::box_other_brick(int idim, int iswap,
|
void CommTiled::box_other_brick(int idim, int iswap,
|
||||||
int proc, double *lo, double *hi)
|
int proc, double *lo, double *hi)
|
||||||
{
|
{
|
||||||
double *prd = domain->prd;
|
|
||||||
double *boxlo = domain->boxlo;
|
|
||||||
double *boxhi = domain->boxhi;
|
|
||||||
double *sublo = domain->sublo;
|
|
||||||
double *subhi = domain->subhi;
|
|
||||||
|
|
||||||
lo[0] = sublo[0]; lo[1] = sublo[1]; lo[2] = sublo[2];
|
lo[0] = sublo[0]; lo[1] = sublo[1]; lo[2] = sublo[2];
|
||||||
hi[0] = subhi[0]; hi[1] = subhi[1]; hi[2] = subhi[2];
|
hi[0] = subhi[0]; hi[1] = subhi[1]; hi[2] = subhi[2];
|
||||||
|
|
||||||
@ -1264,10 +1264,6 @@ void CommTiled::box_other_brick(int idim, int iswap,
|
|||||||
void CommTiled::box_other_tiled(int idim, int iswap,
|
void CommTiled::box_other_tiled(int idim, int iswap,
|
||||||
int proc, double *lo, double *hi)
|
int proc, double *lo, double *hi)
|
||||||
{
|
{
|
||||||
double *prd = domain->prd;
|
|
||||||
double *boxlo = domain->boxlo;
|
|
||||||
double *boxhi = domain->boxhi;
|
|
||||||
|
|
||||||
double (*split)[2] = rcbinfo[proc].mysplit;
|
double (*split)[2] = rcbinfo[proc].mysplit;
|
||||||
|
|
||||||
lo[0] = boxlo[0] + prd[0]*split[0][0];
|
lo[0] = boxlo[0] + prd[0]*split[0][0];
|
||||||
|
|||||||
@ -94,18 +94,25 @@ class CommTiled : public Comm {
|
|||||||
int dim; // dimension = 0/1/2 of cut
|
int dim; // dimension = 0/1/2 of cut
|
||||||
};
|
};
|
||||||
|
|
||||||
int *overlap;
|
int noverlap; // # of overlapping procs
|
||||||
RCBinfo *rcbinfo; // list of RCB info for all procs
|
int maxoverlap; // current max length of overlap
|
||||||
|
int *overlap; // list of overlapping procs
|
||||||
|
|
||||||
|
RCBinfo *rcbinfo; // list of RCB info for all procs
|
||||||
|
|
||||||
|
double *prd; // local ptrs to Domain attributes
|
||||||
|
double *boxlo,*boxhi;
|
||||||
|
double *sublo,*subhi;
|
||||||
|
|
||||||
void init_buffers();
|
void init_buffers();
|
||||||
|
|
||||||
// box drop and other functions
|
// box drop and other functions
|
||||||
|
|
||||||
typedef void (CommTiled::*BoxDropPtr)(int, double *, double *, int &, int &);
|
typedef void (CommTiled::*BoxDropPtr)(int, double *, double *, int &);
|
||||||
BoxDropPtr box_drop;
|
BoxDropPtr box_drop;
|
||||||
void box_drop_brick(int, double *, double *, int &, int &);
|
void box_drop_brick(int, double *, double *, int &);
|
||||||
void box_drop_tiled(int, double *, double *, int &, int &);
|
void box_drop_tiled(int, double *, double *, int &);
|
||||||
void box_drop_tiled_recurse(double *, double *, int, int, int &, int &);
|
void box_drop_tiled_recurse(double *, double *, int, int, int &);
|
||||||
|
|
||||||
typedef void (CommTiled::*BoxOtherPtr)(int, int, int, double *, double *);
|
typedef void (CommTiled::*BoxOtherPtr)(int, int, int, double *, double *);
|
||||||
BoxOtherPtr box_other;
|
BoxOtherPtr box_other;
|
||||||
|
|||||||
Reference in New Issue
Block a user