From 493e92ab3e79822867f461f1ebc15dace097aa7f Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 8 Jun 2022 15:36:25 +0200 Subject: [PATCH] [A/AppLib/TestDefinition] If mpi size is one do it like in serial case. --- .../ApplicationsLib/TestDefinition.cpp | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Applications/ApplicationsLib/TestDefinition.cpp b/Applications/ApplicationsLib/TestDefinition.cpp index faeadce1a5a..c91f59bf386 100644 --- a/Applications/ApplicationsLib/TestDefinition.cpp +++ b/Applications/ApplicationsLib/TestDefinition.cpp @@ -191,20 +191,21 @@ TestDefinition::TestDefinition(BaseLib::ConfigTree const& config_tree, } else { + std::string filename = + //! \ogs_file_param{prj__test_definition__vtkdiff__file} + vtkdiff_config.getConfigParameter<std::string>("file"); #ifdef USE_PETSC - int rank; - MPI_Comm_rank(PETSC_COMM_WORLD, &rank); int mpi_size; MPI_Comm_size(PETSC_COMM_WORLD, &mpi_size); - std::string const& filename = - MeshLib::IO::getVtuFileNameForPetscOutputWithoutExtension( - //! \ogs_file_param{prj__test_definition__vtkdiff__file} - vtkdiff_config.getConfigParameter<std::string>("file")) + - "_" + std::to_string(rank) + ".vtu"; -#else - std::string const& filename = - //! \ogs_file_param{prj__test_definition__vtkdiff__file} - vtkdiff_config.getConfigParameter<std::string>("file"); + if (mpi_size > 1) + { + int rank; + MPI_Comm_rank(PETSC_COMM_WORLD, &rank); + filename = + MeshLib::IO::getVtuFileNameForPetscOutputWithoutExtension( + filename) + + "_" + std::to_string(rank) + ".vtu"; + } #endif // OGS_USE_PETSC filenames.push_back(filename); } -- GitLab