git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9447 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2013-02-11 20:34:02 +00:00
parent 5ae5366040
commit 0b0bf77f04
3 changed files with 11 additions and 6 deletions

View File

@ -1506,12 +1506,15 @@ void Comm::forward_comm_array(int n, double **array)
/* ----------------------------------------------------------------------
communicate inbuf around full ring of processors with messtag
nbytes = size of inbuf = n datums, each of size nper bytes
use callback() to allow caller to process each proc's inbuf
nbytes = size of inbuf = n datums * nper bytes
callback() is invoked to allow caller to process/update each proc's inbuf
note that callback() is invoked on final iteration for original inbuf
for non-NULL outbuf, final updated inbuf is copied to it
outbuf = inbuf is OK
------------------------------------------------------------------------- */
void Comm::ring(int n, int nper, void *inbuf, int messtag,
void (*callback)(int, char *))
void (*callback)(int, char *), void *outbuf)
{
MPI_Request request;
MPI_Status status;
@ -1537,10 +1540,12 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
MPI_Wait(&request,&status);
MPI_Get_count(&status,MPI_CHAR,&nbytes);
memcpy(buf,bufcopy,nbytes);
callback(nbytes/nper,buf);
}
callback(nbytes/nper,buf);
}
if (outbuf) memcpy(outbuf,buf,nbytes);
memory->destroy(buf);
memory->destroy(bufcopy);
}

View File

@ -61,7 +61,7 @@ class Comm : protected Pointers {
virtual void reverse_comm_dump(class Dump *); // reverse comm from a Dump
void forward_comm_array(int, double **); // forward comm of array
void ring(int, int, void *, int, void (*)(int, char *)); // ring comm
void ring(int, int, void *, int, void (*)(int, char *), void *); // ring comm
virtual void set(int, char **); // set communication style
void set_processors(int, char **); // set 3d processor grid attributes

View File

@ -956,7 +956,7 @@ void Special::dihedral_trim()
if (next == nprocs) next = 0;
if (prev < 0) prev = nprocs - 1;
int messtag = 7;
int messtag = 8;
for (int loop = 0; loop < nprocs; loop++) {
i = 0;
while (i < size) {