Commit 2db2bb54 authored by Allison Vacanti's avatar Allison Vacanti Committed by Kitware Robot

Merge topic 'pv_partitioned_dataset'

dcfe8f6c Generalize CompositeDataDisplayAttributes for partitioned data.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !5137
parents 4242f492 dcfe8f6c
......@@ -16,6 +16,8 @@
#include "vtkBoundingBox.h"
#include "vtkCompositeDataDisplayAttributes.h"
#include "vtkCompositeDataIterator.h"
#include "vtkDataObjectTree.h"
#include "vtkDataObjectTreeIterator.h"
#include "vtkDataSet.h"
#include "vtkMath.h"
#include "vtkMultiBlockDataSet.h"
......@@ -274,22 +276,21 @@ void vtkCompositeDataDisplayAttributes::ComputeVisibleBoundsInternal(
bool blockVisible = (cda && cda->HasBlockVisibility(dobj)) ?
cda->GetBlockVisibility(dobj) : parentVisible;
vtkMultiBlockDataSet *mbds = vtkMultiBlockDataSet::SafeDownCast(dobj);
vtkMultiPieceDataSet *mpds = vtkMultiPieceDataSet::SafeDownCast(dobj);
if (mbds || mpds)
vtkDataObjectTree *dObjTree = vtkDataObjectTree::SafeDownCast(dobj);
if (dObjTree)
{
const unsigned int numChildren = mbds ? mbds->GetNumberOfBlocks() :
mpds->GetNumberOfPieces();
for (unsigned int cc = 0 ; cc < numChildren; cc++)
auto iter = vtkSmartPointer<vtkDataObjectTreeIterator>::Take(dObjTree->NewTreeIterator());
iter->TraverseSubTreeOff();
iter->SkipEmptyNodesOn();
iter->VisitOnlyLeavesOff(); // Visit nodes to maintain parent visibility.
for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
vtkDataObject* child = mbds ? mbds->GetBlock(cc) : mpds->GetPiece(cc);
if (child == nullptr)
vtkDataObject *child = iter->GetCurrentDataObject();
if (child)
{
// Speeds things up when dealing with nullptr blocks (which is common with AMRs).
continue;
vtkCompositeDataDisplayAttributes::ComputeVisibleBoundsInternal(
cda, child, bbox, blockVisible);
}
vtkCompositeDataDisplayAttributes::ComputeVisibleBoundsInternal(
cda, child, bbox, blockVisible);
}
}
else if (dobj && blockVisible == true)
......@@ -322,29 +323,29 @@ vtkDataObject* vtkCompositeDataDisplayAttributes::DataObjectFromIndex(
return nullptr;
}
auto multiBlock = vtkMultiBlockDataSet::SafeDownCast(parent_obj);
auto multiPiece = vtkMultiPieceDataSet::SafeDownCast(parent_obj);
if (multiBlock || multiPiece)
vtkDataObjectTree *dObjTree = vtkDataObjectTree::SafeDownCast(parent_obj);
if (dObjTree)
{
const unsigned int numChildren = multiBlock ?
multiBlock->GetNumberOfBlocks() : multiPiece->GetNumberOfPieces();
auto iter = vtkSmartPointer<vtkDataObjectTreeIterator>::Take(dObjTree->NewTreeIterator());
iter->TraverseSubTreeOff();
iter->VisitOnlyLeavesOff();
iter->SkipEmptyNodesOff();
for (unsigned int cc = 0; cc < numChildren; cc++)
for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())
{
vtkDataObject* child = multiBlock ? multiBlock->GetBlock(cc) :
multiPiece->GetPiece(cc);
if (!child)
vtkDataObject *child = iter->GetCurrentDataObject();
if (child)
{
current_flat_index++;
continue;
const auto data = vtkCompositeDataDisplayAttributes::DataObjectFromIndex(
flat_index, child, current_flat_index);
if (data)
{
return data;
}
}
const auto data = vtkCompositeDataDisplayAttributes::DataObjectFromIndex(
flat_index, child, current_flat_index);
if (data)
else
{
return data;
++current_flat_index;
}
}
}
......
......@@ -24,14 +24,13 @@
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataPipeline.h"
#include "vtkCompositeDataSet.h"
#include "vtkDataObjectTree.h"
#include "vtkDataObjectTreeIterator.h"
#include "vtkFloatArray.h"
#include "vtkHardwareSelector.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkLookupTable.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkMultiPieceDataSet.h"
#include "vtkObjectFactory.h"
#include "vtkOpenGLCellToVTKCellMap.h"
#include "vtkOpenGLIndexBufferObject.h"
......@@ -1839,23 +1838,27 @@ void vtkCompositePolyDataMapper2::BuildRenderValues(
// block.
flat_index++;
vtkMultiBlockDataSet *mbds = vtkMultiBlockDataSet::SafeDownCast(dobj);
vtkMultiPieceDataSet *mpds = vtkMultiPieceDataSet::SafeDownCast(dobj);
if (mbds || mpds)
{
unsigned int numChildren = mbds? mbds->GetNumberOfBlocks() :
mpds->GetNumberOfPieces();
for (unsigned int cc=0 ; cc < numChildren; cc++)
auto dObjTree = vtkDataObjectTree::SafeDownCast(dobj);
if (dObjTree)
{
using SmartDOTIter = vtkSmartPointer<vtkDataObjectTreeIterator>;
auto iter = SmartDOTIter::Take(dObjTree->NewTreeIterator());
iter->TraverseSubTreeOff();
iter->VisitOnlyLeavesOff();
iter->SkipEmptyNodesOff();
for (iter->InitTraversal();
!iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
vtkDataObject* child = mbds ? mbds->GetBlock(cc) : mpds->GetPiece(cc);
if (child == nullptr)
auto child = iter->GetCurrentDataObject();
if (!child)
{
++flat_index;
}
else
{
// speeds things up when dealing with nullptr blocks (which is common with
// AMRs).
flat_index++;
continue;
this->BuildRenderValues(renderer, actor, child, flat_index);
}
this->BuildRenderValues(renderer, actor, child, flat_index);
}
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment