summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-05 11:08:50 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-05 11:08:50 -0300
commit44ed3056e815910b7f61c62a9b71976a3c47f4b3 (patch)
tree196b8588e20d6b2f1f17962888c7c07b51227cbe
parent69d33f4cc316dd47404f1bcf0178e59fe8d2c076 (diff)
downloadcode-44ed3056e815910b7f61c62a9b71976a3c47f4b3.tar.gz
code-44ed3056e815910b7f61c62a9b71976a3c47f4b3.tar.bz2
code-44ed3056e815910b7f61c62a9b71976a3c47f4b3.zip
Save half the data to the disk
-rw-r--r--fourier_integrator.cpp11
-rw-r--r--get_energy.cpp7
2 files changed, 12 insertions, 6 deletions
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();
}
diff --git a/get_energy.cpp b/get_energy.cpp
index 6e14d9b..ae77595 100644
--- a/get_energy.cpp
+++ b/get_energy.cpp
@@ -63,11 +63,14 @@ int main(int argc, char* argv[]) {
while (y += Δy, y <= yₘₐₓ) {
std::ifstream cfile(fourierFile("C", p, s, λ, τ₀, y, log2n, τₘₐₓ), std::ios::binary);
if (cfile.is_open()) {
- 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();
Real e = energy(C, R, p, s, λ, y, Δτ);