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

Method PassData

Common/DataModel/vtkDataSetAttributes.cxx:312–365  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Pass entire arrays of input data through to output. Obey the "copy" flags.

Source from the content-addressed store, hash-verified

310//------------------------------------------------------------------------------
311// Pass entire arrays of input data through to output. Obey the "copy" flags.
312void vtkDataSetAttributes::PassData(vtkFieldData* fd)
313{
314 if (!fd)
315 {
316 return;
317 }
318
319 vtkDataSetAttributes* dsa = vtkDataSetAttributes::SafeDownCast(fd);
320
321 if (dsa)
322 {
323 // Create an iterator to iterate over the fields which will
324 // be passed, i.e. fields which are either:
325 // 1> in the list of _fields_ to be copied or
326 // 2> in the list of _attributes_ to be copied.
327 // Note that nullptr data arrays are not copied
328
329 vtkFieldData::BasicIterator it = this->ComputeRequiredArrays(dsa, PASSDATA);
330
331 if (it.GetListSize() > this->NumberOfArrays)
332 {
333 this->AllocateArrays(it.GetListSize());
334 }
335 if (it.GetListSize() == 0)
336 {
337 return;
338 }
339
340 // Since we are replacing, remove old attributes
341 for (int attributeType = 0; attributeType < NUM_ATTRIBUTES; ++attributeType)
342 {
343 if (this->CopyAttributeFlags[PASSDATA][attributeType])
344 {
345 this->RemoveArray(this->AttributeIndices[attributeType]);
346 this->AttributeIndices[attributeType] = -1;
347 }
348 }
349
350 for (const auto& i : it)
351 {
352 int arrayIndex = this->AddArray(dsa->GetAbstractArray(i));
353 // If necessary, make the array an attribute
354 int attributeType = dsa->IsArrayAnAttribute(i);
355 if ((attributeType != -1) && this->CopyAttributeFlags[PASSDATA][attributeType])
356 {
357 this->SetActiveAttribute(arrayIndex, attributeType);
358 }
359 }
360 }
361 else
362 {
363 this->vtkFieldData::PassData(fd);
364 }
365}
366
367//------------------------------------------------------------------------------
368namespace

Callers

nothing calls this directly

Calls 8

ComputeRequiredArraysMethod · 0.95
RemoveArrayMethod · 0.95
SetActiveAttributeMethod · 0.95
GetListSizeMethod · 0.80
GetAbstractArrayMethod · 0.80
IsArrayAnAttributeMethod · 0.80
AllocateArraysMethod · 0.45
AddArrayMethod · 0.45

Tested by

no test coverage detected