diff --git a/src/cluster/cluster.cpp b/src/cluster/cluster.cpp index f0135268694741bc938af0efd387522769a4cad3..257d52138cab10034378bea751b57ff2cd1c6933 100644 --- a/src/cluster/cluster.cpp +++ b/src/cluster/cluster.cpp @@ -361,10 +361,13 @@ void cluster(string config_file, string data_file, string output_path) { #ifdef _OPENMP myompthread = omp_get_thread_num(); if (myompthread == 0) ompnumthreads = omp_get_num_threads(); -#endif FILE *output_2 = fopen((output_path + "/c_OCLU_" + to_string(myompthread)).c_str(), "w"); fstream tppoan_2; tppoan_2.open((output_path + "/c_TPPOAN_" + to_string(myompthread)).c_str(), ios::out | ios::binary); +#else + FILE *output_2 = output; + fstream &tppoan_2 = tppoan; +#endif double *gaps_2 = new double[nsph](); double **tqse_2 = new double*[2]; double **tqce_2 = new double*[2]; @@ -533,8 +536,10 @@ void cluster(string config_file, string data_file, string output_path) { delete c4_2; delete c6_2; delete c9_2; +#ifdef _OPENMP fclose(output_2); tppoan_2.close(); +#endif delete[] gaps_2; for (int ti = 0; ti <2 -1; ti++) { delete[] tqse_2[ti]; @@ -604,6 +609,7 @@ void cluster(string config_file, string data_file, string output_path) { delete[] am_2; } // jxi488 loop +#ifdef _OPENMP 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); @@ -630,6 +636,7 @@ void cluster(string config_file, string data_file, string output_path) { remove(partial_file_name.c_str()); printf("done.\n"); } +#endif tppoan.close(); } else { // In case TPPOAN could not be opened. Should never happen. printf("\nERROR: failed to open TPPOAN file.\n");