X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_Mesh0DElement.cxx;h=95438eab06489782eb060766051d2ef23861e0d2;hp=a1a244c6dc3de014917bce36df57019e6bc02f69;hb=193c49c87753b6ccabb2b5e6dc935aa480d2d43e;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMDS/SMDS_Mesh0DElement.cxx b/src/SMDS/SMDS_Mesh0DElement.cxx index a1a244c6d..95438eab0 100644 --- a/src/SMDS/SMDS_Mesh0DElement.cxx +++ b/src/SMDS/SMDS_Mesh0DElement.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-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 @@ -28,6 +28,8 @@ #include "SMDS_Mesh0DElement.hxx" #include "SMDS_IteratorOfElements.hxx" #include "SMDS_MeshNode.hxx" +#include "SMDS_Mesh.hxx" + #include "utilities.h" using namespace std; @@ -38,7 +40,6 @@ using namespace std; //======================================================================= SMDS_Mesh0DElement::SMDS_Mesh0DElement (const SMDS_MeshNode * node) { - MESSAGE("SMDS_Mesh0DElement " << GetID()); myNode = node; } @@ -140,8 +141,24 @@ const SMDS_MeshNode* SMDS_Mesh0DElement::GetNode(const int ind) const //function : ChangeNode //purpose : //======================================================================= -bool SMDS_Mesh0DElement::ChangeNode (const SMDS_MeshNode * node) +bool SMDS_Mesh0DElement::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes) { - myNode = node; - return true; + if ( nbNodes == 1 ) + { + vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); + vtkIdType npts = 0; + vtkIdType* pts = 0; + grid->GetCellPoints(myVtkID, npts, pts); + if (nbNodes != npts) + { + MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes); + return false; + } + myNode = nodes[0]; + pts[0] = myNode->getVtkId(); + + SMDS_Mesh::_meshList[myMeshId]->setMyModified(); + return true; + } + return false; }