summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-05-23 14:16:01 +0200
committerAnton Khirnov <anton@khirnov.net>2019-05-23 14:16:01 +0200
commit857b9e3e44e545b8ea1cfbf0e534c68c88b077d2 (patch)
tree5a5c6ce3915534a8ffc914794a8b2fe3264bc6d5
parenteeb21e4fd862bb4beb943e7b86c7270ceb79f80b (diff)
Only allocate the context once.
-rw-r--r--src/maximal_slicing_axi_mg.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/maximal_slicing_axi_mg.c b/src/maximal_slicing_axi_mg.c
index ab22685..cae7197 100644
--- a/src/maximal_slicing_axi_mg.c
+++ b/src/maximal_slicing_axi_mg.c
@@ -949,12 +949,14 @@ void msa_mg_init(CCTK_ARGUMENTS)
int nb_levels_type;
int nb_levels = *(int*)CCTK_ParameterGet("num_levels_1", "CarpetRegrid2", &nb_levels_type);
- ret = context_init(cctkGH, fd_stencil, maxiter, exact_size, nb_cycles,
- nb_relax_pre, nb_relax_post, tol_residual, tol_residual_base,
- cfl_factor, nb_levels,
- loglevel, &ms);
- if (ret < 0)
- CCTK_WARN(0, "Error initializing the solver context");
+ if (!ms) {
+ ret = context_init(cctkGH, fd_stencil, maxiter, exact_size, nb_cycles,
+ nb_relax_pre, nb_relax_post, tol_residual, tol_residual_base,
+ cfl_factor, nb_levels,
+ loglevel, &ms);
+ if (ret < 0)
+ CCTK_WARN(0, "Error initializing the solver context");
+ }
}
void msa_mg_prestep(CCTK_ARGUMENTS)