Changeset 24442
- Timestamp:
- 12/05/19 16:59:50 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/modules/OutputResultsx/OutputResultsx.cpp ¶
r22916 r24442 20 20 FILE *fid = NULL; 21 21 char *outputfilename = NULL; 22 char cpu_outputfilename[100]; //easier to convert an integer with sprintf22 char outputfilename2[100]; //easier to convert an integer with sprintf 23 23 bool io_gather; 24 24 int solutiontype; 25 25 char* solutiontypestring = NULL; 26 26 bool dakota_analysis = false; 27 int currEvalId = -1; 28 bool dakota_output = false; 27 29 28 30 /*retrieve parameters: */ 29 31 femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum); 32 femmodel->parameters->FindParam(&dakota_output,QmuOutputEnum); 33 femmodel->parameters->FindParam(&currEvalId,QmuCurrEvalIdEnum); 30 34 31 35 /*recover my_rank:*/ 32 36 my_rank=IssmComm::GetRank(); 33 37 34 if(dakota_analysis ){35 // no need to output anything, Dakota analysis has different outputs38 if(dakota_analysis & !dakota_output){ 39 //user wants to rely purely on Dakota analysis output, not the core output. 36 40 return; 37 41 } … … 57 61 if(io_gather){ 58 62 /*Just open the file for output on cpu 0. We are gathering the data on cpu 0 from all other cpus: */ 59 if(my_rank==0) fid=pfopen0(outputfilename ,"ab+"); 63 if(!dakota_analysis){ 64 if(my_rank==0) fid=pfopen0(outputfilename ,"ab+"); 65 } 66 else{ 67 if(my_rank==0){ 68 sprintf(outputfilename2,"%s.%i",outputfilename,currEvalId); 69 fid=pfopen0(outputfilename2,"ab+"); 70 } 71 } 60 72 } 61 73 else{ 62 74 /*We are opening different files for output on all cpus. Append the rank to the filename, and open: */ 63 sprintf( cpu_outputfilename,"%s.%i",outputfilename,my_rank);64 fid=pfopen( cpu_outputfilename,"ab+");75 sprintf(outputfilename2,"%s.%i",outputfilename,my_rank); 76 fid=pfopen(outputfilename2 ,"ab+"); 65 77 } 66 78 … … 83 95 /*Close output file? :*/ 84 96 if(io_gather){ 85 if(my_rank==0) pfclose(fid,outputfilename); 97 if(!dakota_analysis){ 98 if(my_rank==0) pfclose(fid,outputfilename); 99 } 100 else{ 101 if(my_rank==0) pfclose(fid,outputfilename2); 102 } 86 103 } 87 else pfclose(fid, cpu_outputfilename);104 else pfclose(fid,outputfilename2); 88 105 #endif 89 106
Note:
See TracChangeset
for help on using the changeset viewer.