X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMDS%2FSMDS_UnstructuredGrid.cxx;h=ef5d8959980fefe28c3ad592e3f39803dbd3cc6c;hp=8594efb8f9967dde5cce5bc25196ba09385f3789;hb=a274ade365bd0f0e19d56c577acc4a13aa1972a7;hpb=e67f8c2cabe52f01cc64b646330f3827ab06bb13 diff --git a/src/SMDS/SMDS_UnstructuredGrid.cxx b/src/SMDS/SMDS_UnstructuredGrid.cxx index 8594efb8f..ef5d89599 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-2021 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 @@ -160,8 +160,8 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p { if ( setOfNodes.insert( pts[i] ).second ) { - this->Links->ResizeCellList( pts[i], 1 ); - this->Links->AddCellReference( cellid, pts[i] ); + (static_cast< vtkCellLinks * >(this->Links.GetPointer()))->ResizeCellList( pts[i], 1 ); + (static_cast< vtkCellLinks * >(this->Links.GetPointer()))->AddCellReference( cellid, pts[i] ); } i++; } @@ -225,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 ) { @@ -249,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(); @@ -320,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(); @@ -334,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) @@ -360,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++ ) @@ -407,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 @@ -479,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); @@ -976,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])) @@ -1020,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(); @@ -1039,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. @@ -1202,4 +1208,3 @@ double SMDS_UnstructuredGrid::GetBallDiameter( vtkIdType vtkID ) const return vtkDoubleArray::SafeDownCast( vtkDataSet::CellData->GetScalars() )->GetValue( vtkID ); return 0; } -