From a4746ccec571fecc8f0085383029cec96d936475 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 18 Oct 2014 06:31:40 +0000 Subject: [PATCH] revert commit 19530 for now - this breaks loading models when another model is already loaded --- Common/OpenFile.cpp | 18 +++++++++++++++++- Geo/Geo.cpp | 13 ------------- Geo/Geo.h | 2 -- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index bb175c76bb..b6f67986bc 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -152,6 +152,22 @@ void AddToTemporaryBoundingBox(double x, double y, double z) for(int i = 0; i < 3; i++) CTX::instance()->cg[i] = temp_bb.center()[i]; } +static void ComputeMaxEntityNum() +{ + GModel::current()->getGEOInternals()->MaxPointNum = + std::max(GModel::current()->getGEOInternals()->MaxPointNum, + GModel::current()->getMaxElementaryNumber(0)); + GModel::current()->getGEOInternals()->MaxLineNum = + std::max(GModel::current()->getGEOInternals()->MaxLineNum, + GModel::current()->getMaxElementaryNumber(1)); + GModel::current()->getGEOInternals()->MaxSurfaceNum = + std::max(GModel::current()->getGEOInternals()->MaxSurfaceNum, + GModel::current()->getMaxElementaryNumber(2)); + GModel::current()->getGEOInternals()->MaxVolumeNum = + std::max(GModel::current()->getGEOInternals()->MaxVolumeNum, + GModel::current()->getMaxElementaryNumber(3)); +} + static std::vector<gmshFILE> openedFiles; int ParseFile(const std::string &fileName, bool close, bool warnIfMissing) @@ -468,7 +484,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setWindowTit } } - GModel::current()->getGEOInternals()->ComputeMaxEntityNum(); + ComputeMaxEntityNum(); if(setBoundingBox) SetBoundingBox(); CTX::instance()->geom.draw = 1; CTX::instance()->mesh.changed = ENT_ALL; diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 8f955dc7b7..dc09d2882f 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -4544,7 +4544,6 @@ void GEO_Internals::alloc_all() { MaxPointNum = MaxLineNum = MaxLineLoopNum = MaxSurfaceNum = 0; MaxSurfaceLoopNum = MaxVolumeNum = MaxPhysicalNum = 0; - ComputeMaxEntityNum(); Points = Tree_Create(sizeof(Vertex *), compareVertex); Curves = Tree_Create(sizeof(Curve *), compareCurve); EdgeLoops = Tree_Create(sizeof(EdgeLoop *), compareEdgeLoop); @@ -4575,18 +4574,6 @@ void GEO_Internals::reset_physicals() List_Reset(PhysicalGroups); } -void GEO_Internals::ComputeMaxEntityNum() -{ - MaxPointNum = - std::max(MaxPointNum, GModel::current()->getMaxElementaryNumber(0)); - MaxLineNum = - std::max(MaxLineNum, GModel::current()->getMaxElementaryNumber(1)); - MaxSurfaceNum = - std::max(MaxSurfaceNum, GModel::current()->getMaxElementaryNumber(2)); - MaxVolumeNum = - std::max(MaxVolumeNum, GModel::current()->getMaxElementaryNumber(3)); -} - int select_contour(int type, int num, List_T * List) { int k = 0; diff --git a/Geo/Geo.h b/Geo/Geo.h index f454c47959..024c7adb16 100644 --- a/Geo/Geo.h +++ b/Geo/Geo.h @@ -297,8 +297,6 @@ class GEO_Internals{ void reset_physicals(); std::map<int,int> periodicFaces; std::map<int,int> periodicEdges; - - void ComputeMaxEntityNum(); }; class Shape{ -- GitLab