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

Method SetArraysWithDefault

Common/Core/vtkDataArraySelection.cxx:300–331  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

298
299//------------------------------------------------------------------------------
300void vtkDataArraySelection::SetArraysWithDefault(
301 const char* const* names, int numArrays, int defaultStatus)
302{
303 // This function is called only by the filter owning the selection.
304 // It should not call Modified() because array settings are not
305 // changed.
306
307 vtkDebugMacro("Settings arrays to given list of " << numArrays << " arrays.");
308
309 // Create a new map for this set of arrays.
310 vtkInternals* newInternal = new vtkInternals;
311
312 newInternal->Arrays.reserve(numArrays);
313
314 // Fill with settings for all arrays.
315 for (int i = 0; i < numArrays; ++i)
316 {
317 // Fill in the setting. Use the old value if available.
318 // Otherwise, use the given default.
319 bool setting = defaultStatus != 0;
320 auto iter = this->Internal->Find(names[i]);
321 if (iter != this->Internal->Arrays.end())
322 {
323 setting = iter->second;
324 }
325 newInternal->Arrays.emplace_back(names[i], setting);
326 }
327
328 // Delete the old map and save the new one.
329 this->Internal.reset(newInternal);
330 this->Modified();
331}
332
333//------------------------------------------------------------------------------
334void vtkDataArraySelection::CopySelections(vtkDataArraySelection* selections)

Callers 2

SetArraysMethod · 0.95

Calls 6

reserveMethod · 0.45
FindMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45
resetMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected