Salome HOME
ObjectPool and SMDS_Position
[modules/smesh.git] / src / SMDS / SMDS_MeshElement.cxx
index 646f92d10cf6de7901a1d3c1dabb7f067c8d6e9a..fdbeffd86f0a1c19959efe7003c119ec48407b26 100644 (file)
 
 using namespace std;
 
-SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID)
+int SMDS_MeshCell::nbCells = 0;
+
+SMDS_MeshElement::SMDS_MeshElement(int ID):myID(ID), myMeshId(-1), myShapeId(-1)
+{
+}
+
+SMDS_MeshElement::SMDS_MeshElement(int id, UShortType meshId, ShortType shapeId):
+  myID(id), myMeshId(meshId), myShapeId(shapeId)
 {
 }
 
@@ -202,12 +209,13 @@ bool SMDS_MeshElement::IsValidIndex(const int ind) const
 
 const SMDS_MeshNode* SMDS_MeshElement::GetNode(const int ind) const
 {
-  SMDS_ElemIteratorPtr it = nodesIterator();
-  int i = 0, index = WrappedIndex( ind );
-  while ( index != i++ )
-    it->next();
-  if ( it->more() )
-    return static_cast<const SMDS_MeshNode*> (it->next());
+  if ( ind >= 0 ) {
+    SMDS_ElemIteratorPtr it = nodesIterator();
+    for ( int i = 0; i < ind; ++i )
+      it->next();
+    if ( it->more() )
+      return static_cast<const SMDS_MeshNode*> (it->next());
+  }
   return 0;
 }
 
@@ -237,3 +245,14 @@ int SMDS_MeshElement::GetNodeIndex( const SMDS_MeshNode* node ) const
       return i;
   return -1;
 }
+
+SMDS_MeshCell::SMDS_MeshCell()
+{
+  nbCells++;
+  myVtkID = -1;
+};
+
+SMDS_MeshCell::~SMDS_MeshCell()
+{
+  nbCells--;
+}
\ No newline at end of file