]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fixes issue 9722 by correctly writing time data into a aggregate pvd file (one per... 9833/head
authorKrishnakumar Gopalakrishnan <krishna.kumar@ucl.ac.uk>
Sun, 5 Apr 2020 21:33:50 +0000 (22:33 +0100)
committerKrishnakumar Gopalakrishnan <krishna.kumar@ucl.ac.uk>
Tue, 14 Apr 2020 00:49:08 +0000 (01:49 +0100)
fixes indendation issues. addresses code-review comments by Daniel Arndt

examples/step-52/step-52.cc

index ef3a8845ff403ad159808f89ae41c8d1781a2a54..c619be95a9a45f0bfe6fbe3a288c7fd13436932b 100644 (file)
@@ -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<std::pair<double, std::string>> 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);
   }
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.