From ebefbf6735ba9ddc9238a927b33e7bf2f121058c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 21 Aug 2009 09:16:58 +0000 Subject: [PATCH] GModel::readGEO must be a static member function, since the parser can now create multiple models! --- Common/OpenFile.cpp | 8 ++------ Geo/GModel.h | 3 ++- Geo/GModelIO_Geo.cpp | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 81f15cd90a..eec1795dfb 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -206,8 +206,7 @@ void ParseString(std::string str) if(fp){ fprintf(fp, "%s\n", str.c_str()); fclose(fp); - ParseFile(fileName, true); - GModel::current()->importGEOInternals(); + GModel::readGEO(fileName); } } @@ -363,10 +362,7 @@ int MergeFile(std::string fileName, bool warnIfMissing) } #endif else { - // don't use readGEO here (ParseFile is allowed to change the - // current model) - ParseFile(fileName, true); - status = GModel::current()->importGEOInternals(); + status = GModel::readGEO(fileName); } } diff --git a/Geo/GModel.h b/Geo/GModel.h index 126600e361..c2b31682d9 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -314,7 +314,8 @@ class GModel // Gmsh native CAD format int importGEOInternals(); - int readGEO(const std::string &name); + // read is static, since it can create multiple models + static int readGEO(const std::string &name); int writeGEO(const std::string &name, bool printLabels=true); // Fourier model diff --git a/Geo/GModelIO_Geo.cpp b/Geo/GModelIO_Geo.cpp index 2bd5313f24..0fe4956ac6 100644 --- a/Geo/GModelIO_Geo.cpp +++ b/Geo/GModelIO_Geo.cpp @@ -38,7 +38,7 @@ void GModel::_deleteGEOInternals() int GModel::readGEO(const std::string &name) { ParseFile(name, true); - return importGEOInternals(); + return GModel::current()->importGEOInternals(); } int GModel::importGEOInternals() -- GitLab