/[escript]/trunk/finley/src/Mesh_read.c
ViewVC logotype

Diff of /trunk/finley/src/Mesh_read.c

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

revision 2307 by gross, Mon Nov 17 22:57:50 2008 UTC revision 2308 by gross, Mon Mar 16 01:20:56 2009 UTC
# Line 270  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 270  Finley_Mesh* Finley_Mesh_read_MPI(char*
270    
271  {  {
272    
273    Paso_MPIInfo *mpi_info = Paso_MPIInfo_alloc( MPI_COMM_WORLD );    Paso_MPIInfo *mpi_info = NULL;
274    dim_t numNodes, numDim, numEle, i0, i1;    dim_t numNodes, numDim, numEle, i0, i1;
275    Finley_Mesh *mesh_p=NULL;    Finley_Mesh *mesh_p=NULL;
276    char name[LenString_MAX],element_type[LenString_MAX],frm[20];    char name[LenString_MAX],element_type[LenString_MAX],frm[20];
# Line 283  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 283  Finley_Mesh* Finley_Mesh_read_MPI(char*
283    int scan_ret;    int scan_ret;
284    
285    Finley_resetError();    Finley_resetError();
286      mpi_info = Paso_MPIInfo_alloc( MPI_COMM_WORLD );
287    
288    if (mpi_info->rank == 0) {    if (mpi_info->rank == 0) {
289       /* get file handle */       /* get file handle */
# Line 326  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 327  Finley_Mesh* Finley_Mesh_read_MPI(char*
327    }    }
328  #endif  #endif
329    
330    
331       /* allocate mesh */       /* allocate mesh */
332       mesh_p = Finley_Mesh_alloc(name,numDim,order,reduced_order,mpi_info);       mesh_p = Finley_Mesh_alloc(name,numDim,order,reduced_order,mpi_info);
333       if (Finley_noError()) {       if (Finley_noError()) {
# Line 858  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 860  Finley_Mesh* Finley_Mesh_read_MPI(char*
860        /* get the name tags */        /* get the name tags */
861        if (Finley_noError()) {        if (Finley_noError()) {
862          char *remainder=0, *ptr;          char *remainder=0, *ptr;
863          size_t len;          size_t len=0;
864          int tag_key;          int tag_key, len_i;
   
   
   
865          if (mpi_info->rank == 0) {  /* Master */          if (mpi_info->rank == 0) {  /* Master */
866        /* Read the word 'Tag' */        /* Read the word 'Tag' */
867        if (! feof(fileHandle_p)) {        if (! feof(fileHandle_p)) {
# Line 925  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 924  Finley_Mesh* Finley_Mesh_read_MPI(char*
924          }          }
925  #ifdef PASO_MPI  #ifdef PASO_MPI
926    
927          if (MPI_Bcast (&len, 1, MPI_INT,  0, mpi_info->comm) != MPI_SUCCESS)          len_i=(int) len;
928            if (MPI_Bcast (&len_i, 1, MPI_INT,  0, mpi_info->comm) != MPI_SUCCESS)
929          {          {
930             Finley_setError(PASO_MPI_ERROR,             Finley_setError(PASO_MPI_ERROR,
931                             "Finley_Mesh_read: broadcast of tag len failed");                             "Finley_Mesh_read: broadcast of tag len failed");
932             return NULL;             return NULL;
933          }          }
934            len=(size_t) len_i;
935      if (mpi_info->rank != 0) {      if (mpi_info->rank != 0) {
936        remainder = TMPMEMALLOC(len+1, char);        remainder = TMPMEMALLOC(len+1, char);
937        remainder[0] = 0;        remainder[0] = 0;
938      }      }
   
939          if (MPI_Bcast (remainder, len+1, MPI_CHAR,  0, mpi_info->comm) !=          if (MPI_Bcast (remainder, len+1, MPI_CHAR,  0, mpi_info->comm) !=
940              MPI_SUCCESS)              MPI_SUCCESS)
941          {          {
# Line 944  Finley_Mesh* Finley_Mesh_read_MPI(char* Line 944  Finley_Mesh* Finley_Mesh_read_MPI(char*
944             return NULL;             return NULL;
945          }          }
946  #endif  #endif
947    
948      if (remainder[0]) {      if (remainder[0]) {
949            ptr = remainder;            ptr = remainder;
950            do {            do {

Legend:
Removed from v.2307  
changed lines
  Added in v.2308

  ViewVC Help
Powered by ViewVC 1.1.26