59 vtkInformationVector **inputVector,
60 vtkInformationVector *outputVector) {
62 const auto input = vtkDataSet::GetData(inputVector[0]);
63 auto outputMorseComplexes = vtkDataSet::GetData(outputVector, 0);
66 return !this->
printErr(
"Input pointer is NULL.");
68 if(input->GetNumberOfPoints() == 0)
69 return !this->
printErr(
"Input has no point.");
71 if(!outputMorseComplexes)
72 return !this->
printErr(
"Output pointers are NULL.");
76 if(triangulation ==
nullptr)
77 return !this->
printErr(
"Triangulation is null");
81 const auto inputScalars = this->GetInputArrayToProcess(0, inputVector);
83 if(inputScalars ==
nullptr)
84 return !this->
printErr(
"No input scalars");
87 input, 0, triangulation,
false, 1, this->ForceInputOffsetScalarField);
89 if(inputOrderArray ==
nullptr)
90 return !this->
printErr(
"No order array");
92 if(inputOrderArray->GetDataType() != VTK_INT
93 && inputOrderArray->GetDataType() != VTK_ID_TYPE)
94 return !this->
printErr(
"input offset field type not supported.");
96 this->
printMsg(
"Launching computation on field `"
97 + std::string(inputScalars->GetName()) +
"'...");
99 const SimplexId numberOfVertices = triangulation->getNumberOfVertices();
101 if(!numberOfVertices)
102 return !this->
printErr(
"Input has no vertices.");
104 vtkNew<ttkSimplexIdTypeArray> ascendingSegmentation{};
105 vtkNew<ttkSimplexIdTypeArray> descendingSegmentation{};
106 vtkNew<ttkSimplexIdTypeArray> morseSmaleSegmentation{};
108 if(!ascendingSegmentation || !descendingSegmentation
109 || !morseSmaleSegmentation)
110 return !this->
printErr(
"Segmentation vtkDataArray allocation problem.");
112 ascendingSegmentation->SetNumberOfComponents(1);
113 ascendingSegmentation->SetNumberOfTuples(numberOfVertices);
114 ascendingSegmentation->SetName((std::string(inputScalars->GetName()) +
"_"
118 descendingSegmentation->SetNumberOfComponents(1);
119 descendingSegmentation->SetNumberOfTuples(numberOfVertices);
120 descendingSegmentation->SetName((std::string(inputScalars->GetName()) +
"_"
124 morseSmaleSegmentation->SetNumberOfComponents(1);
125 morseSmaleSegmentation->SetNumberOfTuples(numberOfVertices);
126 morseSmaleSegmentation->SetName((std::string(inputScalars->GetName()) +
"_"
131 = {ttkUtils::GetPointer<SimplexId>(ascendingSegmentation),
132 ttkUtils::GetPointer<SimplexId>(descendingSegmentation),
133 ttkUtils::GetPointer<SimplexId>(morseSmaleSegmentation)};
138 triangulation->getType(),
139 (ret = dispatch<TTK_TT>(ttkUtils::GetPointer<SimplexId>(inputOrderArray),
140 *
static_cast<TTK_TT *
>(triangulation->getData()))));
145 outputMorseComplexes->ShallowCopy(input);
149 vtkPointData *pointData = outputMorseComplexes->GetPointData();
152 return !this->
printErr(
"outputMorseComplexes has no point data.");
155 pointData->AddArray(descendingSegmentation);
157 pointData->AddArray(ascendingSegmentation);
159 pointData->AddArray(morseSmaleSegmentation);
vtkDataArray * GetOrderArray(vtkDataSet *const inputData, const int scalarArrayIdx, ttk::Triangulation *triangulation, const bool getGlobalOrder=false, const int orderArrayIdx=0, const bool enforceOrderArrayIdx=false)
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)