From e581c4fcd34f4e0fb1c3eecb10063a04e043db15 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 8 Feb 2012 06:39:35 +0000 Subject: [PATCH] fix logic in getViewByName and getViewByNum to handle the case when no partition number is given --- Common/OpenFile.cpp | 3 ++- Post/PView.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 231a30d830..bbb12bb687 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -375,7 +375,8 @@ int MergeFile(std::string fileName, bool warnIfMissing) tmp->readMSH(fileName); status = GeomMeshMatcher::instance()->match(tmp2, tmp); delete tmp; - } else + } + else status = GModel::current()->readMSH(fileName); #if defined(HAVE_POST) if(status > 1) status = PView::readMSH(fileName); diff --git a/Post/PView.cpp b/Post/PView.cpp index 99dd1084b2..d0f4278a5e 100644 --- a/Post/PView.cpp +++ b/Post/PView.cpp @@ -279,7 +279,7 @@ PView *PView::getViewByName(std::string name, int timeStep, int partition) // search views from most recently to least recently added for(int i = list.size() - 1; i >= 0; i--){ if(list[i]->getData()->getName() == name && - ((timeStep < 0 || !list[i]->getData()->hasTimeStep(timeStep)) || + ((timeStep < 0 || !list[i]->getData()->hasTimeStep(timeStep)) && (partition < 0 || !list[i]->getData()->hasPartition(timeStep, partition)))) return list[i]; } @@ -290,7 +290,7 @@ PView *PView::getViewByNum(int num, int timeStep, int partition) { for(unsigned int i = 0; i < list.size(); i++){ if(list[i]->getNum() == num && - ((timeStep < 0 || !list[i]->getData()->hasTimeStep(timeStep)) || + ((timeStep < 0 || !list[i]->getData()->hasTimeStep(timeStep)) && (partition < 0 || !list[i]->getData()->hasPartition(timeStep, partition)))) return list[i]; } -- GitLab