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=966ce9122a1af22ac5b53d8e2edee499c63a5d0d;hb=193c49c87753b6ccabb2b5e6dc935aa480d2d43e;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce diff --git a/src/SMDS/SMDS_Mesh0DElement.cxx b/src/SMDS/SMDS_Mesh0DElement.cxx index 966ce9122..95438eab0 100644 --- a/src/SMDS/SMDS_Mesh0DElement.cxx +++ b/src/SMDS/SMDS_Mesh0DElement.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 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; }