Salome HOME
general crack dialog, save log in file
[modules/smesh.git] / src / SMDS / SMDS_VtkVolume.cxx
index 22f5de67ed250c3a277dd5828ff649fafc806598..efc0f786c4e78b0b5a6539e083af60568d330eb3 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2010-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2010-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // 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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -95,7 +95,7 @@ void SMDS_VtkVolume::initPoly(const std::vector<vtkIdType>& nodeIds,
   SMDS_UnstructuredGrid* grid = mesh->getGrid();
   //double center[3];
   //this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), &center[0]);
-  vector<vtkIdType> ptIds;
+  std::vector<vtkIdType> ptIds;
   vtkIdType nbFaces = nbNodesPerFace.size();
   int k = 0;
   for (int i = 0; i < nbFaces; i++)
@@ -165,7 +165,7 @@ bool SMDS_VtkVolume::vtkOrder(const SMDS_MeshNode* nodes[], const int nbNodes)
   const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( aVtkType ));
   if ( !interlace.empty() )
   {
-    ASSERT( interlace.size() == nbNodes );
+    ASSERT( (int)interlace.size() == nbNodes );
     std::vector<const SMDS_MeshNode*> initNodes( nodes, nodes+nbNodes );
     for ( size_t i = 0; i < interlace.size(); ++i )
       nodes[i] = initNodes[ interlace[i] ];
@@ -365,7 +365,7 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int n
  */
 std::vector<int> SMDS_VtkVolume::GetQuantities() const
 {
-  vector<int> quantities;
+  std::vector<int> quantities;
   SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
   vtkUnstructuredGrid* grid = mesh->getGrid();
   vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
@@ -462,14 +462,13 @@ int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const
     vtkIdType nFaces = 0;
     vtkIdType* ptIds = 0;
     grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
-    int id = 0, nbPoints = 0;
+    int id = 0;
     for (int iF = 0; iF < nFaces; iF++)
     {
       int nodesInFace = ptIds[id];
       for ( vtkIdType i = 0; i < nodesInFace; ++i )
-        if ( ptIds[id+i] == node->getVtkId() )
+        if ( ptIds[id+i+1] == node->getVtkId() )
           return id+i-iF;
-      nbPoints += nodesInFace;
       id += (nodesInFace + 1);
     }
     return -1;
@@ -558,7 +557,6 @@ bool SMDS_VtkVolume::IsMediumNode(const SMDS_MeshNode* node) const
 int SMDS_VtkVolume::NbCornerNodes() const
 {
   vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
-  int            nbN = grid->GetCell(myVtkID)->GetNumberOfPoints();
   vtkIdType aVtkType = grid->GetCellType(myVtkID);
   switch (aVtkType)
   {
@@ -569,7 +567,7 @@ int SMDS_VtkVolume::NbCornerNodes() const
   case VTK_TRIQUADRATIC_HEXAHEDRON: return 8;
   default:;
   }
-  return nbN;
+  return NbNodes();
 }
 
 SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
@@ -721,6 +719,6 @@ int SMDS_VtkVolume::NbUniqueNodes() const
  */
 SMDS_ElemIteratorPtr SMDS_VtkVolume::uniqueNodesIterator() const
 {
-  MESSAGE("uniqueNodesIterator");
+  //MESSAGE("uniqueNodesIterator");
   return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
 }