Skip to content

Commit

Permalink
move has_nonlinearities check
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj authored Feb 26, 2023
1 parent 0953062 commit ae9503d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit ae9503d

Please sign in to comment.