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

Method ProcessPDC

Filters/General/vtkAxisAlignedReflectionFilter.cxx:80–165  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

78
79//------------------------------------------------------------------------------
80bool vtkAxisAlignedReflectionFilter::ProcessPDC(vtkPartitionedDataSetCollection* inputPDC,
81 vtkPartitionedDataSetCollection* outputPDC, double bounds[6])
82{
83 // get the input data assembly or generate one if not present.
84 vtkNew<vtkDataAssembly> inputAssembly;
85 if (inputPDC->GetDataAssembly())
86 {
87 inputAssembly->DeepCopy(inputPDC->GetDataAssembly());
88 }
89 else
90 {
91 vtkNew<vtkPartitionedDataSetCollection> tempPDC;
92 if (!vtkDataAssemblyUtilities::GenerateHierarchy(inputPDC, inputAssembly, tempPDC))
93 {
94 vtkErrorMacro("Failed to generate hierarchy for input partitioned dataset collection.");
95 return false;
96 }
97 inputAssembly->DeepCopy(tempPDC->GetDataAssembly());
98 }
99 inputAssembly->SetRootNodeName("Input");
100 inputAssembly->SetAttribute(vtkDataAssembly::GetRootNode(), "label", "Input");
101 // create a reflection assembly
102 vtkNew<vtkDataAssembly> reflectionAssembly;
103 reflectionAssembly->DeepCopy(inputAssembly);
104 reflectionAssembly->SetRootNodeName("Reflection");
105 reflectionAssembly->SetAttribute(vtkDataAssembly::GetRootNode(), "label", "Reflection");
106 // create the output data assembly using the input assembly optionally and reflection assembly.
107 auto outputAssembly = outputPDC->GetDataAssembly();
108 outputAssembly->SetRootNodeName("Root");
109 outputAssembly->SetAttribute(vtkDataAssembly::GetRootNode(), "label", "Root");
110 // append input assembly to output assembly if requested.
111 if (this->CopyInput)
112 {
113 outputAssembly->AddSubtree(vtkDataAssembly::GetRootNode(), inputAssembly);
114 // shallow copy input to output.
115 outputPDC->vtkDataObjectTree::ShallowCopy(inputPDC);
116 }
117 outputAssembly->AddSubtree(vtkDataAssembly::GetRootNode(), reflectionAssembly);
118
119 // traverse input PDC and process each partitioned dataset.
120 for (unsigned int i = 0, index = outputPDC->GetNumberOfPartitionedDataSets();
121 i < inputPDC->GetNumberOfPartitionedDataSets(); ++i, ++index)
122 {
123 if (this->CheckAbort())
124 {
125 break;
126 }
127 // reflect each partition in the partitioned dataset.
128 vtkNew<vtkPartitionedDataSet> outputPDS;
129 for (unsigned int p = 0; p < inputPDC->GetNumberOfPartitions(i); ++p)
130 {
131 auto dObj = inputPDC->GetPartitionAsDataObject(i, p);
132 if (!dObj)
133 {
134 outputPDS->SetPartition(p, nullptr);
135 continue;
136 }
137 auto outputObj = vtk::TakeSmartPointer(dObj->NewInstance());

Callers 3

ProcessMBMethod · 0.95
ProcessPDSMethod · 0.95
RequestDataMethod · 0.95

Calls 15

ProcessLeafMethod · 0.95
GetRootNodeFunction · 0.85
RemoveGlobalIdsFunction · 0.85
GetDataAssemblyMethod · 0.80
AddSubtreeMethod · 0.80
CheckAbortMethod · 0.80
SetPartitionedDataSetMethod · 0.80
to_stringFunction · 0.50
DeepCopyMethod · 0.45
SetAttributeMethod · 0.45
GetNumberOfPartitionsMethod · 0.45

Tested by

no test coverage detected