MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessTrees

Method ProcessTrees

Filters/HyperTree/vtkHyperTreeGridEvaluateCoarse.cxx:46–113  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

44
45//------------------------------------------------------------------------------
46int vtkHyperTreeGridEvaluateCoarse::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO)
47{
48 // Downcast output data object to HyperTreeGrid
49 vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO);
50 if (!output)
51 {
52 vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName());
53 return 0;
54 }
55
56 output->ShallowCopy(input);
57
58 // OPERATOR_DON_T_CHANGE_FAST is a no-op
59 if (this->Operator == vtkHyperTreeGridEvaluateCoarse::OPERATOR_DON_T_CHANGE_FAST)
60 {
61 return 1;
62 }
63
64 this->Mask = output->HasMask() ? output->GetMask() : nullptr;
65
66 this->SplattingFactor = std::pow(output->GetBranchFactor(), output->GetDimension() - 1);
67 this->NumberOfChildren = output->GetNumberOfChildren();
68 this->InData = input->GetCellData();
69 this->OutData = output->GetCellData();
70 this->OutData->CopyAllocate(this->InData);
71 this->OutData->SetNumberOfTuples(this->InData->GetNumberOfTuples());
72
73 // Iterate over all input and output hyper trees
74 vtkIdType index;
75 vtkHyperTreeGrid::vtkHyperTreeGridIterator in;
76 output->InitializeTreeIterator(in);
77
78 vtkThreadedTaskQueue<void, int> queue(
79 [this, &output](int startIndex)
80 {
81 vtkNew<vtkHyperTreeGridNonOrientedCursor> outCursor;
82 output->InitializeNonOrientedCursor(outCursor, startIndex);
83 // Process tree recursively
84 if (this->Operator == vtkHyperTreeGridEvaluateCoarse::OPERATOR_DON_T_CHANGE)
85 {
86 this->ProcessNodeNoChange(outCursor);
87 }
88 else
89 {
90 this->ProcessNode(outCursor);
91 }
92 },
93 true);
94
95 while (in.GetNextTree(index))
96 {
97// See https://gitlab.kitware.com/vtk/vtk/-/merge_requests/12383
98#if VTK_ID_TYPE_IMPL != VTK_INT
99 queue.Push(static_cast<int>(index));
100#else
101 queue.Push(std::move(index));
102#endif
103

Callers

nothing calls this directly

Calls 15

ProcessNodeNoChangeMethod · 0.95
ProcessNodeMethod · 0.95
HasMaskMethod · 0.80
GetNextTreeMethod · 0.80
CheckAbortMethod · 0.80
powFunction · 0.50
GetClassNameMethod · 0.45
ShallowCopyMethod · 0.45
GetMaskMethod · 0.45
GetDimensionMethod · 0.45

Tested by

no test coverage detected