From ae9503d58999850a4c8c5a1ef80766f3d384368d Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Sun, 26 Feb 2023 08:10:44 -0500 Subject: [PATCH] move has_nonlinearities check --- src/dft.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dft.cpp b/src/dft.cpp index 810f9c5d8..287a4f2b6 100644 --- a/src/dft.cpp +++ b/src/dft.cpp @@ -192,7 +192,9 @@ dft_chunk *fields::add_dft(component c, const volume &where, const double *freq, data.c = c; data.vc = vc; - if (decimation_factor == 0) { + if (decimation_factor == 0 && has_nonlinearities()) + decimation_factor = 1; + else if (decimation_factor == 0) { double src_freq_max = 0; for (src_time *s = sources; s; s = s->next) { if (s->get_fwidth() == 0) @@ -204,7 +206,7 @@ dft_chunk *fields::add_dft(component c, const volume &where, const double *freq, double freq_max = 0; for (size_t i = 0; i < Nfreq; ++i) freq_max = std::max(freq_max, std::abs(freq[i])); - if ((freq_max > 0) && (src_freq_max > 0) && !has_nonlinearities()) + if ((freq_max > 0) && (src_freq_max > 0)) decimation_factor = std::max(1, int(std::floor(1 / (dt * (freq_max + src_freq_max))))); else decimation_factor = 1;