47 vtkInformationVector **inputVector,
48 vtkInformationVector *outputVector) {
50 auto input = vtkDataSet::GetData(inputVector[0]);
51 auto output = vtkDataSet::GetData(outputVector);
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()) {
94#ifdef TTK_ENABLE_MPI_TIME
100 for(
auto scalarArray : scalarArrays) {
102 std::string arrayName = std::string(scalarArray->GetName());
103 if(arrayName !=
"GlobalPointIds" && arrayName !=
"vtkGhostType"
104 && arrayName !=
"RankArray") {
105 this->
printMsg(
"Arrayname: " + arrayName);
106 vtkNew<ttkSimplexIdTypeArray> orderArray{};
109 orderArray->SetNumberOfComponents(1);
110 orderArray->SetNumberOfTuples(nVertices);
112 this->
printMsg(std::to_string(scalarArray->GetDataType()));
113 ttkTypeMacroAT(scalarArray->GetDataType(), triangulation->getType(),
115 static_cast<const T1 *
>(triangulation->getData()),
122 output->GetPointData()->AddArray(orderArray);
123 triangulation->setIsOrderArrayGlobal(
127#ifdef TTK_ENABLE_MPI_TIME
131 printMsg(
"Array preconditioning performed using "
133 +
" MPI processes lasted: " + std::to_string(elapsedTime));
136 this->
printMsg(
"Preconditioned selected scalar arrays", 1.0,
137 tm.getElapsedTime(), this->threadNumber_);
140 this->
printMsg(
"Necessary arrays are present, TTK is built with MPI "
141 "support, but not run with mpirun. Running sequentially.");
145#ifdef TTK_ENABLE_MPI_TIME
149 for(
auto scalarArray : scalarArrays) {
150 vtkNew<ttkSimplexIdTypeArray> orderArray{};
153 orderArray->SetNumberOfComponents(1);
154 orderArray->SetNumberOfTuples(nVertices);
156 switch(scalarArray->GetDataType()) {
159 static_cast<int *
>(
nullptr),
164 triangulation->setIsOrderArrayGlobal(
167 output->GetPointData()->AddArray(orderArray);
168 this->
printMsg(
"Generated order array for scalar array `"
169 + std::string{scalarArray->GetName()} +
"'");
171#ifdef TTK_ENABLE_MPI_TIME
174 printMsg(
"Array preconditioning performed using "
176 +
" MPI processes lasted: " + std::to_string(elapsedTime));
179 this->
printMsg(
"Preconditioned selected scalar arrays", 1.0,
180 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)