Loading src/cluster/cluster.cpp +24 −1 Original line number Diff line number Diff line Loading @@ -606,6 +606,29 @@ void cluster(string config_file, string data_file, string output_path) { } // jxi488 loop for (int ri = 0; ri < ompnumthreads; ri++) { // Giovanni, please add here in this loop code to reopen the temporary files, reread them and append them respectively to the global output and tppoan, before closing them string partial_file_name = output_path + "/c_OCLU_" + to_string(ri); printf("Copying ASCII output of thread %d of %d... ", ri, ompnumthreads); FILE *partial_output = fopen(partial_file_name.c_str(), "r"); char c = fgetc(partial_output); while (c != EOF) { fputc(c, output); c = fgetc(partial_output); } fclose(partial_output); remove(partial_file_name.c_str()); printf("done.\n"); partial_file_name = output_path + "/c_TPPOAN_" + to_string(ri); printf("Copying binary output of thread %d of %d... ", ri, ompnumthreads); fstream partial_tppoan; partial_tppoan.open((output_path + "/c_TPPOAN_" + to_string(ri)).c_str(), ios::in | ios::binary); c = partial_tppoan.get(); while(!partial_tppoan.eof()) { tppoan.put(c); c = partial_tppoan.get(); } partial_tppoan.close(); remove(partial_file_name.c_str()); printf("done.\n"); } tppoan.close(); } else { // In case TPPOAN could not be opened. Should never happen. Loading Loading
src/cluster/cluster.cpp +24 −1 Original line number Diff line number Diff line Loading @@ -606,6 +606,29 @@ void cluster(string config_file, string data_file, string output_path) { } // jxi488 loop for (int ri = 0; ri < ompnumthreads; ri++) { // Giovanni, please add here in this loop code to reopen the temporary files, reread them and append them respectively to the global output and tppoan, before closing them string partial_file_name = output_path + "/c_OCLU_" + to_string(ri); printf("Copying ASCII output of thread %d of %d... ", ri, ompnumthreads); FILE *partial_output = fopen(partial_file_name.c_str(), "r"); char c = fgetc(partial_output); while (c != EOF) { fputc(c, output); c = fgetc(partial_output); } fclose(partial_output); remove(partial_file_name.c_str()); printf("done.\n"); partial_file_name = output_path + "/c_TPPOAN_" + to_string(ri); printf("Copying binary output of thread %d of %d... ", ri, ompnumthreads); fstream partial_tppoan; partial_tppoan.open((output_path + "/c_TPPOAN_" + to_string(ri)).c_str(), ios::in | ios::binary); c = partial_tppoan.get(); while(!partial_tppoan.eof()) { tppoan.put(c); c = partial_tppoan.get(); } partial_tppoan.close(); remove(partial_file_name.c_str()); printf("done.\n"); } tppoan.close(); } else { // In case TPPOAN could not be opened. Should never happen. Loading