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

Method RequestData

Filters/Reduction/vtkToImplicitArrayFilter.cxx:166–251  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

164
165//-------------------------------------------------------------------------
166int vtkToImplicitArrayFilter::RequestData(vtkInformation* vtkNotUsed(info),
167 vtkInformationVector** inputInfo, vtkInformationVector* outputInfo)
168{
169 auto input = vtkDataObject::GetData(inputInfo[0], 0);
170 auto output = vtkDataObject::GetData(outputInfo, 0);
171 output->ShallowCopy(input);
172
173 if (!this->Internals->Strategy)
174 {
175 vtkWarningMacro("No strategy set in vtkToImplicitArrayFilter");
176 return 1;
177 }
178
179 for (int association = 0; association < vtkDataObject::NUMBER_OF_ASSOCIATIONS; ++association)
180 {
181 this->UpdateProgress(association / vtkDataObject::NUMBER_OF_ASSOCIATIONS);
182
183 if (this->CheckAbort())
184 {
185 break;
186 }
187
188 auto outFD = output->GetAttributesAsFieldData(association);
189 auto outAttr = vtkDataSetAttributes::SafeDownCast(outFD);
190
191 if (!outAttr)
192 {
193 continue;
194 }
195
196 auto select = this->GetArraySelection(association);
197 if (!select)
198 {
199 vtkWarningMacro(
200 "Selection is nullptr for an attribute type when it should not be for any association.");
201 continue;
202 }
203
204 const int nArrays = outAttr->GetNumberOfArrays();
205 double progress = association / vtkDataObject::NUMBER_OF_ASSOCIATIONS;
206 double progressIncr = 1 / (vtkDataObject::NUMBER_OF_ASSOCIATIONS * (nArrays ? nArrays : 1));
207 std::vector<int> arraysToRemove;
208 std::vector<vtkSmartPointer<vtkDataArray>> arraysToAdd;
209 for (int iArr = 0; iArr < nArrays; ++iArr)
210 {
211 vtkDataArray* arr = outAttr->GetArray(iArr);
212 if (!arr)
213 {
214 continue;
215 }
216 if (!select->ArrayIsEnabled(arr->GetName()))
217 {
218 continue;
219 }
220
221 vtkToImplicitStrategy::Optional estimatedReduction =
222 this->Internals->Strategy->EstimateReduction(arr);
223

Callers

nothing calls this directly

Calls 15

GetArraySelectionMethod · 0.95
CheckAbortMethod · 0.80
backMethod · 0.80
rbeginMethod · 0.80
rendMethod · 0.80
GetDataFunction · 0.50
for_eachFunction · 0.50
ShallowCopyMethod · 0.45
UpdateProgressMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetArrayMethod · 0.45

Tested by

no test coverage detected