change ring communication API to no longer require a static variable pointing to 'this' of the caller

This commit is contained in:
Axel Kohlmeyer
2017-06-14 17:01:06 -04:00
parent 286d4f2743
commit fcc387f232
18 changed files with 166 additions and 206 deletions

View File

@ -678,10 +678,12 @@ int Comm::binary(double value, int n, double *vec)
using original inbuf, which may have been updated
for non-NULL outbuf, final updated inbuf is copied to it
ok to specify outbuf = inbuf
the ptr argument is a pointer to the instance of calling class
------------------------------------------------------------------------- */
void Comm::ring(int n, int nper, void *inbuf, int messtag,
void (*callback)(int, char *), void *outbuf, int self)
void (*callback)(int, char *, void *),
void *outbuf, void *ptr, int self)
{
MPI_Request request;
MPI_Status status;
@ -712,7 +714,7 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
MPI_Get_count(&status,MPI_CHAR,&nbytes);
memcpy(buf,bufcopy,nbytes);
}
if (self || loop < nprocs-1) callback(nbytes/nper,buf);
if (self || loop < nprocs-1) callback(nbytes/nper,buf,ptr);
}
if (outbuf) memcpy(outbuf,buf,nbytes);