/[escript]/trunk/paso/src/Coupler.c
ViewVC logotype

Diff of /trunk/paso/src/Coupler.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3445 by gross, Wed Jan 19 06:02:15 2011 UTC revision 3458 by gross, Mon Jan 31 07:06:42 2011 UTC
# Line 147  Paso_Coupler* Paso_Coupler_alloc(Paso_Co Line 147  Paso_Coupler* Paso_Coupler_alloc(Paso_Co
147        out->mpi_stati=NULL;        out->mpi_stati=NULL;
148        out->mpi_info = Esys_MPIInfo_getReference(mpi_info);        out->mpi_info = Esys_MPIInfo_getReference(mpi_info);
149        out->reference_counter=1;        out->reference_counter=1;
150          out->in_use = FALSE;
151                
152        #ifdef ESYS_MPI        #ifdef ESYS_MPI
153           out->mpi_requests=MEMALLOC(connector->send->numNeighbors+connector->recv->numNeighbors,MPI_Request);           out->mpi_requests=MEMALLOC(connector->send->numNeighbors+connector->recv->numNeighbors,MPI_Request);
# Line 204  void Paso_Coupler_startCollect(Paso_Coup Line 205  void Paso_Coupler_startCollect(Paso_Coup
205    dim_t i;    dim_t i;
206    coupler->data=(double*) in;    coupler->data=(double*) in;
207    if ( mpi_info->size>1) {    if ( mpi_info->size>1) {
208         if (coupler->in_use) {
209        Esys_setError(SYSTEM_ERROR,"Paso_Coupler_startCollect: Coupler in use.");
210         }
211       /* start reveiving input */       /* start reveiving input */
212       {       {
213          for (i=0; i< coupler->connector->recv->numNeighbors; ++i) {          for (i=0; i< coupler->connector->recv->numNeighbors; ++i) {
# Line 244  void Paso_Coupler_startCollect(Paso_Coup Line 248  void Paso_Coupler_startCollect(Paso_Coup
248          }          }
249       }       }
250       mpi_info->msg_tag_counter+=mpi_info->size;       mpi_info->msg_tag_counter+=mpi_info->size;
251         coupler->in_use=TRUE;
252    }    }
253  }  }
254    
# Line 251  double* Paso_Coupler_finishCollect(Paso_ Line 256  double* Paso_Coupler_finishCollect(Paso_
256  {  {
257    Esys_MPIInfo *mpi_info = coupler->mpi_info;      Esys_MPIInfo *mpi_info = coupler->mpi_info;  
258    if ( mpi_info->size>1) {    if ( mpi_info->size>1) {
259         if (! coupler->in_use) {
260        Esys_setError(SYSTEM_ERROR,"Paso_Coupler_finishCollect: Communication has not been initiated.");
261        return NULL;
262         }
263       /* wait for receive */       /* wait for receive */
264          #ifdef ESYS_MPI       #ifdef ESYS_MPI
265          MPI_Waitall(coupler->connector->recv->numNeighbors+coupler->connector->send->numNeighbors,          MPI_Waitall(coupler->connector->recv->numNeighbors+coupler->connector->send->numNeighbors,
266                      coupler->mpi_requests,                      coupler->mpi_requests,
267                      coupler->mpi_stati);                      coupler->mpi_stati);
268          #endif        #endif
269          coupler->in_use=FALSE;
270    }    }
271    
272    return coupler->recv_buffer;    return coupler->recv_buffer;

Legend:
Removed from v.3445  
changed lines
  Added in v.3458

  ViewVC Help
Powered by ViewVC 1.1.26