42 vtkInformationVector **inputVector,
43 vtkInformationVector *outputVector) {
46 vtkDataSet *domain = vtkDataSet::GetData(inputVector[0]);
47 vtkPointSet *sources = vtkPointSet::GetData(inputVector[1]);
48 vtkDataSet *output = vtkDataSet::GetData(outputVector);
51 if(triangulation ==
nullptr) {
52 this->
printErr(
"Wrong triangulation.");
58 std::vector<ttk::SimplexId> idSpareStorage{};
61 sources, idSpareStorage);
62 if(identifiers ==
nullptr) {
67 const int numberOfPointsInDomain = domain->GetNumberOfPoints();
68 if(numberOfPointsInDomain == 0) {
73 const int numberOfPointsInSources = sources->GetNumberOfPoints();
74 if(numberOfPointsInSources == 0) {
79 vtkNew<ttkSimplexIdTypeArray> origin{};
80 origin->SetNumberOfComponents(1);
81 origin->SetNumberOfTuples(numberOfPointsInDomain);
84 vtkNew<ttkSimplexIdTypeArray> seg{};
85 seg->SetNumberOfComponents(1);
86 seg->SetNumberOfTuples(numberOfPointsInDomain);
87 seg->SetName(
"SeedIdentifier");
97 switch(
static_cast<DistanceType
>(OutputScalarFieldType)) {
98 case DistanceType::Float:
99 distanceScalars = vtkFloatArray::New();
100 distanceScalars->SetNumberOfComponents(1);
101 distanceScalars->SetNumberOfTuples(numberOfPointsInDomain);
102 distanceScalars->SetName(OutputScalarFieldName.data());
107 triangulation->getType(), (ret = this->execute<
float, TTK_TT>(
108 (TTK_TT *)triangulation->getData())));
111 case DistanceType::Double:
112 distanceScalars = vtkDoubleArray::New();
113 distanceScalars->SetNumberOfComponents(1);
114 distanceScalars->SetNumberOfTuples(numberOfPointsInDomain);
115 distanceScalars->SetName(OutputScalarFieldName.data());
121 triangulation->getType(), (ret = this->execute<
double, TTK_TT>(
122 (TTK_TT *)triangulation->getData())));
126 printErr(
"Invalid scalar field type.");
133 printErr(
"DistanceField.execute() error code : " + std::to_string(ret));
138 output->ShallowCopy(domain);
139 output->GetPointData()->AddArray(distanceScalars);
140 output->GetPointData()->AddArray(origin);
141 output->GetPointData()->AddArray(seg);
142 distanceScalars->Delete();
ttk::SimplexId * GetIdentifierArrayPtr(const bool &enforceArrayIndex, const int &arrayIndex, const std::string &arrayName, vtkDataSet *const inputData, std::vector< ttk::SimplexId > &spareStorage, const int inputPort=0, const bool printErr=true)