FEM: Use single smesh mesh generator throughout FreeCAD

Creating a mesh generator resets a critical data structure and makes all existing meshes invalid. Hence the SMESH_gen is made a singleton and all FreeCAD code is changed accordingly.
This commit is contained in:
Stefan Tröger
2016-05-15 21:13:59 +02:00
committed by wmayer
parent 0845791752
commit 2f57406007
6 changed files with 44 additions and 41 deletions

View File

@@ -60,8 +60,9 @@ typedef std::set<int> TSetOfInt;
class SMESH_EXPORT SMESH_Gen
{
public:
SMESH_Gen();
~SMESH_Gen();
static SMESH_Gen* get();
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
throw(SALOME_Exception);
@@ -159,6 +160,10 @@ public:
// std::map < int, SMESH_2D_Algo * >_map2D_Algo;
// std::map < int, SMESH_3D_Algo * >_map3D_Algo;
protected:
SMESH_Gen();
static SMESH_Gen* generator;
private:
int _localId; // unique Id of created objects, within SMESH_Gen entity

View File

@@ -55,6 +55,7 @@ using namespace std;
//#include <vtkDebugLeaks.h>
SMESH_Gen* SMESH_Gen::generator = nullptr;
//=============================================================================
/*!
@@ -74,6 +75,15 @@ SMESH_Gen::SMESH_Gen()
//vtkDebugLeaks::SetExitError(0);
}
SMESH_Gen* SMESH_Gen::get() {
if(!generator)
generator = new SMESH_Gen();
return generator;
}
//=============================================================================
/*!
* Destructor