diff --git a/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.cpp b/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.cpp index d7516dfec7..66bc5b6f67 100644 --- a/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.cpp +++ b/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.cpp @@ -47,7 +47,10 @@ int ttkMorseSmaleComplex::FillOutputPortInformation(int port, template void setArray(vtkArrayType &vtkArray, vectorType &vector) { - ttkUtils::SetVoidArray(vtkArray, vector.data(), vector.size(), 1); + vtkArray->SetNumberOfTuples(vector.size()); + for(unsigned int i = 0; i < vector.size(); i++) { + vtkArray->SetValue(i, vector[i]); + } } template @@ -61,6 +64,9 @@ int ttkMorseSmaleComplex::dispatch(vtkDataArray *const inputScalars, const int dimensionality = triangulation.getDimensionality(); const auto scalars = ttkUtils::GetPointer(inputScalars); + OutputCriticalPoints criticalPoints_{}; + Output1Separatrices separatrices1_{}; + Output2Separatrices separatrices2_{}; const int ret = this->execute( criticalPoints_, separatrices1_, separatrices2_, segmentations_, scalars, inputScalars->GetMTime(), inputOffsets, triangulation); @@ -148,7 +154,6 @@ int ttkMorseSmaleComplex::dispatch(vtkDataArray *const inputScalars, pointData->AddArray(PLVertexIdentifiers); pointData->AddArray(manifoldSizeScalars); } - // 1-separatrices if(ComputeAscendingSeparatrices1 or ComputeDescendingSeparatrices1 or ComputeSaddleConnectors) { @@ -177,7 +182,12 @@ int ttkMorseSmaleComplex::dispatch(vtkDataArray *const inputScalars, #endif pointsCoords->SetNumberOfComponents(3); - setArray(pointsCoords, separatrices1_.pt.points_); + pointsCoords->SetNumberOfTuples(separatrices1_.pt.numberOfPoints_); + for(int i = 0; i < separatrices1_.pt.numberOfPoints_; i++) { + pointsCoords->SetTuple3(i, separatrices1_.pt.points_[3 * i], + separatrices1_.pt.points_[3 * i + 1], + separatrices1_.pt.points_[3 * i + 2]); + } smoothingMask->SetNumberOfComponents(1); smoothingMask->SetName(ttk::MaskScalarFieldName); @@ -309,7 +319,12 @@ int ttkMorseSmaleComplex::dispatch(vtkDataArray *const inputScalars, #endif pointsCoords->SetNumberOfComponents(3); - setArray(pointsCoords, separatrices2_.pt.points_); + pointsCoords->SetNumberOfTuples(separatrices2_.pt.points_.size()); + for(int i = 0; i < separatrices2_.pt.numberOfPoints_; i++) { + pointsCoords->SetTuple3(i, separatrices2_.pt.points_[3 * i], + separatrices2_.pt.points_[3 * i + 1], + separatrices2_.pt.points_[3 * i + 2]); + } sourceIds->SetNumberOfComponents(1); sourceIds->SetName(ttk::MorseSmaleSourceIdName); @@ -387,7 +402,6 @@ int ttkMorseSmaleComplex::dispatch(vtkDataArray *const inputScalars, cellData->AddArray(separatrixFunctionDiffs); cellData->AddArray(isOnBoundary); } - return ret; } @@ -469,6 +483,7 @@ int ttkMorseSmaleComplex::RequestData(vtkInformation *ttkNotUsed(request), return -1; } #endif + ascendingManifold->SetNumberOfComponents(1); ascendingManifold->SetNumberOfTuples(numberOfVertices); ascendingManifold->SetName(ttk::MorseSmaleAscendingName); diff --git a/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.h b/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.h index f3134ae7b1..b4a041a8a7 100644 --- a/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.h +++ b/core/vtk/ttkMorseSmaleComplex/ttkMorseSmaleComplex.h @@ -192,8 +192,5 @@ class TTKMORSESMALECOMPLEX_EXPORT ttkMorseSmaleComplex private: bool ForceInputOffsetScalarField{}; int IterationThreshold{-1}; - OutputCriticalPoints criticalPoints_{}; - Output1Separatrices separatrices1_{}; - Output2Separatrices separatrices2_{}; OutputManifold segmentations_{}; };