--- /dev/null
+
+
+SMDS_Mesh
+ static vector<SMDS_Mesh*> _meshList; --> retrouver un SMDS_Mesh
+ vtkUnstructuredGrid* myGrid;
+
+ vector<SMDS_MeshNode *> myNodes; --> meme index que dans le pointSet de myGrid
+ vector<SMDS_MeshCell *> myCells; --> meme index que dans le cellTypes de myGrid
+
+
+
+SMDS_MeshElement
+ int myID; --> index dans la structure geree par SMDS_Mesh
+ int myMeshId; --> pour retrouver SMDS_Mesh* dans _meshList
+ int myShapeId; --> pour retrouver la subShape
+
+
+SMDS_MeshNode: SMDS_MeshElement
+ SMDS_PositionPtr myPosition; --> objet position dans la shape geom
+ ##vector<int> myInverseElements; --> pour retrouver les elements, vtkCellLinks
+
+
+SMDS_MeshCell: SMDS_MeshElement --> generique pour tous les elements (cells)
+
+
+========= TODO ============
+
+enlever vtkId de SMDS_MeshCell, utiliser SMDS_MeshElementIDFactory.
+
+ajouter ID dans SMDS_Mesh::createTriangle
+verifier ID dans SMDS_Mesh::Find*OrCreate
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMDS : implementaion of Salome mesh data structure
+// File : SMDS_MeshNodeIDFactory.cxx
+// Author : Jean-Michel BOULCOURT
+// Module : SMESH
+//
+#ifdef _MSC_VER
+#pragma warning(disable:4786)
+#endif
+
+#include "SMDS_MeshNodeIDFactory.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_Mesh.hxx"
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkCellType.h>
+
+using namespace std;
+
+//=======================================================================
+//function : SMDS_MeshNodeIDFactory
+//purpose :
+//=======================================================================
+SMDS_MeshNodeIDFactory::SMDS_MeshNodeIDFactory():
+ SMDS_MeshIDFactory(),
+ myMin(0), myMax(0)
+{
+}
+
+//=======================================================================
+//function : BindID
+//purpose :
+//=======================================================================
+bool SMDS_MeshNodeIDFactory::BindID(int ID, SMDS_MeshElement * elem)
+{
+ updateMinMax (ID);
+ return true;
+}
+
+//=======================================================================
+//function : MeshElement
+//purpose :
+//=======================================================================
+SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
+{
+ if ((ID<0) || (ID>myMax))
+ return NULL;
+ const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
+ return (SMDS_MeshElement*)(elem);
+}
+
+//=======================================================================
+//function : ReleaseID
+//purpose :
+//=======================================================================
+void SMDS_MeshNodeIDFactory::ReleaseID(const int ID)
+{
+ SMDS_MeshIDFactory::ReleaseID(ID);
+ if (ID == myMax)
+ myMax = 0; // --- force updateMinMax
+ if (ID == myMin)
+ myMax = 0; // --- force updateMinMax
+}
+
+//=======================================================================
+//function : GetMaxID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshNodeIDFactory::GetMaxID() const
+{
+ if (myMax == 0)
+ updateMinMax();
+ return myMax;
+}
+
+//=======================================================================
+//function : GetMinID
+//purpose :
+//=======================================================================
+
+int SMDS_MeshNodeIDFactory::GetMinID() const
+{
+ if (myMax == 0)
+ updateMinMax();
+ return myMin;
+}
+
+//=======================================================================
+//function : updateMinMax
+//purpose :
+//=======================================================================
+
+void SMDS_MeshNodeIDFactory::updateMinMax() const
+{
+ myMesh->updateNodeMinMax();
+ myMin = myMesh->MinNodeID();
+ myMax = myMesh->MaxNodeID();
+}
+
+SMDS_ElemIteratorPtr SMDS_MeshNodeIDFactory::elementsIterator() const
+{
+ return myMesh->elementsIterator(SMDSAbs_Node);
+}
+
+void SMDS_MeshNodeIDFactory::Clear()
+{
+ myMin = myMax = 0;
+ SMDS_MeshIDFactory::Clear();
+}
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMDS : implementaion of Salome mesh data structure
+// File : SMDS_MeshElementIDFactory.hxx
+// Module : SMESH
+//
+#ifndef _SMDS_MeshNodeIDFactory_HeaderFile
+#define _SMDS_MeshNodeIDFactory_HeaderFile
+
+#include "SMESH_SMDS.hxx"
+
+#include "SMDS_MeshIDFactory.hxx"
+#include "SMDS_ElemIterator.hxx"
+
+#include <vector>
+
+class SMDS_MeshElement;
+
+class SMDS_EXPORT SMDS_MeshNodeIDFactory:public SMDS_MeshIDFactory
+{
+public:
+ SMDS_MeshNodeIDFactory();
+ bool BindID(int ID, SMDS_MeshElement * elem);
+ SMDS_MeshElement * MeshElement(int ID);
+ virtual void ReleaseID(int ID);
+ int GetMaxID() const;
+ int GetMinID() const;
+ SMDS_ElemIteratorPtr elementsIterator() const;
+ virtual void Clear();
+
+protected:
+ void updateMinMax() const;
+ void updateMinMax(int id) const
+ {
+ if (id > myMax) myMax = id;
+ if (id < myMin) myMin = id;
+ }
+
+ mutable int myMin, myMax;
+
+};
+
+#endif
--- /dev/null
+
+
+#include "SMDS_UnstructuredGrid.hxx"
+
+using namespace std;
+
+vtkCellLinks::Link* SMDS_CellLinks::AdjustSize(vtkIdType sz)
+{
+ vtkIdType i;
+ vtkCellLinks::Link *newArray;
+ vtkIdType newSize = sz;
+ vtkCellLinks::Link linkInit = {0,NULL};
+
+ newArray = new vtkCellLinks::Link[newSize];
+
+ for (i=0; i<sz && i<this->Size; i++)
+ {
+ newArray[i] = this->Array[i];
+ }
+
+ for (i=this->Size; i < newSize ; i++)
+ {
+ newArray[i] = linkInit;
+ }
+
+ this->Size = newSize;
+ delete [] this->Array;
+ this->Array = newArray;
+
+ return this->Array;
+}
+
+SMDS_CellLinks* SMDS_CellLinks::New()
+{
+ return new SMDS_CellLinks();
+}
+
+SMDS_CellLinks::SMDS_CellLinks() : vtkCellLinks()
+{
+}
+
+SMDS_CellLinks::~SMDS_CellLinks()
+{
+}
+
+void SMDS_UnstructuredGrid::BuildLinks()
+{
+ // Remove the old links if they are already built
+ if (this->Links)
+ {
+ this->Links->UnRegister(this);
+ }
+
+ this->Links = SMDS_CellLinks::New();
+ this->Links->Allocate(this->GetNumberOfPoints());
+ this->Links->Register(this);
+ this->Links->BuildLinks(this, this->Connectivity);
+ this->Links->Delete();
+}
+
+SMDS_CellLinks* SMDS_UnstructuredGrid::GetCellLinks()
+{
+ return static_cast<SMDS_CellLinks*>(this->Links);
+}
+
+SMDS_UnstructuredGrid* SMDS_UnstructuredGrid::New()
+{
+ return new SMDS_UnstructuredGrid();
+}
+
+SMDS_UnstructuredGrid::SMDS_UnstructuredGrid() : vtkUnstructuredGrid()
+{
+}
+
+SMDS_UnstructuredGrid::~SMDS_UnstructuredGrid()
+{
+}
+
+
--- /dev/null
+/*
+ * File: SMDS_UnstructuredGrid.hxx
+ * Author: prascle
+ *
+ * Created on September 16, 2009, 10:28 PM
+ */
+
+#ifndef _SMDS_UNSTRUCTUREDGRID_HXX
+#define _SMDS_UNSTRUCTUREDGRID_HXX
+
+#include <vtkUnstructuredGrid.h>
+#include <vtkCellLinks.h>
+
+class SMDS_CellLinks: public vtkCellLinks
+{
+public:
+ Link *AdjustSize(vtkIdType sz);
+
+ //virtual void Delete();
+ static SMDS_CellLinks* New();
+protected:
+ SMDS_CellLinks();
+ ~SMDS_CellLinks();
+};
+
+class SMDS_UnstructuredGrid: public vtkUnstructuredGrid
+{
+public:
+ void BuildLinks(); // initialise un SMDS_CellLinks;
+ SMDS_CellLinks* GetCellLinks();
+
+ //virtual void Delete();
+ static SMDS_UnstructuredGrid* New();
+protected:
+ SMDS_UnstructuredGrid();
+ ~SMDS_UnstructuredGrid();
+};
+
+
+#endif /* _SMDS_UNSTRUCTUREDGRID_HXX */
+
--- /dev/null
+
+#ifndef _MEMOIRE_H_
+#define _MEMOIRE_H_
+
+#include <malloc.h>
+#include <iostream>
+
+void memostat( const char* f, int l);
+
+void memostat( const char* f, int l)
+{
+/* struct mallinfo mem = mallinfo(); */
+/* std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " " << mem.uordblks << " " << mem.fordblks << " " << mem.keepcost << std::endl; */
+std::cerr << f << ":"<< l << " --------------------------"<< std::endl;
+ malloc_stats();
+std::cerr << f << ":"<< l << " --------------------------"<< std::endl;
+}
+
+#define MEMOSTAT memostat( __FILE__, __LINE__ )
+
+#endif