X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_MeshVolume.cxx;h=ee9eb939fa0a11fbe1e681b9aff2753162271ad5;hp=ec1ecc0c049544800ec1ca0b9aa8c0fa8abf5a85;hb=e67f8c2cabe52f01cc64b646330f3827ab06bb13;hpb=d66fe4a5001bedf93141cbac20a9b8c32f8af3bd diff --git a/src/SMDS/SMDS_MeshVolume.cxx b/src/SMDS/SMDS_MeshVolume.cxx index ec1ecc0c0..ee9eb939f 100644 --- a/src/SMDS/SMDS_MeshVolume.cxx +++ b/src/SMDS/SMDS_MeshVolume.cxx @@ -75,6 +75,45 @@ void SMDS_MeshVolume::init( const std::vector& vtkNodeIds ) SMDS_MeshCell::init( aType, vtkNodeIds ); } +bool SMDS_MeshVolume::ChangeNodes(const std::vector& nodes, + const std::vector& quantities) const +{ + if ( !IsPoly() ) + return false; + + vtkIdType nFaces = 0; + vtkIdType* ptIds = 0; + getGrid()->GetFaceStream( GetVtkID(), nFaces, ptIds ); + + // stream size and nb faces should not change + + if ((int) quantities.size() != nFaces ) + { + return false; + } + int id = 0, nbPoints = 0; + for ( int i = 0; i < nFaces; i++ ) + { + int nodesInFace = ptIds[id]; + nbPoints += nodesInFace; + id += (nodesInFace + 1); + } + if ((int) nodes.size() != nbPoints ) + { + return false; + } + + // update ptIds + size_t iP = 0, iN = 0; + for ( size_t i = 0; i < quantities.size(); ++i ) + { + ptIds[ iP++ ] = quantities[ i ]; // nb face nodes + for ( int j = 0; j < quantities[ i ]; ++j ) + ptIds[ iP++ ] = nodes[ iN++ ]->GetVtkID(); + } + return true; +} + const SMDS_MeshNode* SMDS_MeshVolume::GetNode(const int ind) const { if ( !IsPoly() )