41 vtkInformationVector **inputVector,
42 vtkInformationVector *outputVector) {
44 const auto domain = vtkDataSet::GetData(inputVector[0]);
45 const auto identifiers = vtkPointSet::GetData(inputVector[1]);
46 auto output = vtkDataSet::GetData(outputVector);
49 if(triangulation ==
nullptr) {
55 vtkDataArray *inputField = this->GetInputArrayToProcess(0, identifiers);
56 std::vector<ttk::SimplexId> idSpareStorage{};
61 if(vertsid ==
nullptr || inputField ==
nullptr) {
62 this->
printErr(
"Input fields are NULL");
66 if(inputField->IsA(
"vtkDoubleArray")) {
67 OutputScalarFieldType = FieldType::DOUBLE;
68 }
else if(inputField->IsA(
"vtkFloatArray")) {
69 OutputScalarFieldType = FieldType::FLOAT;
71 this->
printErr(
"Filter only supports floating point scalar fields");
73 "Please select a floating point input scalar field or convert an "
74 "existing one with TTKPointDataConverter or TTKArrayEditor");
78 const auto nVerts = domain->GetNumberOfPoints();
79 const auto nSources = identifiers->GetNumberOfPoints();
83 switch(OutputScalarFieldType) {
84 case FieldType::FLOAT:
87 case FieldType::DOUBLE:
91 this->
printErr(
"Unknown scalar field type");
96 if(outputField ==
nullptr) {
97 this->
printErr(
"vtkArray allocation problem");
101 outputField->SetNumberOfComponents(1);
102 outputField->SetNumberOfTuples(nVerts);
103 outputField->SetName(OutputScalarFieldName.data());
106 switch(OutputScalarFieldType) {
107 case FieldType::FLOAT:
108 res = this->execute<float>(
109 *triangulation, nSources, vertsid,
112 UseCotanWeights, SolvingMethod, LogAlpha);
114 case FieldType::DOUBLE:
115 res = this->execute<double>(
116 *triangulation, nSources, vertsid,
119 UseCotanWeights, SolvingMethod, LogAlpha);
126 this->
printErr(
"HarmonicField execute() error code: "
127 + std::to_string(res));
132 output->ShallowCopy(domain);
133 output->GetPointData()->AddArray(outputField);
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)