8#include <vtkIdTypeArray.h>
9#include <vtkInformation.h>
10#include <vtkPointSet.h>
19 int port, vtkInformation *info) {
21 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkPointSet");
25 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkTable");
33 int port, vtkInformation *info) {
41template <
typename VTK_TT>
46 const bool Embedding2D) {
47 for(
SimplexId i = 0; i < points->GetNumberOfPoints(); ++i) {
51 p[2] = Embedding2D ? 0 : zdata[i];
52 points->SetPoint(i, p);
58 vtkInformationVector **inputVector,
59 vtkInformationVector *outputVector) {
61 vtkPointSet *inputDataSet = vtkPointSet::GetData(inputVector[0]);
62 vtkTable *inputTable = vtkTable::GetData(inputVector[1]);
63 vtkPointSet *output = vtkPointSet::GetData(outputVector);
65 const SimplexId numberOfPoints = inputDataSet->GetNumberOfPoints();
66#ifndef TTK_ENABLE_KAMIKAZE
67 if(numberOfPoints <= 0) {
73 vtkDataArray *xarr = XColumn.empty()
75 : vtkDataArray::SafeDownCast(
76 inputTable->GetColumnByName(XColumn.data()));
77 vtkDataArray *yarr = YColumn.empty()
79 : vtkDataArray::SafeDownCast(
80 inputTable->GetColumnByName(YColumn.data()));
81 vtkDataArray *zarr = ZColumn.empty()
83 : vtkDataArray::SafeDownCast(
84 inputTable->GetColumnByName(ZColumn.data()));
86#ifndef TTK_ENABLE_KAMIKAZE
87 if(xarr ==
nullptr or yarr ==
nullptr or zarr ==
nullptr) {
91 if(xarr->GetNumberOfTuples() != numberOfPoints
92 or yarr->GetNumberOfTuples() != numberOfPoints
93 or zarr->GetNumberOfTuples() != numberOfPoints) {
94 printErr(
"number of points on inputs mismatch.");
97 if(xarr->GetDataType() != yarr->GetDataType()
98 or xarr->GetDataType() != zarr->GetDataType()) {
99 printErr(
"input columns has different data types.");
105 points->SetNumberOfPoints(numberOfPoints);
107 switch(xarr->GetDataType()) {
114 output->ShallowCopy(inputDataSet);
115 output->SetPoints(points);
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
static vtkInformationIntegerKey * SAME_DATA_TYPE_AS_INPUT_PORT()
TTK VTK-filter that embeds a vtkPointSet with the data of a vtkTable.
int FillOutputPortInformation(int port, vtkInformation *info) override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
int FillInputPortInformation(int port, vtkInformation *info) override
static void * GetVoidPointer(vtkDataArray *array, vtkIdType start=0)
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
int SimplexId
Identifier type for simplices of any dimension.
vtkStandardNewMacro(ttkImportEmbeddingFromTable) int ttkImportEmbeddingFromTable
void setPointFromData(const vtkSmartPointer< vtkPoints > &points, VTK_TT *xdata, VTK_TT *ydata, VTK_TT *zdata, const bool Embedding2D)