Salome HOME
0021954: [CEA 706] Error at the mesh object creation
[modules/smesh.git] / src / SMDS / SMDS_VtkEdge.cxx
index 6cd006d51752510429018d70e5bd89c45acad1ba..cb324014ec4b58fc8f1023a0542b96c28917acc1 100644 (file)
@@ -1,3 +1,22 @@
+// Copyright (C) 2010-2012  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.
+//
+// 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
+//
+
 #include "SMDS_VtkEdge.hxx"
 #include "SMDS_MeshNode.hxx"
 #include "SMDS_Mesh.hxx"
@@ -25,8 +44,8 @@ SMDS_VtkEdge::~SMDS_VtkEdge()
 
 void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
 {
+  SMDS_MeshEdge::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
-  myIdInShape = -1;
   myMeshId = mesh->getMeshId();
   vtkIdType aType = VTK_LINE;
   if (nodeIds.size() == 3)
@@ -115,8 +134,10 @@ vtkIdType SMDS_VtkEdge::GetVtkType() const
 const SMDS_MeshNode*
 SMDS_VtkEdge::GetNode(const int ind) const
 {
-  // TODO optimize !!
-  return SMDS_MeshElement::GetNode(ind);
+  vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
+  vtkIdType npts, *pts;
+  grid->GetCellPoints( this->myVtkID, npts, pts );
+  return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
 }
 
 bool SMDS_VtkEdge::IsQuadratic() const