Commit eb20bb0e authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fix #17879: improve logic that determine when to deliver data

The logic in vtkPVDataDeliveryManager that would result in deciding
which representation delivered data that the potential to miss
representation that produced empty data under special cases.
This was because vtkPVDataDeliveryManager was depending on data's MTime
which doesn't always change when `vtkPVDataRepresentation::RequestData`
is executed. Fixed that using a more robust
`vtkDemandDrivenPipeline::DataTime` instead.

Also added a test for the same.
parent 82e26520
......@@ -379,6 +379,10 @@ void vtkPVDataDeliveryManager::SetPiece(vtkPVDataRepresentation* repr, vtkDataOb
{
data_time = data->GetMTime();
}
if (repr && repr->GetPipelineDataTime() > data_time)
{
data_time = repr->GetPipelineDataTime();
}
if (data_time > item->GetTimeStamp() || item->GetDataObject() != data)
{
item->SetDataObject(data);
......@@ -597,7 +601,6 @@ void vtkPVDataDeliveryManager::RedistributeDataForOrderedCompositing(bool use_lo
}
cutsGenerator->GenerateKdTree();
this->KdTree = cutsGenerator->GetKdTree();
vtkTimerLog::MarkEndEvent("Regenerate Kd-Tree");
}
......
......@@ -130,6 +130,7 @@ int vtkPVDataRepresentation::RequestData(
return 1;
}
//----------------------------------------------------------------------------
int vtkPVDataRepresentation::RequestUpdateTime(vtkInformation* vtkNotUsed(request),
vtkInformationVector** inputVector, vtkInformationVector* vtkNotUsed(outputVector))
{
......@@ -276,6 +277,18 @@ bool vtkPVDataRepresentation::GetUseCache()
return false;
}
//----------------------------------------------------------------------------
vtkMTimeType vtkPVDataRepresentation::GetPipelineDataTime()
{
if (auto executive = vtkPVDataRepresentationPipeline::SafeDownCast(this->GetExecutive()))
{
return executive->GetDataTime();
}
vtkErrorMacro("vtkPVDataRepresentationPipeline is expected!!!");
return vtkMTimeType();
}
//----------------------------------------------------------------------------
void vtkPVDataRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -178,6 +178,12 @@ public:
*/
vtkView* GetView() const;
/**
* Returns the timestamp when `RequestData` was executed on the
* representation.
*/
vtkMTimeType GetPipelineDataTime();
protected:
vtkPVDataRepresentation();
~vtkPVDataRepresentation() override;
......
......@@ -37,6 +37,13 @@ public:
vtkTypeMacro(vtkPVDataRepresentationPipeline, vtkCompositeDataPipeline);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Expose `DataTime` timestamp. This gets changed anytime the `RequestData` is
* called on the algorithm. This is more robust mechanism to determine if the
* algorithm reexecuted.
*/
vtkGetMacro(DataTime, vtkMTimeType);
protected:
vtkPVDataRepresentationPipeline();
~vtkPVDataRepresentationPipeline() override;
......
......@@ -86,6 +86,7 @@ set(PVBATCH_TESTS
MultiView.py
ParallelImageWriter.py,NO_VALID
ParallelSerialWriter.py
PotentialMismatchedDataDelivery.py,NO_VALID
SaveScreenshot.py,NO_VALID
Simple.py
UserTransformOnRepresentation.py
......
# This test tests a scenario where there was potential that
# the delivery-stage in rendering would entirely miss representation (namely,
# selection representation that only had empty data) to deliver.
# This manifested as bug #17879.
from paraview.simple import *
wavelet1 = Wavelet()
renderView1 = CreateView('RenderView')
wavelet1Display = Show(wavelet1, renderView1)
renderView1.Update()
pointDatatoCellData1 = PointDatatoCellData(Input=wavelet1)
pointDatatoCellData1Display = Show(pointDatatoCellData1, renderView1)
# hide wavelet1
Hide(wavelet1, renderView1)
# update the view to ensure updated data information
renderView1.Update()
# set scalar coloring
ColorBy(pointDatatoCellData1Display, ('CELLS', 'RTData'))
# rescale color and/or opacity maps used to include current data range
pointDatatoCellData1Display.RescaleTransferFunctionToDataRange(True, True)
# change representation type
pointDatatoCellData1Display.SetRepresentationType('Volume')
Render()
# hide data in view
Hide(pointDatatoCellData1, renderView1)
# set active source
SetActiveSource(wavelet1)
# show data in view
wavelet1Display = Show(wavelet1, renderView1)
# set scalar coloring
ColorBy(wavelet1Display, ('POINTS', 'RTData'))
# rescale color and/or opacity maps used to include current data range
wavelet1Display.RescaleTransferFunctionToDataRange(True, True)
# change representation type
wavelet1Display.SetRepresentationType('Volume')
Render()
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