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

Method AddTimeStepInternal

Filters/Extraction/vtkExtractDataArraysOverTime.cxx:499–577  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

497
498//------------------------------------------------------------------------------
499void vtkExtractDataArraysOverTime::vtkInternal::AddTimeStepInternal(
500 unsigned int composite_index, int ts_index, double vtkNotUsed(time), vtkDataObject* input)
501{
502 int attributeType = this->Self->GetFieldAssociation();
503 const bool statsOnly = this->Self->GetReportStatisticsOnly();
504
505 vtkSmartPointer<vtkDataObject> data = input;
506 if (statsOnly)
507 {
508 // instead of saving raw-data, we're going to track the summary.
509 data = this->Summarize(input);
510 attributeType = vtkDataObject::ROW;
511 }
512
513 if (!data)
514 {
515 return;
516 }
517
518 vtkDataSetAttributes* inDSA = data->GetAttributes(attributeType);
519 const vtkIdType numIDs = inDSA->GetNumberOfTuples();
520 if (numIDs <= 0)
521 {
522 return;
523 }
524
525 vtkIdTypeArray::Superclass* indexArray = nullptr;
526 if (!statsOnly)
527 {
528 if (this->Self->GetUseGlobalIDs())
529 {
530 indexArray = vtkIdTypeArray::Superclass::FastDownCast(inDSA->GetGlobalIds());
531 }
532 else
533 {
534 // when not reporting stats, user can specify which array to use to index
535 // elements.
536 int association;
537 indexArray = vtkIdTypeArray::Superclass::FastDownCast(
538 this->Self->GetInputArrayToProcess(0, data, association));
539 if (indexArray != nullptr && association != attributeType)
540 {
541 indexArray = nullptr;
542 }
543 }
544 }
545
546 const bool is_gid = (indexArray != nullptr && inDSA->GetGlobalIds() == indexArray);
547 if (is_gid)
548 {
549 // if using global ids, then they are expected to be unique across
550 // blocks. By discarding the composite-index, we can easily track
551 // elements moving between blocks.
552 composite_index = 0;
553 }
554
555 vtkDataSet* dsData = vtkDataSet::SafeDownCast(data);
556 for (vtkIdType cc = 0; cc < numIDs; ++cc)

Callers 1

AddTimeStepMethod · 0.95

Calls 14

SummarizeMethod · 0.95
GetOutputMethod · 0.95
GetFieldAssociationMethod · 0.80
GetGlobalIdsMethod · 0.80
GetRowDataMethod · 0.80
FastDownCastFunction · 0.50
GetAttributesMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetTypedComponentMethod · 0.45
CopyDataMethod · 0.45
SetTypedComponentMethod · 0.45

Tested by

no test coverage detected