From 16b3817a687451b1e4b06b8b6d8b2a4ddcbeb17d Mon Sep 17 00:00:00 2001 From: acrovato <a.crovato@uliege.be> Date: Fri, 13 Jan 2023 11:40:18 +0100 Subject: [PATCH] Fix tag numbers in Body. Write dummy elementary tags in GmshExport to have consistent display in Gmsh. --- sdpm/src/sdpmBody.cpp | 2 +- sdpm/src/sdpmGmshExport.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdpm/src/sdpmBody.cpp b/sdpm/src/sdpmBody.cpp index 6d85032..9f9e496 100644 --- a/sdpm/src/sdpmBody.cpp +++ b/sdpm/src/sdpmBody.cpp @@ -44,7 +44,7 @@ Body::Body(Mesh &msh, std::string const &name, std::string const &teName, double if (it == tags.end()) { // create tag and add it to the mesh - Tag *tagp = new Tag(tags.rbegin()->second->getId() + 1, wkName, 2); + Tag *tagp = new Tag(tags.size() + 1, wkName, 2); _msh.addTag(wkName, tagp); // translate TE nodes (along x-coordinate) std::vector<Node *> wkNodes; diff --git a/sdpm/src/sdpmGmshExport.cpp b/sdpm/src/sdpmGmshExport.cpp index c83af97..dc0bd08 100644 --- a/sdpm/src/sdpmGmshExport.cpp +++ b/sdpm/src/sdpmGmshExport.cpp @@ -69,13 +69,13 @@ void GmshExport::save(std::string const &sfx) const for (auto e : elems) { fprintf(file, "%zu %zu %zu", e->getId(), static_cast<size_t>(e->getType()), static_cast<size_t>(2)); - // physical tag + // physical and elementary (equal to physical since not recorded) tags if (e->getTag()) - fprintf(file, " %zu", e->getTag()->getId()); + for (size_t i = 0; i < 2; ++i) + fprintf(file, " %zu", e->getTag()->getId()); else - fprintf(file, " 0"); - // elementary tag (always 0 since not recorded) - fprintf(file, " 0"); + for (size_t i = 0; i < 2; ++i) + fprintf(file, " 0"); // nodes for (auto n : e->getNodes()) fprintf(file, " %zu", n->getId()); -- GitLab