summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2022-10-04 16:17:29 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2022-10-04 16:17:29 +0200
commite55894853b0f254588f965fbf39b1e4cc132e7fe (patch)
tree8ae024a5bab652d4f1b0d932b17d59bc0fb17773
parentc6a8f62d7b8784ffdf27229fa711f990b5793c19 (diff)
downloadcode-e55894853b0f254588f965fbf39b1e4cc132e7fe.tar.gz
code-e55894853b0f254588f965fbf39b1e4cc132e7fe.tar.bz2
code-e55894853b0f254588f965fbf39b1e4cc132e7fe.zip
Output data to file that can be updated.
-rw-r--r--order.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/order.cpp b/order.cpp
index c2deb38..21335ad 100644
--- a/order.cpp
+++ b/order.cpp
@@ -1,4 +1,5 @@
#include <iostream>
+#include <fstream>
#include <random>
#include "rbmp.hpp"
@@ -32,6 +33,16 @@ int main(int argc, char* argv[]) {
std::vector<long int> data_x(G.vertices.size() / 2);
std::vector<long int> data_y(G.vertices.size() / 2);
+ std::string filename = "order_" + std::to_string(n) + ".dat";
+ std::ifstream input(filename);
+
+ for (unsigned i = 0; i < G.vertices.size() / 2; i++) {
+ input >> data_x[i];
+ input >> data_y[i];
+ }
+
+ input.close();
+
#pragma omp parallel for reduction(vec_int_plus : data_x) reduction(vec_int_plus : data_y)
for (unsigned i = 0; i < m; i++) {
PerfectMatching pm(G.vertices.size(), G.edges.size());
@@ -53,11 +64,13 @@ int main(int argc, char* argv[]) {
}
}
- std::cout << n << std::endl;
+ std::ofstream output(filename);
for (unsigned i = 0; i < G.vertices.size() / 2; i++) {
- std::cout << data_x[i] << " " << data_y[i] << std::endl;
+ output << data_x[i] << " " << data_y[i] << std::endl;
}
+ output.close();
+
return 0;
}