Changeset 16391


Ignore:
Timestamp:
10/11/13 13:30:07 (11 years ago)
Author:
Eric.Larour
Message:

CHG: bug fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r16388 r16391  
    11091109                strings=xNew<char*>(num_instances);
    11101110
    1111 
    11121111                for(i=0;i<num_instances;i++){
    11131112
    1114                         fsetpos(fid,file_positions+i);
    1115 
    1116                         /*check we are indeed finding a string, not something else: */
    1117                         if(codes[i]!=4)_error_("expecting a string for enum " << EnumToStringx(data_enum));
    1118 
    1119                         /*We have to read a string from disk. First read the dimensions of the string, then the string: */
    1120                         if(my_rank==0){ 
     1113
     1114                        if(my_rank==0){
     1115                                /*check we are indeed finding a string, not something else: */
     1116                                if(codes[i]!=4)_error_("expecting a string for enum " << EnumToStringx(data_enum));
     1117               
     1118                                /*We have to read a string from disk. First read the dimensions of the string, then the string: */
     1119                                fsetpos(fid,file_positions+i);
    11211120                                if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string ");
    11221121                        }
    1123 
    11241122
    11251123                        ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm());
     
    11311129
    11321130                                /*Read string on node 0, then broadcast: */
    1133                                 if(my_rank==0){ 
     1131                                if(my_rank==0){
    11341132                                        if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string ");
    11351133                                }
     
    11881186                for(i=0;i<num_instances;i++){
    11891187
    1190                         fsetpos(fid,file_positions+i);
    1191                         code=codes[i];
    1192 
    1193                         if((code!=5) && (code!=6) && (code!=7))_error_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum));
    1194                        
    1195                         /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
    1196                         /*numberofelements: */
    1197                         if(my_rank==0){ 
     1188                        if(my_rank==0){
     1189                                code=codes[i];
     1190
     1191                                if((code!=5) && (code!=6) && (code!=7))_error_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum));
     1192
     1193                                /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
     1194                                /*numberofelements: */
     1195                                fsetpos(fid,file_positions+i);
    11981196                                if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix ");
    11991197                        }
     
    15421540        /*Broadcast data: */
    15431541        ISSM_MPI_Bcast(&num_instances,1,ISSM_MPI_INT,0,IssmComm::GetComm());
    1544         ISSM_MPI_Bcast(codes,num_instances,ISSM_MPI_INT,0,IssmComm::GetComm());
    1545         ISSM_MPI_Bcast(vector_types,num_instances,ISSM_MPI_INT,0,IssmComm::GetComm());
    15461542
    15471543        /*Assign output pointers:*/
Note: See TracChangeset for help on using the changeset viewer.