diff options
author | Anton Khirnov <anton@khirnov.net> | 2018-04-07 10:05:36 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2018-04-07 10:05:36 +0200 |
commit | 36eb8bc7c24938163bcf8d7b3a58bfeb71755f8d (patch) | |
tree | 997de93b8e9022f7d3a9f22e4186f48b82a3c7be | |
parent | 36ecd9d45e2bf204b6b641a3564a52d0df3f49d2 (diff) |
Support configurable solving at finer levels.
-rw-r--r-- | param.ccl | 5 | ||||
-rw-r--r-- | src/qms.c | 25 |
2 files changed, 26 insertions, 4 deletions
@@ -31,6 +31,11 @@ CCTK_REAL outer_bound "" STEERABLE=recover 0: :: "" } 64.0 +CCTK_INT solve_level "" STEERABLE=recover +{ + 0: :: "" +} 0 + CCTK_REAL switchoff_time "" STEERABLE=recover { 0: :: "" @@ -51,7 +51,6 @@ struct QMSContext { double *coeffs_eval; double max_radius; - int solve_level; uint64_t grid_expand_count; uint64_t grid_expand_time; @@ -62,6 +61,21 @@ struct QMSContext { double scale_factor; +static int ctz(int a) +{ + int ret = 0; + + if (!a) + return INT_MAX; + + while (!(a & 1)) { + a >>= 1; + ret++; + } + + return ret; +} + /* get an approximate "main" frequency component in a basis function */ static double calc_basis_freq(const BasisSet *b, int order) { @@ -282,12 +296,15 @@ void quasimaximal_slicing_axi_solve(CCTK_ARGUMENTS) ms = qms_context; - time = cctkGH->cctk_time / ms->gh->cctk_delta_time; - if (cctkGH->cctk_time >= switchoff_time + 1.0) return; - if (ms->gh->cctk_levfac[0] != 1 || fabs(time - ceilf(time)) > 1e-8 || + if (ctz(ms->gh->cctk_levfac[0]) != solve_level) + return; + + time = cctkGH->cctk_time * ms->gh->cctk_levfac[0] / ms->gh->cctk_delta_time; + + if (fabs(time - ceilf(time)) > 1e-8 || (ms->solutions[ARRAY_ELEMS(ms->solutions) - 1].time >= cctkGH->cctk_time)) return; |