5#include <vtkIdTypeArray.h>
6#include <vtkInformation.h>
7#include <vtkPointData.h>
8#include <vtkPolyData.h>
14 SetNumberOfInputPorts(3);
16 SetNumberOfOutputPorts(1);
20 int port, vtkInformation *info) {
22 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkPointSet");
24 }
else if(port == 1) {
25 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkPolyData");
27 }
else if(port == 2) {
28 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkDataSet");
35 int port, vtkInformation *info) {
37 info->Set(vtkDataObject::DATA_TYPE_NAME(),
"vtkPolyData");
45 vtkInformationVector **inputVector,
46 vtkInformationVector *outputVector) {
48 auto critpoints = vtkPointSet::GetData(inputVector[0]);
49 auto seprs = vtkPolyData::GetData(inputVector[1]);
50 auto domain = vtkDataSet::GetData(inputVector[2]);
51 auto output = vtkPolyData::GetData(outputVector);
54 if(triangulation ==
nullptr) {
59 auto cpPoints = critpoints->GetPoints();
60 auto cpData = critpoints->GetPointData();
61 auto seprsPoints = seprs->GetPoints();
62 auto seprsData = seprs->GetPointData();
64 if(seprsPoints ==
nullptr || seprsData ==
nullptr || cpPoints ==
nullptr
65 || cpData ==
nullptr) {
70 auto cpci = cpData->GetArray(
"CellId");
71 auto cpcd = cpData->GetArray(
"CellDimension");
73 auto sepid = seprsData->GetArray(
"CellId");
74 auto sepdim = seprsData->GetArray(
"CellDimension");
77 if(cpci ==
nullptr || cpcd ==
nullptr || cpid ==
nullptr || sepid ==
nullptr
78 || sepdim ==
nullptr || sepmask ==
nullptr) {
79 this->
printErr(
"Missing data arrays");
95 triangulation->getType(),
96 res = this->execute(*
static_cast<TTK_TT *
>(triangulation->getData())););
99 this->
printWrn(
"Consider another (eigen) function, persistence threshold "
100 "or refine your input triangulation");
107 vtkNew<vtkPoints> outQuadPoints{};
111 output->SetPoints(outQuadPoints);
114 vtkNew<ttkSimplexIdTypeArray> identifiers{};
118 output->GetPointData()->AddArray(identifiers);
121 vtkNew<ttkSimplexIdTypeArray> type{};
122 type->SetName(
"QuadVertType");
125 output->GetPointData()->AddArray(type);
128 vtkNew<ttkSimplexIdTypeArray> cellid{};
129 cellid->SetName(
"QuadCellId");
132 output->GetPointData()->AddArray(cellid);
135 vtkNew<vtkCellArray> cells{};
141 output->SetPolys(cells);
144 output->GetFieldData()->ShallowCopy(domain->GetFieldData());
#define ttkTemplateMacro(triangulationType, call)
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
ttk::Triangulation * GetTriangulation(vtkDataSet *dataSet)
TTK VTK-filter for surface quadrangulation.
int FillInputPortInformation(int port, vtkInformation *info) override
int FillOutputPortInformation(int port, vtkInformation *info) override
ttkMorseSmaleQuadrangulation()
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
static void * GetVoidPointer(vtkDataArray *array, vtkIdType start=0)
static void SetVoidArray(vtkDataArray *array, void *data, vtkIdType size, int save)
int printWrn(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
std::vector< float > outputPoints_
std::vector< SimplexId > outputPointsCells_
std::vector< Quad > outputCells_
std::vector< SimplexId > outputPointsIds_
std::vector< SimplexId > outputPointsTypes_
void setSeparatrices(const unsigned int number, void *const cellIds, void *const cellDims, void *const mask, void *const points)
void preconditionTriangulation(AbstractTriangulation *const triangl)
void setCriticalPoints(const unsigned int number, void *const points, void *const ids, void *const cellIds, void *const type)
const char VertexScalarFieldName[]
default name for vertex scalar field
const char MaskScalarFieldName[]
default name for mask scalar field
vtkStandardNewMacro(ttkMorseSmaleQuadrangulation)