Salome HOME
PR: synchro V6_main tag mergeto_V7_main_11Feb13
[modules/smesh.git] / src / SMDS / SMDS_VtkEdge.cxx
index a314565c7b670742ae4f8b3276491ca30628e068..d3cf38655f7a4732cc333a39e18b176e5d25f1a9 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"
@@ -14,7 +33,7 @@ SMDS_VtkEdge::SMDS_VtkEdge()
 {
 }
 
-SMDS_VtkEdge::SMDS_VtkEdge(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
+SMDS_VtkEdge::SMDS_VtkEdge(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   init(nodeIds, mesh);
 }
@@ -23,7 +42,7 @@ SMDS_VtkEdge::~SMDS_VtkEdge()
 {
 }
 
-void SMDS_VtkEdge::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
+void SMDS_VtkEdge::init(std::vector<vtkIdType>& nodeIds, SMDS_Mesh* mesh)
 {
   SMDS_MeshEdge::init();
   vtkUnstructuredGrid* grid = mesh->getGrid();
@@ -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