55 vtkInformationVector **inputVector,
56 vtkInformationVector *outputVector) {
58 const auto input = vtkDataSet::GetData(inputVector[0]);
59 auto output = vtkUnstructuredGrid::GetData(outputVector);
61 const auto uComponent = this->GetInputArrayToProcess(0, input);
62 const auto vComponent = this->GetInputArrayToProcess(1, input);
64 if(uComponent ==
nullptr || vComponent ==
nullptr)
67 this->
printMsg(
"U-component: `" + std::string{uComponent->GetName()} +
"'");
68 this->
printMsg(
"V-component: `" + std::string{vComponent->GetName()} +
"'");
71 if(triangulation ==
nullptr)
77 input, 0, triangulation,
false, 2, ForceInputOffsetScalarField);
79 input, 1, triangulation,
false, 3, ForceInputOffsetScalarField);
86#ifndef TTK_ENABLE_DOUBLE_TEMPLATING
87 if(uComponent->GetDataType() != vComponent->GetDataType()) {
89 "Scalar fields should have same input type. Use TTKPointDataConverter or "
90 "TTKArrayEditor to convert array types.");
93 switch(uComponent->GetDataType()) {
100 switch(vtkTemplate2PackMacro(
101 uComponent->GetDataType(), vComponent->GetDataType())) {
109 vtkNew<vtkSignedCharArray> edgeTypes{};
111 edgeTypes->SetNumberOfComponents(1);
112 edgeTypes->SetNumberOfTuples(2 * jacobiSet_.size());
113 edgeTypes->SetName(
"Critical Type");
115 vtkNew<vtkSignedCharArray> isPareto{};
116 isPareto->SetNumberOfComponents(1);
117 isPareto->SetNumberOfTuples(2 * jacobiSet_.size());
118 isPareto->SetName(
"IsPareto");
120 vtkNew<vtkPoints> pointSet{};
121 pointSet->SetNumberOfPoints(2 * jacobiSet_.size());
123 vtkNew<vtkCellArray> cellArray{};
124 vtkNew<vtkIdList> idList{};
125 idList->SetNumberOfIds(2);
127 size_t pointCount = 0;
128 std::array<double, 3> p{};
129 for(
size_t i = 0; i < jacobiSet_.size(); i++) {
131 int const edgeId = jacobiSet_[i].first;
133 triangulation->getEdgeVertex(edgeId, 0, vertexId0);
134 triangulation->getEdgeVertex(edgeId, 1, vertexId1);
136 input->GetPoint(vertexId0, p.data());
137 pointSet->SetPoint(pointCount, p.data());
138 edgeTypes->SetTuple1(pointCount, (
float)jacobiSet_[i].second);
139 isPareto->SetTuple1(pointCount, (
float)isPareto_[i]);
141 idList->SetId(0, pointCount);
144 input->GetPoint(vertexId1, p.data());
145 pointSet->SetPoint(pointCount, p.data());
146 edgeTypes->SetTuple1(pointCount, (
float)jacobiSet_[i].second);
147 isPareto->SetTuple1(pointCount, (
float)isPareto_[i]);
148 idList->SetId(1, pointCount);
151 cellArray->InsertNextCell(idList);
153 output->SetPoints(pointSet);
154 output->SetCells(VTK_LINE, cellArray);
155 output->GetPointData()->AddArray(edgeTypes);
156 output->GetPointData()->AddArray(isPareto);
159 vtkNew<ttkSimplexIdTypeArray> edgeIdArray{};
160 edgeIdArray->SetNumberOfComponents(1);
161 edgeIdArray->SetNumberOfTuples(jacobiSet_.size());
162 edgeIdArray->SetName(
"EdgeIds");
165 for(
size_t i = 0; i < jacobiSet_.size(); i++) {
166 edgeIdArray->SetTuple1(pointCount, (
float)jacobiSet_[i].first);
170 output->GetCellData()->AddArray(edgeIdArray);
172 output->GetCellData()->RemoveArray(
"EdgeIds");
177 for(
int i = 0; i < input->GetPointData()->GetNumberOfArrays(); i++) {
179 const auto scalarField = input->GetPointData()->GetArray(i);
181 scalarField->NewInstance()};
183 scalarArray->SetNumberOfComponents(scalarField->GetNumberOfComponents());
184 scalarArray->SetNumberOfTuples(2 * jacobiSet_.size());
185 scalarArray->SetName(scalarField->GetName());
186 std::vector<double> value(scalarField->GetNumberOfComponents());
188 for(
size_t j = 0; j < jacobiSet_.size(); j++) {
189 int const edgeId = jacobiSet_[j].first;
191 triangulation->getEdgeVertex(edgeId, 0, vertexId0);
192 triangulation->getEdgeVertex(edgeId, 1, vertexId1);
194 scalarField->GetTuple(vertexId0, value.data());
195 scalarArray->SetTuple(2 * j, value.data());
197 scalarField->GetTuple(vertexId1, value.data());
198 scalarArray->SetTuple(2 * j + 1, value.data());
200 output->GetPointData()->AddArray(scalarArray);
203 for(
int i = 0; i < input->GetPointData()->GetNumberOfArrays(); i++) {
204 output->GetPointData()->RemoveArray(
205 input->GetPointData()->GetArray(i)->GetName());