39 vtkInformationVector **inputVector,
40 vtkInformationVector *outputVector) {
44 vtkTable *input = vtkTable::GetData(inputVector[0]);
45 vtkTable *output = vtkTable::GetData(outputVector);
50 if(SelectFieldsWithRegexp) {
53 const auto n = input->GetNumberOfColumns();
54 for(
int i = 0; i < n; ++i) {
55 const auto &name = input->GetColumnName(i);
56 if(std::regex_match(name, std::regex(RegexpString))) {
57 ScalarFields.emplace_back(name);
62 const SimplexId numberOfRows = input->GetNumberOfRows();
63 const SimplexId numberOfColumns = ScalarFields.size();
65 if(numberOfRows <= 0 || numberOfColumns <= 0) {
66 this->
printErr(
"Input matrix has invalid dimensions (rows: "
67 + std::to_string(numberOfRows)
68 +
", columns: " + std::to_string(numberOfColumns) +
")");
72 std::vector<double> inputData;
73 std::vector<vtkAbstractArray *> arrays;
74 arrays.reserve(ScalarFields.size());
75 for(
const auto &s : ScalarFields)
76 arrays.push_back(input->GetColumnByName(s.data()));
77 for(SimplexId i = 0; i < numberOfRows; ++i) {
78 for(
auto arr : arrays)
79 inputData.push_back(arr->GetVariantValue(i).ToDouble());
84 vtkNew<vtkIntArray> insertionTimeCol{};
85 int *insertionPtr =
nullptr;
86 if(this->
Method == DimensionReduction::METHOD::TOPOMAP) {
87 insertionTimeCol->SetNumberOfTuples(numberOfRows);
88 insertionTimeCol->SetName(
"InsertionTime");
89 insertionPtr = ttkUtils::GetPointer<int>(insertionTimeCol);
92 const int errorCode = this->
execute(
93 this->outputData_, inputData, numberOfRows, numberOfColumns, insertionPtr);
97 output->ShallowCopy(input);
100 std::string
const s =
"Component_" + std::to_string(i);
101 vtkNew<vtkDoubleArray> arr{};
103 arr->SetName(s.data());
104 output->AddColumn(arr);
106 if(this->
Method == DimensionReduction::METHOD::TOPOMAP) {
107 output->AddColumn(insertionTimeCol);
int execute(std::vector< std::vector< double > > &outputEmbedding, const std::vector< double > &inputMatrix, const int nRows, const int nColumns, int *insertionTimeForTopoMap=nullptr) const