From 4af1d09533b1290c033ae192a0d3c6f801dfe4de Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 26 Dec 2019 09:24:01 -0600 Subject: [PATCH] use write_vtu_with_pvtu_record, code cleanup --- examples/step-69/step-69.cc | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/examples/step-69/step-69.cc b/examples/step-69/step-69.cc index 95a1ec813a..8823c0f2cb 100644 --- a/examples/step-69/step-69.cc +++ b/examples/step-69/step-69.cc @@ -1993,16 +1993,9 @@ namespace Step69 template void TimeLoop::run() { - if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0) - { - pcout << "Reading parameters and allocating objects... " << std::flush; - ParameterAcceptor::initialize("step-69.prm"); - pcout << "done" << std::endl; - } - else - { - ParameterAcceptor::initialize("step-69.prm"); - } + pcout << "Reading parameters and allocating objects... " << std::flush; + ParameterAcceptor::initialize("step-69.prm"); + pcout << "done" << std::endl; print_head(pcout, "create triangulation"); discretization.setup(); @@ -2177,28 +2170,7 @@ namespace Step69 DataOutBase::VtkFlags::best_speed); data_out.set_flags(flags); - const auto filename = [&](const unsigned int i) -> std::string { - const auto seq = dealii::Utilities::int_to_string(i, 4); - return name + "-" + Utilities::int_to_string(cycle, 6) + "-" + seq + - ".vtu"; - }; - - const unsigned int i = triangulation.locally_owned_subdomain(); - std::ofstream output(filename(i)); - data_out.write_vtu(output); - - if (dealii::Utilities::MPI::this_mpi_process(mpi_communicator) == 0) - { - const unsigned int n_mpi_processes = - dealii::Utilities::MPI::n_mpi_processes(mpi_communicator); - std::vector filenames; - for (unsigned int i = 0; i < n_mpi_processes; ++i) - filenames.push_back(filename(i)); - - std::ofstream output(name + "-" + Utilities::int_to_string(cycle, 6) + - ".pvtu"); - data_out.write_pvtu_record(output, filenames); - } + data_out.write_vtu_with_pvtu_record("", name, cycle, 6, mpi_communicator); }; output_thread = std::move(std::thread(output_worker)); -- 2.39.5