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

Method Visit

Filters/ParallelStatistics/vtkGenerateStatistics.cxx:377–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375 vtkGenerateStatistics* Self{ nullptr };
376
377 void Visit(int nodeId) override
378 {
379 std::string srcName = this->SourceAssembly->GetNodeName(nodeId);
380 std::string tgtName = this->TargetAssembly->GetNodeName(nodeId);
381 if (srcName != tgtName)
382 {
383 vtkErrorWithObjectMacro(this->TargetAssembly,
384 "Mismatched nodes at " << nodeId << ": \"" << srcName << "\" vs \"" << tgtName << "\".");
385 this->Error = true;
386 return;
387 }
388 auto srcDataIndices =
389 this->SourceAssembly->GetDataSetIndices(nodeId, /* traverse_subtree */ false);
390 auto tgtDataIndices =
391 this->TargetAssembly->GetDataSetIndices(nodeId, /* traverse_subtree */ false);
392 vtkStatisticalModel* srcModel = nullptr;
393 vtkStatisticalModel* tgtModel = nullptr;
394 for (const auto& dataIndex : srcDataIndices)
395 {
396 auto* model =
397 vtkStatisticalModel::SafeDownCast(this->SourceData->GetPartitionAsDataObject(dataIndex, 0));
398 if (model)
399 {
400 srcModel = model;
401 break;
402 }
403 }
404 unsigned int tgtDataIndex = ~static_cast<unsigned int>(0);
405 for (const auto& dataIndex : tgtDataIndices)
406 {
407 auto* model =
408 vtkStatisticalModel::SafeDownCast(this->TargetData->GetPartitionAsDataObject(dataIndex, 0));
409 if (model)
410 {
411 tgtDataIndex = dataIndex;
412 tgtModel = model;
413 break;
414 }
415 }
416 if (tgtDataIndex == static_cast<unsigned int>(~0))
417 {
418 // If we have no data for the target node but do have data from the source node,
419 // we need a place to copy the source model to. Append it to the end of TargetData:
420 tgtDataIndex = this->TargetData->GetNumberOfPartitionedDataSets();
421 }
422 if (tgtModel && srcModel)
423 {
424 vtkNew<vtkStatisticalModel> temp;
425 temp->DeepCopy(tgtModel);
426#if VTK_DBG_ASSEMBLY
427 auto sc = modelCardinality(srcModel);
428 auto tc = modelCardinality(tgtModel);
429#endif
430 this->Collection->RemoveAllItems();
431 this->Collection->AddItem(srcModel);
432 this->Collection->AddItem(temp);
433 if (!this->Algorithm->Aggregate(this->Collection, tgtModel))
434 {

Callers 2

RequestDataPDCMethod · 0.45
MergeModelTreesMethod · 0.45

Calls 13

modelCardinalityFunction · 0.85
GetDataSetIndicesMethod · 0.80
AddDataSetIndexMethod · 0.80
GetNodeNameMethod · 0.45
DeepCopyMethod · 0.45
RemoveAllItemsMethod · 0.45
AddItemMethod · 0.45
AggregateMethod · 0.45
GetLocalProcessIdMethod · 0.45
GetControllerMethod · 0.45

Tested by

no test coverage detected