/[escript]/branches/doubleplusgood/esysUtils/src/Esys_MPI.cpp
ViewVC logotype

Diff of /branches/doubleplusgood/esysUtils/src/Esys_MPI.cpp

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

revision 4335 by jfenwick, Wed Feb 27 06:09:33 2013 UTC revision 4336 by jfenwick, Thu Mar 21 08:25:18 2013 UTC
# Line 34  Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Co Line 34  Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Co
34    
35    Esys_MPIInfo *out=NULL;    Esys_MPIInfo *out=NULL;
36    
37    out = MEMALLOC( 1, Esys_MPIInfo );    out = new Esys_MPIInfo;
38        
39    out->reference_counter = 0;    out->reference_counter = 0;
40    out->msg_tag_counter = 0;    out->msg_tag_counter = 0;
# Line 59  Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Co Line 59  Esys_MPIInfo* Esys_MPIInfo_alloc( MPI_Co
59  void Esys_MPIInfo_free( Esys_MPIInfo *in )  void Esys_MPIInfo_free( Esys_MPIInfo *in )
60  {  {
61    if( in!=NULL) {    if( in!=NULL) {
62      if (!(--in->reference_counter) ) MEMFREE( in );      if (!(--in->reference_counter) ) delete in;
63    }    }
64  }  }
65    
# Line 157  int Esys_MPIInfo_initialized( void ) Line 157  int Esys_MPIInfo_initialized( void )
157  /* Append MPI rank to file name if multiple MPI processes */  /* Append MPI rank to file name if multiple MPI processes */
158  char *Esys_MPI_appendRankToFileName(const char *fileName, int mpi_size, int mpi_rank) {  char *Esys_MPI_appendRankToFileName(const char *fileName, int mpi_size, int mpi_rank) {
159    /* Make plenty of room for the mpi_rank number and terminating '\0' */    /* Make plenty of room for the mpi_rank number and terminating '\0' */
160    char *newFileName = TMPMEMALLOC(strlen(fileName)+20,char);    char *newFileName = new char[strlen(fileName)+20];
161    strncpy(newFileName, fileName, strlen(fileName)+1);    strncpy(newFileName, fileName, strlen(fileName)+1);
162    if (mpi_size>1) sprintf(newFileName+strlen(newFileName), ".%04d", mpi_rank);    if (mpi_size>1) sprintf(newFileName+strlen(newFileName), ".%04d", mpi_rank);
163    return(newFileName);    return(newFileName);

Legend:
Removed from v.4335  
changed lines
  Added in v.4336

  ViewVC Help
Powered by ViewVC 1.1.26