From 7c0522847420ffdd1f41bc26cc7f6504eed916c9 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 6 Mar 2017 17:15:52 +0000 Subject: [PATCH] fix for backward compatibility of Boundary operator: use abs(tag) for query, and revert output for negative edges --- Geo/GModel.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index d1673690f6..97a5fde751 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -452,7 +452,8 @@ void GModel::getBoundaryTags(const std::vector<std::pair<int, int> > &inDimTags, { for(unsigned int i = 0; i < inDimTags.size(); i++){ int dim = inDimTags[i].first; - int tag = inDimTags[i].second; + int tag = std::abs(inDimTags[i].second); // abs for backward compatibility + bool reverse = (inDimTags[i].second < 0); if(dim == 3){ GRegion *gr = getRegionByTag(tag); if(gr){ @@ -492,10 +493,18 @@ void GModel::getBoundaryTags(const std::vector<std::pair<int, int> > &inDimTags, else if(dim == 1){ GEdge *ge = getEdgeByTag(tag); if(ge){ - if(ge->getBeginVertex()) - outDimTags.push_back(std::pair<int, int>(0, ge->getBeginVertex()->tag())); - if(ge->getEndVertex()) - outDimTags.push_back(std::pair<int, int>(0, ge->getEndVertex()->tag())); + if(reverse){ // for backward compatibility + if(ge->getEndVertex()) + outDimTags.push_back(std::pair<int, int>(0, ge->getEndVertex()->tag())); + if(ge->getBeginVertex()) + outDimTags.push_back(std::pair<int, int>(0, ge->getBeginVertex()->tag())); + } + else{ + if(ge->getBeginVertex()) + outDimTags.push_back(std::pair<int, int>(0, ge->getBeginVertex()->tag())); + if(ge->getEndVertex()) + outDimTags.push_back(std::pair<int, int>(0, ge->getEndVertex()->tag())); + } } else Msg::Error("Unknown model edge with tag %d", tag); -- GitLab