diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-04-03 17:57:00 -0300 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-04-03 17:57:00 -0300 |
commit | cc70aa51c3f65f3d771cd027595ef2f586bb3d95 (patch) | |
tree | c41d674d9f2dc036ddfe179edbdcc7ab42a9be89 /get_energy.cpp | |
parent | a446c8ae813ae5e1c33d377dabd85d3d362b1878 (diff) | |
download | code-cc70aa51c3f65f3d771cd027595ef2f586bb3d95.tar.gz code-cc70aa51c3f65f3d771cd027595ef2f586bb3d95.tar.bz2 code-cc70aa51c3f65f3d771cd027595ef2f586bb3d95.zip |
Remove allocation from loop to speed up energy colculation
Diffstat (limited to 'get_energy.cpp')
-rw-r--r-- | get_energy.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/get_energy.cpp b/get_energy.cpp index b1527dc..b6e835f 100644 --- a/get_energy.cpp +++ b/get_energy.cpp @@ -57,10 +57,10 @@ int main(int argc, char* argv[]) { FourierTransform fft(n, Δω, Δτ, FFTW_ESTIMATE); - while (y += Δy, y <= yₘₐₓ) { - std::vector<Real> C(2 * n); - std::vector<Real> R(2 * n); + std::vector<Real> C(2 * n); + std::vector<Real> R(2 * n); + 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)); |