X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMDS%2FSMDS_UnstructuredGrid.cxx;h=8da9a287b7bfddfa3f729a115878185815f71c70;hb=665d037f93371114bf4b00bf11b0f95be418fb77;hp=72cb0fa000d0971db372c43508e9c0d06986a608;hpb=6d32f944a0a115b6419184c50b57bf7c4eef5786;p=modules%2Fsmesh.git diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 72cb0fa00..8da9a287b 100644 --- a/src/SMDS/SMDS_UnstructuredGrid.cxx +++ b/src/SMDS/SMDS_UnstructuredGrid.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2019 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2010-2020 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 @@ -46,7 +46,7 @@ void SMDS_CellLinks::ResizeForPoint(vtkIdType vtkID) if ( vtkID > this->MaxId ) { this->MaxId = vtkID; - if ( vtkID >= this->Size ) + if ( vtkID >= this->Size ) vtkCellLinks::Resize( vtkID+SMDS_Mesh::chunkSize ); } } @@ -59,7 +59,7 @@ void SMDS_CellLinks::BuildLinks(vtkDataSet *data, vtkCellArray *Connectivity, vt vtkIdType j, cellId = 0; unsigned short *linkLoc; vtkIdType npts=0; - vtkIdType *pts=0; + vtkIdType const *pts(nullptr); vtkIdType loc = Connectivity->GetTraversalLocation(); // traverse data to determine number of uses of each point @@ -158,18 +158,15 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p i++; for (int k = 0; k < nbnodes; k++) { - setOfNodes.insert(pts[i]); + if ( setOfNodes.insert( pts[i] ).second ) + { + (static_cast< vtkCellLinks * >(this->Links.GetPointer()))->ResizeCellList( pts[i], 1 ); + (static_cast< vtkCellLinks * >(this->Links.GetPointer()))->AddCellReference( cellid, pts[i] ); + } i++; } } - std::set::iterator it = setOfNodes.begin(); - for (; it != setOfNodes.end(); ++it) - { - this->Links->ResizeCellList(*it, 1); - this->Links->AddCellReference(cellid, *it); - } - return cellid; } @@ -228,7 +225,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n if ( false /*!updateCells*/ ) // no holes in elements { this->Connectivity->Squeeze(); - this->Locations->Squeeze(); + this->CellLocations->Squeeze(); this->Types->Squeeze(); if ( this->FaceLocations ) { @@ -252,7 +249,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n if ( newCellSize != oldCellSize ) for ( int i = 0; i < oldCellSize - 1; ++i ) if ( this->Types->GetValue( i ) == VTK_EMPTY_CELL ) - newConnectivitySize -= this->Locations->GetValue( i+1 ) - this->Locations->GetValue( i ); + newConnectivitySize -= this->Connectivity->GetCellSize( i ); vtkCellArray *newConnectivity = vtkCellArray::New(); newConnectivity->Initialize(); @@ -323,12 +320,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n newFaceLocations->Squeeze(); newFaces->Squeeze(); this->SetCells( newTypes, newLocations, newConnectivity, newFaceLocations, newFaces ); + this->CellLocations = newLocations; newFaceLocations->Delete(); newFaces->Delete(); } else { this->SetCells( newTypes, newLocations, newConnectivity, FaceLocations, Faces ); + this->CellLocations = newLocations; } newTypes->Delete(); @@ -337,7 +336,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector& idNodesOldToNew, int n } void SMDS_UnstructuredGrid::copyNodes(vtkPoints * newPoints, - std::vector& idNodesOldToNew, + std::vector& /*idNodesOldToNew*/, int& alreadyCopied, int start, int end) @@ -363,10 +362,11 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray * newTypes, { int iOld = idCellsNewToOld[ iNew ]; newTypes->SetValue( iNew, this->Types->GetValue( iOld )); - vtkIdType oldLoc = this->Locations->GetValue( iOld ); + + vtkIdType oldLoc = ((vtkIdTypeArray *)(this->Connectivity->GetOffsetsArray()))->GetValue( iOld ); vtkIdType nbpts; - vtkIdType *oldPtsCell = 0; - this->Connectivity->GetCell( oldLoc, nbpts, oldPtsCell ); + vtkIdType const *oldPtsCell(nullptr); + this->Connectivity->GetCell( oldLoc+iOld, nbpts, oldPtsCell ); if ((vtkIdType) pointsCell.size() < nbpts ) pointsCell.resize( nbpts ); for ( int l = 0; l < nbpts; l++ ) @@ -410,7 +410,7 @@ void SMDS_UnstructuredGrid::CleanDownwardConnectivity() * Downward connectivity is no more valid if vtkUnstructuredGrid is modified. * */ -void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) +void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool /*withEdges*/) { MESSAGE("SMDS_UnstructuredGrid::BuildDownwardConnectivity");CHRONO(2); // TODO calcul partiel sans edges @@ -482,6 +482,7 @@ void SMDS_UnstructuredGrid::BuildDownwardConnectivity(bool withEdges) GuessSize[VTK_QUADRATIC_HEXAHEDRON] = nbQuadHexa; GuessSize[VTK_TRIQUADRATIC_HEXAHEDRON] = nbQuadHexa; GuessSize[VTK_HEXAGONAL_PRISM] = nbHexPrism; + (void)GuessSize; // unused in Release mode _downArray[VTK_LINE] ->allocate(nbLineGuess); _downArray[VTK_QUADRATIC_EDGE] ->allocate(nbQuadEdgeGuess); @@ -979,8 +980,10 @@ void SMDS_UnstructuredGrid::GetNodeIds(std::set& nodeSet, int downId, unsig void SMDS_UnstructuredGrid::ModifyCellNodes(int vtkVolId, std::map localClonedNodeIds) { vtkIdType npts = 0; - vtkIdType *pts; // will refer to the point id's of the face - this->GetCellPoints(vtkVolId, npts, pts); + vtkIdType const *tmp(nullptr); // will refer to the point id's of the face + vtkIdType *pts; // will refer to the point id's of the face + this->GetCellPoints(vtkVolId, npts, tmp); + pts = const_cast< vtkIdType*>( tmp ); for (int i = 0; i < npts; i++) { if (localClonedNodeIds.count(pts[i])) @@ -1023,7 +1026,7 @@ void SMDS_UnstructuredGrid::BuildLinks() SMDS_CellLinks* links; this->Links = links = SMDS_CellLinks::New(); - this->Links->Allocate(this->GetNumberOfPoints()); + (static_cast< vtkCellLinks *>(this->Links.GetPointer()))->Allocate(this->GetNumberOfPoints()); this->Links->Register(this); links->BuildLinks(this, this->Connectivity,this->GetCellTypesArray() ); this->Links->Delete(); @@ -1042,7 +1045,7 @@ SMDS_CellLinks* SMDS_UnstructuredGrid::GetLinks() { if ( !this->Links ) BuildLinks(); - return static_cast< SMDS_CellLinks* >( this->Links ); + return static_cast< SMDS_CellLinks* >( this->Links.GetPointer() ); } /*! Create a volume (prism or hexahedron) by duplication of a face. @@ -1205,4 +1208,3 @@ double SMDS_UnstructuredGrid::GetBallDiameter( vtkIdType vtkID ) const return vtkDoubleArray::SafeDownCast( vtkDataSet::CellData->GetScalars() )->GetValue( vtkID ); return 0; } -