From: Krishnakumar Gopalakrishnan Date: Sun, 5 Apr 2020 21:33:50 +0000 (+0100) Subject: fixes issue 9722 by correctly writing time data into a aggregate pvd file (one per... X-Git-Tag: v9.2.0-rc1~235^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89c4e12784daf79195e667aaca07f3a98bf33cb2;p=dealii.git fixes issue 9722 by correctly writing time data into a aggregate pvd file (one per each time-stepping scheme fixes indendation issues. addresses code-review comments by Daniel Arndt --- diff --git a/examples/step-52/step-52.cc b/examples/step-52/step-52.cc index ef3a8845ff..c619be95a9 100644 --- a/examples/step-52/step-52.cc +++ b/examples/step-52/step-52.cc @@ -449,17 +449,32 @@ namespace Step52 DataOut<2> data_out; data_out.attach_dof_handler(dof_handler); - data_out.add_data_vector(solution, "solution"); + std::string solution_name = "solution_" + method_name; + data_out.add_data_vector(solution, solution_name); data_out.build_patches(); data_out.set_flags(DataOutBase::VtkFlags(time, time_step)); - const std::string filename = "solution-" + method_name + "-" + - Utilities::int_to_string(time_step, 3) + - ".vtu"; + const std::string filename = + solution_name + Utilities::int_to_string(time_step, 3) + ".vtu"; std::ofstream output(filename); data_out.write_vtu(output); + + static std::vector> times_and_names; + + static std::string method_name_prev = ""; + static std::string pvd_filename; + if (method_name_prev != method_name) + { + std::cout << "Starting a new time-stepping scheme ..." << std::endl; + times_and_names.clear(); + method_name_prev = method_name; + pvd_filename = "solution_" + method_name + ".pvd"; + } + times_and_names.emplace_back(time, filename); + std::ofstream pvd_output(pvd_filename); + DataOutBase::write_pvd_record(pvd_output, times_and_names); }