47 vtkInformationVector **inputVector,
48 vtkInformationVector *outputVector) {
50 auto input = vtkDataSet::GetData(inputVector[0]);
51 auto output = vtkDataSet::GetData(outputVector);
54 int const keepGoing = checkEmptyMPIInput<vtkDataSet>(input);
61 output->ShallowCopy(input);
63 auto pointData = input->GetPointData();
64 size_t const nVertices = input->GetNumberOfPoints();
66 std::vector<vtkDataArray *> scalarArrays{};
68 if(SelectFieldsWithRegexp) {
70 const auto n = pointData->GetNumberOfArrays();
71 for(
int i = 0; i < n; ++i) {
72 auto array = pointData->GetArray(i);
73 if(array !=
nullptr && array->GetName() !=
nullptr
74 && std::regex_match(array->GetName(), std::regex(RegexpString))) {
75 scalarArrays.emplace_back(array);
80 for(
int i = 0; i < pointData->GetNumberOfArrays(); ++i) {
81 auto array = pointData->GetArray(i);
82 if(array !=
nullptr && array->GetName() !=
nullptr
83 && ArraySelection->ArrayIsEnabled(array->GetName())) {
84 scalarArrays.emplace_back(array);
91 if(ttk::isRunningWithMPI()) {
96 for(
auto scalarArray : scalarArrays) {
98 std::string arrayName = std::string(scalarArray->GetName());
99 if(arrayName !=
"GlobalPointIds" && arrayName !=
"vtkGhostType"
100 && arrayName !=
"RankArray") {
101 this->
printMsg(
"Arrayname: " + arrayName);
102 vtkNew<ttkSimplexIdTypeArray> orderArray{};
105 orderArray->SetNumberOfComponents(1);
106 orderArray->SetNumberOfTuples(nVertices);
108 this->
printMsg(std::to_string(scalarArray->GetDataType()));
109 ttkTypeMacroAT(scalarArray->GetDataType(), triangulation->getType(),
110 (status = processScalarArray<T0, T1>(
111 static_cast<const T1 *
>(triangulation->getData()),
112 ttkUtils::GetPointer<ttk::SimplexId>(orderArray),
113 ttkUtils::GetPointer<T0>(scalarArray), nVertices)));
118 output->GetPointData()->AddArray(orderArray);
119 triangulation->setIsOrderArrayGlobal(
123 this->
printMsg(
"Preconditioned selected scalar arrays", 1.0,
124 tm.getElapsedTime(), this->threadNumber_);
127 this->
printMsg(
"Necessary arrays are present, TTK is built with MPI "
128 "support, but not run with mpirun. Running sequentially.");
133 for(
auto scalarArray : scalarArrays) {
134 vtkNew<ttkSimplexIdTypeArray> orderArray{};
137 orderArray->SetNumberOfComponents(1);
138 orderArray->SetNumberOfTuples(nVertices);
140 switch(scalarArray->GetDataType()) {
143 static_cast<int *
>(
nullptr),
148 triangulation->setIsOrderArrayGlobal(
151 output->GetPointData()->AddArray(orderArray);
152 this->
printMsg(
"Generated order array for scalar array `"
153 + std::string{scalarArray->GetName()} +
"'");
156 this->
printMsg(
"Preconditioned selected scalar arrays", 1.0,
157 tm.getElapsedTime(), this->threadNumber_);
void sortVertices(const size_t nVerts, const scalarType *const scalars, const idType *const offsets, SimplexId *const order, const int nThreads)
Sort vertices according to scalars disambiguated by offsets.
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)