diff --git a/Box/Box.cpp b/Box/Box.cpp index 0e6af5c28858c50449a4608acaff029bae2a4737..7690ceb28aaf04f00b4ddcc74e6a97d169e85de3 100644 --- a/Box/Box.cpp +++ b/Box/Box.cpp @@ -1,4 +1,4 @@ -// $Id: Box.cpp,v 1.37 2007-09-10 04:47:01 geuzaine Exp $ +// $Id: Box.cpp,v 1.38 2007-09-21 21:14:00 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -78,7 +78,7 @@ int GMSHBOX(int argc, char *argv[]) { ParUtil::Instance()->init(argc, argv); - GModel::list.push_back(new GModel); + new GModel; THEM = new Mesh; InitSymbols(); diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index b1772684563c597fe08130942e4910b6802579df..c7344d3396584d61c4671899bc5e958cd9cbecec 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.110 2007-09-10 05:31:35 geuzaine Exp $ +// $Id: Main.cpp,v 1.111 2007-09-21 21:14:00 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) } // Create a new model - GModel::list.push_back(new GModel); + new GModel; THEM = new Mesh; // Initialize the symbol tree that will hold variable names diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index b69f1edcf1a2f95e8f5897e78ce0ca2f6c5c53bf..587760772226045aabf795893a26f8f93853a49b 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -1,4 +1,4 @@ -// $Id: GModel.cpp,v 1.47 2007-09-12 20:14:34 geuzaine Exp $ +// $Id: GModel.cpp,v 1.48 2007-09-21 21:14:00 geuzaine Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -27,6 +27,20 @@ std::vector<GModel*> GModel::list; +GModel::GModel(std::string name) + : modelName(name), normals(0) +{ + list.push_back(this); +} + +GModel::~GModel() +{ + std::vector<GModel*>::iterator it = std::find(list.begin(), list.end(), this); + if(it != list.end()) list.erase(it); + deleteOCCInternals(); + destroy(); +} + GModel *GModel::current() { if(list.empty()){ @@ -68,7 +82,7 @@ void GModel::destroy() BGMReset(); } -GRegion * GModel::regionByTag(int n) const +GRegion *GModel::regionByTag(int n) const { GEntity tmp((GModel*)this, n); riter it = regions.find((GRegion*)&tmp); @@ -78,7 +92,7 @@ GRegion * GModel::regionByTag(int n) const return 0; } -GFace * GModel::faceByTag(int n) const +GFace *GModel::faceByTag(int n) const { GEntity tmp((GModel*)this, n); fiter it = faces.find((GFace*)&tmp); @@ -88,7 +102,7 @@ GFace * GModel::faceByTag(int n) const return 0; } -GEdge * GModel::edgeByTag(int n) const +GEdge *GModel::edgeByTag(int n) const { GEntity tmp((GModel*)this, n); eiter it = edges.find((GEdge*)&tmp); @@ -98,7 +112,7 @@ GEdge * GModel::edgeByTag(int n) const return 0; } -GVertex * GModel::vertexByTag(int n) const +GVertex *GModel::vertexByTag(int n) const { GEntity tmp((GModel*)this, n); viter it = vertices.find((GVertex*)&tmp); @@ -291,7 +305,7 @@ bool GModel::noPhysicalGroups() return true; } -static void addInGroup(GEntity* ge, std::map<int, std::vector<GEntity*> > &group) +static void addInGroup(GEntity *ge, std::map<int, std::vector<GEntity*> > &group) { for(unsigned int i = 0; i < ge->physicals.size(); i++){ // physicals can be stored with negative signs when the entity diff --git a/Geo/GModel.h b/Geo/GModel.h index b0ed6925a54f0c7b69466cf301b815a88cb04506..77955f031bd011ab4ef2969b178ff17ee40f37b4 100644 --- a/Geo/GModel.h +++ b/Geo/GModel.h @@ -32,8 +32,6 @@ // OCC Internals have to be stored in the model class OCC_Internals; -// Fourier Internals have to be stored in the model -class F_Internals; // A geometric model. The model is a "not yet" non-manifold B-Rep. class GModel @@ -41,7 +39,6 @@ class GModel protected: void deleteOCCInternals(); OCC_Internals *occ_internals; - F_Internals *f_internals; std::string modelName; std::set<GRegion*, GEntityLessThan> regions; @@ -52,9 +49,8 @@ class GModel std::map<int, std::string> physicalNames; public: - GModel() : modelName("Untitled"), normals(0) {} - GModel(const std::string &name) : modelName(name), normals(0) {} - ~GModel(){ deleteOCCInternals(); destroy(); } + GModel(std::string name=""); + ~GModel(); // the static list of all loaded models static std::vector<GModel*> list;