From 73c4fa22c06c918f722e901681791dae9379dcc7 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 2 Apr 2020 16:21:10 -0500 Subject: [PATCH] add an configuration option --- examples/step-69/step-69.cc | 17 +++++++++++++++-- examples/step-69/step-69.prm | 11 +++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index 74750c3444..b75a712b09 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -495,7 +495,8 @@ namespace Step69 std::string base_name; double t_final; double output_granularity; - bool enable_compute_error; + + bool asynchronous_writeback; bool resume; @@ -2506,6 +2507,11 @@ namespace Step69 output_granularity, "time interval for output"); + asynchronous_writeback = true; + add_parameter("asynchronous writeback", + asynchronous_writeback, + "Write out solution in a background thread performing IO"); + resume = false; add_parameter("resume", resume, "Resume an interrupted computation."); } @@ -2847,7 +2853,14 @@ namespace Step69 // time stepping in the main loop - the thread will run in the // background. - output_thread = std::move(std::thread(output_worker)); + if (!asynchronous_writeback) + { + output_thread = std::move(std::thread(output_worker)); + } + else + { + output_worker(); + } } } // namespace Step69 diff --git a/examples/step-69/step-69.prm b/examples/step-69/step-69.prm index d2072adf6c..e69826de17 100644 --- a/examples/step-69/step-69.prm +++ b/examples/step-69/step-69.prm @@ -1,17 +1,20 @@ # Listing of Parameters # --------------------- subsection A - MainLoop + # Write out solution in a background thread performing IO + set asynchronous writeback = true + # Base name for all output files - set basename = test + set basename = test # Final time - set final time = 4 + set final time = 4 # time interval for output - set output granularity = 0.02 + set output granularity = 0.02 # Resume an interrupted computation. - set resume = false + set resume = false end -- 2.39.5