added extra output func
authorAnatoly Titov <toluk@omrb.pnpi.spb.ru>
Fri, 11 Jan 2019 09:58:17 +0000 (12:58 +0300)
committerAnatoly Titov <toluk@omrb.pnpi.spb.ru>
Fri, 11 Jan 2019 09:58:17 +0000 (12:58 +0300)
src/spacetimecorr.cpp

index c9279d2f6f4a9e576580c051b2c4d7806b5fd684..9e4f7207af7659b4e4cf2559498ee56bdc57d6ad 100644 (file)
@@ -54,7 +54,7 @@ using namespace gmx;
 
 using gmx::RVec;
 
-void make_correlation_file(std::vector< std::vector< std::vector< float > > > correlations, const char* file_name, int start)
+void make_correlation_matrix_file(std::vector< std::vector< std::vector< float > > > correlations, const char* file_name, int start)
 {
     FILE *file;
     file = std::fopen(file_name, "w+");
@@ -75,7 +75,26 @@ void make_correlation_file(std::vector< std::vector< std::vector< float > > > co
     std::fclose(file);
 }
 
-void make_rout_file2(float crl_border, std::vector< int > indx, std::vector< std::vector< std::pair< int, int > > > rout, const char* file_name)
+void make_correlation_pairs_file(std::vector< std::vector< std::vector< float > > > correlations, const char* file_name, int start)
+{
+    FILE *file;
+    file = std::fopen(file_name, "w+");
+    for (int i = 0; i < correlations.front().size(); i++) {
+        for (int j = 0; j < correlations.front().front().size(); j++) {
+            std::fprintf(file, "correlation between point '%d' and point '%d'\n", i, j);
+            for (int k = 0; k < correlations.size(); k++) {
+                std::fprintf(file, "%3.4f ", correlations[k][i][j]);
+            }
+            std::fprintf(file, "\n");
+        }
+        if (i % 10 == 0) {
+            std::cout << "correlations in row " << i << " out of " << correlations.front().size() << " completed\n";
+        }
+    }
+    std::fclose(file);
+}
+
+void make_rout_file(float crl_border, std::vector< int > indx, std::vector< std::vector< std::pair< int, int > > > rout, const char* file_name)
 {
     FILE *file;
     file = std::fopen(file_name, "w+");
@@ -485,9 +504,10 @@ SpaceTimeCorr::finishAnalysis(int nframes)
 
     std::cout << "routs evaluation: end\n";
 
-    //make_correlation_file(crltns, "CubeT.txt", 0);
-    //make_rout_file2(crl_border, index, rout_new, "Routs_Cube.txt");
-    //make_best_corrs_graphics(crltns, rout_new, index, "best_graphics_Cube.txt");
+    make_correlation_matrix_file(crltns, "CubeT.txt", 0);
+    make_correlation_pairs_file(crltns, "test.txt", 0);
+    make_rout_file(crl_border, index, rout_new, "Routs_Cube.txt");
+    make_best_corrs_graphics(crltns, rout_new, index, "best_graphics_Cube.txt");
 
     std::cout << "Finish Analysis - end\n\n";
 }