From 811f3e87b885d2f317ff975a9ad153524cd57a14 Mon Sep 17 00:00:00 2001 From: Siqi Ling <lsq0473@gmail.com> Date: Thu, 22 Oct 2015 12:47:18 +0000 Subject: [PATCH] fix a bug when arh3writer is used directly by usr in parallel --- AMDiS/src/io/FileWriter.cc | 2 +- AMDiS/src/io/detail/Arh3Writer.cc | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/AMDiS/src/io/FileWriter.cc b/AMDiS/src/io/FileWriter.cc index 77e25e6a..84c588fa 100644 --- a/AMDiS/src/io/FileWriter.cc +++ b/AMDiS/src/io/FileWriter.cc @@ -231,7 +231,7 @@ namespace AMDiS createSubDir > 0); } #endif - Arh3Writer::writeFile(solutionVecs, fn + ".arh"); + Arh3Writer::writeFile(solutionVecs, fn + ".arh", false); } diff --git a/AMDiS/src/io/detail/Arh3Writer.cc b/AMDiS/src/io/detail/Arh3Writer.cc index e421fe10..b34217ad 100644 --- a/AMDiS/src/io/detail/Arh3Writer.cc +++ b/AMDiS/src/io/detail/Arh3Writer.cc @@ -219,7 +219,25 @@ namespace AMDiS { namespace io { TEST_EXIT(nameset.size() == vecs.size()) ("DOFVectors in vecs cannot have idential name. Please check.\n"); - + +#ifdef HAVE_PARALLEL_DOMAIN_AMDIS + if (writeParallel) { + using boost::lexical_cast; + + int sPos = filename.find(".arh"); + TEST_EXIT(sPos >= 0)("Failed to find file postfix!\n"); + string name = filename.substr(0, sPos); + std::vector<int> macroIdx; + + Mesh* mesh_ = mesh ? mesh : vecs[0]->getFeSpace()->getMesh(); + + if (MPI::COMM_WORLD.Get_rank() == 0) + writeParallelFile(name + ".parh", mesh_, false); + + filename = name + "-p" + lexical_cast<string>(MPI::COMM_WORLD.Get_rank()) + "-.arh"; + } +#endif + bool multiMesh = meshset.size() > 1; //if mesh exists, the meshes in vecs should be the same. -- GitLab