From b7440973012a8a12e5b1300ab442e736f147dd85 Mon Sep 17 00:00:00 2001 From: Viktor Uzlov Date: Fri, 5 Mar 2021 08:48:23 +0300 Subject: [PATCH] Labels visability, highlight od elements --- src/OBJECT/SMESH_CellLabelActor.cxx | 12 ++++++++---- src/OBJECT/SMESH_ExtractGeometry.cxx | 8 ++++---- src/OBJECT/SMESH_ExtractGeometry.h | 4 ++-- src/OBJECT/SMESH_NodeLabelActor.cxx | 6 +++--- src/StdMeshers/StdMeshers_Regular_1D.cxx | 4 +++- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/OBJECT/SMESH_CellLabelActor.cxx b/src/OBJECT/SMESH_CellLabelActor.cxx index 07275df16..34220b870 100644 --- a/src/OBJECT/SMESH_CellLabelActor.cxx +++ b/src/OBJECT/SMESH_CellLabelActor.cxx @@ -43,6 +43,7 @@ #include #include #include +#include vtkStandardNewMacro(SMESH_CellLabelActor) @@ -156,18 +157,21 @@ void SMESH_CellLabelActor::SetCellsLabeled(bool theIsCellsLabeled) { myCellsNumDataSet->ShallowCopy(aGrid); vtkUnstructuredGrid *aDataSet = myCellsNumDataSet; - int aNbElem = aDataSet->GetNumberOfCells(); - vtkIntArray *anArray = vtkIntArray::New(); + vtkIdType aNbElem = aDataSet->GetNumberOfCells(); + vtkIdTypeArray *anArray = vtkIdTypeArray::New(); + // + std::cout << "\n\n\n***********\nSizeof vtkIdType: " << sizeof(vtkIdType) << "\nSizeof smIdType: " << sizeof(smIdType) << "\n"; + // anArray->SetNumberOfValues(aNbElem); myExtractUnstructuredGrid->BuildOut2InMap(); - for(int anId = 0; anId < aNbElem; anId++) + for(vtkIdType anId = 0; anId < aNbElem; anId++) { vtkIdType id = anId; if(IsImplicitFunctionUsed()) id = myExtractGeometry->GetElemObjId(id); id = myExtractUnstructuredGrid->GetInputId(id); id = (id >=0) ? id : anId; - int aSMDSId = myVisualObj->GetElemObjId(id); + vtkIdType aSMDSId = myVisualObj->GetElemObjId(id); anArray->SetValue(anId,aSMDSId); } aDataSet->GetCellData()->SetScalars(anArray); diff --git a/src/OBJECT/SMESH_ExtractGeometry.cxx b/src/OBJECT/SMESH_ExtractGeometry.cxx index 4a4ab1716..02fb74391 100644 --- a/src/OBJECT/SMESH_ExtractGeometry.cxx +++ b/src/OBJECT/SMESH_ExtractGeometry.cxx @@ -58,16 +58,16 @@ SMESH_ExtractGeometry::SMESH_ExtractGeometry() SMESH_ExtractGeometry::~SMESH_ExtractGeometry() {} -vtkIdType SMESH_ExtractGeometry::GetElemObjId(int theVtkID) +vtkIdType SMESH_ExtractGeometry::GetElemObjId(vtkIdType theVtkID) { - if( theVtkID < 0 || theVtkID >= (int)myElemVTK2ObjIds.size()) return -1; + if( theVtkID < 0 || theVtkID >= myElemVTK2ObjIds.size()) return -1; return myElemVTK2ObjIds[theVtkID]; } -vtkIdType SMESH_ExtractGeometry::GetNodeObjId(int theVtkID) +vtkIdType SMESH_ExtractGeometry::GetNodeObjId(vtkIdType theVtkID) { - if ( theVtkID < 0 || theVtkID >= (int)myNodeVTK2ObjIds.size()) return -1; + if ( theVtkID < 0 || theVtkID >= myNodeVTK2ObjIds.size()) return -1; return myNodeVTK2ObjIds[theVtkID]; } diff --git a/src/OBJECT/SMESH_ExtractGeometry.h b/src/OBJECT/SMESH_ExtractGeometry.h index f417c49b2..dac601095 100644 --- a/src/OBJECT/SMESH_ExtractGeometry.h +++ b/src/OBJECT/SMESH_ExtractGeometry.h @@ -42,8 +42,8 @@ public: } bool GetStoreMapping(){ return myStoreMapping;} - virtual vtkIdType GetNodeObjId(int theVtkID); - virtual vtkIdType GetElemObjId(int theVtkID); + virtual vtkIdType GetNodeObjId(vtkIdType theVtkID); + virtual vtkIdType GetElemObjId(vtkIdType theVtkID); protected: SMESH_ExtractGeometry(); diff --git a/src/OBJECT/SMESH_NodeLabelActor.cxx b/src/OBJECT/SMESH_NodeLabelActor.cxx index 4d4afbf41..1b04fe731 100644 --- a/src/OBJECT/SMESH_NodeLabelActor.cxx +++ b/src/OBJECT/SMESH_NodeLabelActor.cxx @@ -146,14 +146,14 @@ void SMESH_NodeLabelActor::SetPointsLabeled(bool theIsPointsLabeled) myPointsNumDataSet->ShallowCopy(aGrid); vtkUnstructuredGrid *aDataSet = myPointsNumDataSet; - int aNbElem = aDataSet->GetNumberOfPoints(); + vtkIdType aNbElem = aDataSet->GetNumberOfPoints(); - vtkIntArray *anArray = vtkIntArray::New(); + vtkIdTypeArray *anArray = vtkIdTypeArray::New(); anArray->SetNumberOfValues( aNbElem ); for ( vtkIdType anId = 0; anId < aNbElem; anId++ ) { - int aSMDSId = myVisualObj->GetNodeObjId( anId ); + vtkIdType aSMDSId = myVisualObj->GetNodeObjId( anId ); anArray->SetValue( anId, aSMDSId ); } diff --git a/src/StdMeshers/StdMeshers_Regular_1D.cxx b/src/StdMeshers/StdMeshers_Regular_1D.cxx index 489a278d0..fff61641c 100644 --- a/src/StdMeshers/StdMeshers_Regular_1D.cxx +++ b/src/StdMeshers/StdMeshers_Regular_1D.cxx @@ -1096,7 +1096,9 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh, double r = double( nbSegPerDiap * ( iDiap + 1 )) / double( nbTot ); double parI = par0 + ( par1 - par0 ) * r; Params.InsertBefore( i, parI ); - nbsegs.insert( nbsegs.begin() + i-2 + iDiap, nbSegPerDiap ); + auto it = nbsegs.begin(); + auto incr_it = i - 2 + iDiap; + nbsegs.insert( it + incr_it, nbSegPerDiap ); } nbsegs[ i-2 + nbDiapason - 1 ] = nbSegPerDiap + nbTot % nbDiapason; } -- 2.39.2