Changeset 15559
- Timestamp:
- 07/23/13 12:06:26 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r15444 r15559 188 188 189 189 /*Open input file on cpu 0: */ 190 if(my_rank==0) IOMODEL = pfopen (inputfilename ,"rb");190 if(my_rank==0) IOMODEL = pfopen0(inputfilename ,"rb"); 191 191 192 192 /*Initialize internal data: */ … … 1465 1465 /*Get response*/ 1466 1466 J=0; 1467 //_printf_(true,"list of misfits: "); 1467 1468 for(int i=0;i<num_responses;i++){ 1468 1469 this->Responsex(&Jplus,EnumToStringx(responses[i]),i); 1470 //_printf_(true," %12.7g ",Jplus); 1469 1471 J+=Jplus; 1470 1472 } 1473 //_printf_(true," \n"); 1471 1474 1472 1475 /*Assign output pointers: */ -
issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp
r15128 r15559 61 61 if(io_gather){ 62 62 /*Just open the file for output on cpu 0. We are gathering the data on cpu 0 from all other cpus: */ 63 if(my_rank==0) fid=pfopen (outputfilename ,"wb");63 if(my_rank==0) fid=pfopen0(outputfilename ,"wb"); 64 64 } 65 65 else{ -
issm/trunk-jpl/src/c/shared/io/Disk/diskio.h
r13549 r15559 9 9 10 10 FILE* pfopen(char* filename,const char* format); 11 FILE* pfopen0(char* filename,const char* format); 11 12 void pfclose(FILE* fid,char* filename); 12 13 void WriteLockFile(char* filename); -
issm/trunk-jpl/src/c/shared/io/Disk/pfopen.cpp
r14950 r15559 4 4 5 5 #ifdef HAVE_CONFIG_H 6 6 #include <config.h> 7 7 #else 8 8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" … … 10 10 11 11 #include <stdio.h> 12 #include "../../shared.h" 12 #include "../Print/Print.h" 13 #include "../Comm/Comm.h" 14 #include "../../Exceptions/exceptions.h" 13 15 16 FILE* pfopen0(char* filename,const char* format){ 17 18 FILE* fid=NULL; 19 20 /*recover my_rank:*/ 21 int my_rank = IssmComm::GetRank(); 22 if(my_rank) _error_("This function should only be called by cpu 0"); 23 24 /*Open handle to data on disk*/ 25 fid = fopen(filename,format); 26 if(fid==NULL) _error_("could not open file " << filename << " for binary reading or writing"); 27 28 return fid; 29 } 14 30 FILE* pfopen(char* filename,const char* format){ 15 31 16 32 FILE* fid=NULL; 17 33 18 /*Open handle to data on disk: */ 19 fid=fopen(filename,format); 20 if(fid==NULL) _error_("could not open file " << filename << " for binary reading or writing"); 34 /*recover my_rank:*/ 35 int my_rank = IssmComm::GetRank(); 36 int num_proc = IssmComm::GetSize(); 37 38 /*Open handle to data on disk (one by one to avoid errors)*/ 39 for(int i=0;i<num_proc;i++){ 40 if(my_rank==i) fid = fopen(filename,format); 41 #ifdef _HAVE_MPI_ 42 MPI_Barrier(IssmComm::GetComm()); 43 #endif 44 } 45 if(fid==NULL) _error_("could not open file " << filename << " for binary reading or writing"); 21 46 22 47 return fid;
Note:
See TracChangeset
for help on using the changeset viewer.