diff --git a/ProcessLib/Output/Output.cpp b/ProcessLib/Output/Output.cpp index 183d6a03be72d14f14b114ce9bae329117b91264..4fc1a5fdf41d8f3221eff0c0cd01ad6cd15f5d16 100644 --- a/ProcessLib/Output/Output.cpp +++ b/ProcessLib/Output/Output.cpp @@ -211,13 +211,16 @@ bool Output::isOutputStep(int timestep, double const t) const } bool Output::isOutputProcess(const int process_id, const Process& process) const { + auto const n_processes = static_cast<int>(_process_to_pvd_file.size() / + _mesh_names_for_output.size()); + + auto const is_last_process = process_id == n_processes - 1; + return process.isMonolithicSchemeUsed() // For the staggered scheme for the coupling, only the last process, // which gives the latest solution within a coupling loop, is allowed // to make output. - || process_id == static_cast<int>(_process_to_pvd_file.size() / - _mesh_names_for_output.size()) - - 1; + || is_last_process; } Output::Output(std::string directory, OutputType file_type, @@ -491,11 +494,7 @@ void Output::doOutputNonlinearIteration(Process const& process, addProcessDataToMesh(t, xs, process_id, process_output_data, output_secondary_variable, _output_data_specification); - // For the staggered scheme for the coupling, only the last process, which - // gives the latest solution within a coupling loop, is allowed to make - // output. - if (!(process_id == static_cast<int>(_process_to_pvd_file.size()) - 1 || - process.isMonolithicSchemeUsed())) + if (!isOutputProcess(process_id, process)) { return; } diff --git a/ProcessLib/Output/Output.h b/ProcessLib/Output/Output.h index fbb5e36978ad6db7a61ce64d3a0fd1a2f92ce6f2..154496a042521bccfef6f9d80475001dd4ad54be 100644 --- a/ProcessLib/Output/Output.h +++ b/ProcessLib/Output/Output.h @@ -161,6 +161,12 @@ private: //! Given times that steps have to reach. std::vector<double> const _fixed_output_times; + //! Holds the PVD files associated with each process. + //! + //! Each \c process_id of each Process (in the current simulation) has a PVD + //! file in this map for each element of #_mesh_names_for_output. I.e., the + //! number of elements in this map is (roughly): + //! <no. of processes> x <no. of process IDs per process> x <no. of meshes>. std::multimap<Process const*, MeshLib::IO::PVDFile> _process_to_pvd_file; OutputDataSpecification const _output_data_specification;