Changeset 16391
- Timestamp:
- 10/11/13 13:30:07 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/IoModel.cpp
r16388 r16391 1109 1109 strings=xNew<char*>(num_instances); 1110 1110 1111 1112 1111 for(i=0;i<num_instances;i++){ 1113 1112 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); 1121 1120 if(fread(&string_size,sizeof(int),1,fid)!=1) _error_("could not read length of string "); 1122 1121 } 1123 1124 1122 1125 1123 ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); … … 1131 1129 1132 1130 /*Read string on node 0, then broadcast: */ 1133 if(my_rank==0){ 1131 if(my_rank==0){ 1134 1132 if(fread(string,string_size*sizeof(char),1,fid)!=1)_error_(" could not read string "); 1135 1133 } … … 1188 1186 for(i=0;i<num_instances;i++){ 1189 1187 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); 1198 1196 if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix "); 1199 1197 } … … 1542 1540 /*Broadcast data: */ 1543 1541 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());1546 1542 1547 1543 /*Assign output pointers:*/
Note:
See TracChangeset
for help on using the changeset viewer.