From 44ed3056e815910b7f61c62a9b71976a3c47f4b3 Mon Sep 17 00:00:00 2001
From: Jaron Kent-Dobias <jaron@kent-dobias.com>
Date: Sat, 5 Apr 2025 11:08:50 -0300
Subject: Save half the data to the disk

---
 fourier_integrator.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'fourier_integrator.cpp')

diff --git a/fourier_integrator.cpp b/fourier_integrator.cpp
index 24a7f1d..7669ca0 100644
--- a/fourier_integrator.cpp
+++ b/fourier_integrator.cpp
@@ -94,10 +94,13 @@ int main(int argc, char* argv[]) {
     Rt = fft.fourier(R);
   } else {
     std::ifstream cfile(fourierFile("C", p, s, λ, τ₀, y, log2n, τₘₐₓ), std::ios::binary);
-    cfile.read((char*)(C.data()), C.size() * sizeof(Real));
+    cfile.read((char*)(C.data()), (C.size() / 2) * sizeof(Real));
     cfile.close();
+    for (unsigned i = 1; i < n; i++) {
+      C[2 * n - i] = C[i];
+    }
     std::ifstream rfile(fourierFile("R", p, s, λ, τ₀, y, log2n, τₘₐₓ), std::ios::binary);
-    rfile.read((char*)(R.data()), R.size() * sizeof(Real));
+    rfile.read((char*)(R.data()), (R.size() / 2) * sizeof(Real));
     rfile.close();
 
     Ct = fft.fourier(C);
@@ -165,11 +168,11 @@ int main(int argc, char* argv[]) {
     std::cerr << "y " << y << " " << e << " " << z << std::endl;
 
     std::ofstream outfile(fourierFile("C", p, s, λ, τ₀, y, log2n, τₘₐₓ), std::ios::out | std::ios::binary);
-    outfile.write((const char*)(C.data()), C.size() * sizeof(Real));
+    outfile.write((const char*)(C.data()), (C.size() / 2) * sizeof(Real));
     outfile.close();
 
     std::ofstream outfileR(fourierFile("R", p, s, λ, τ₀, y, log2n, τₘₐₓ), std::ios::out | std::ios::binary);
-    outfileR.write((const char*)(R.data()), R.size() * sizeof(Real));
+    outfileR.write((const char*)(R.data()), (R.size() / 2) * sizeof(Real));
     outfileR.close();
   }
 
-- 
cgit v1.2.3-70-g09d2