Commit 0986f7cd authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic 'amr_streaming'

7fdf9640 Fix vtkPVClientServerCoreRendering-HeaderTest.
4142ab50 Fixig AMRStreaming test when VisIt bridge was not enabled.
2cef5b62 Bring in VTK fix for Exodus reader.
894d5075 Fixed warnings
8fe4ba73 Bring in VTK fixes for AMR I/O and others.
130a1503 Updating documentation
e3fa7266 Cleanup debugging messages in release builds when streaming.
a83f1716 Adding support for client-server streaming test.
7de86c89 Added support for testing streaming.
977eb537 Added test for vtkResampledAMRImageSource.
a3709ae7 Fixed client-server AMR volume rendering issue.
a0860760 Fixing single-server remote-rendering configuration.
2823e752 Remove old AMR volume rendering classes.
9a1816ec Fixing clang build issue.
f349e5fd Cleaning up vtkAMRStreamingVolumeRepresentation code.
c9c87027 BUG: don't update bounds when streaming.
...
parents 7520d718 7fdf9640
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/MainControlsToolbar/actionOpenData" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FileOpenDialog" command="filesSelected" arguments="@smooth_flash@" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/listWidget" command="mousePress" arguments="1,1,0,81,5,/0:0" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/listWidget" command="mouseRelease" arguments="1,0,0,81,5,/0:0" />
<pqevent object="pqClientMainWindow/pqSelectReaderDialog/okButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ArrayStatus/SelectionWidget" command="setCheckState" arguments="6.0,2" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- stop automatic streaming -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="stop_streaming" />
<!-- switch to a representation that supports streaming -->
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="set_string" arguments="AMR Blocks" />
<!-- step down the streaming updates a few times -->
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow" command="pqViewStreamingBehavior" arguments="next" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
</pqevents>
......@@ -147,6 +147,48 @@ SET (TESTS_WITH_BASELINES
# ${CMAKE_CURRENT_SOURCE_DIR}/XYBarChart.xml
)
#------------------------------------------------------------------------------
# Add streaming tests.
# We need to locate smooth.flash since it's not included in the default testing
# datasets.
find_file(smooth_flash NAMES smooth.flash
DOC "Path to smooth.flash data file."
NO_DEFAULT_PATH)
mark_as_advanced(smooth_flash)
if (EXISTS "${smooth_flash}" AND PARAVIEW_DATA_ROOT)
# we configure the file since we need to point to smooth_flash.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/AMRStreaming.xml.in"
"${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml" @ONLY)
set (streaming_tests
${CMAKE_CURRENT_BINARY_DIR}/AMRStreaming.xml)
set(AMRStreaming_USE_NEW_PANELS TRUE)
foreach (tname ${streaming_tests})
add_pv_test("pv" "_DISABLE_C"
COMMAND --client ${CLIENT_EXECUTABLE}
-dr
--enable-streaming
--disable-light-kit
--test-directory=${PARAVIEW_TEST_DIR}
BASELINE_DIR ${PARAVIEW_DATA_ROOT}/Baseline
TEST_SCRIPTS ${tname})
add_pv_test(pvcs "_DISABLE_CS"
COMMAND
--server $<TARGET_FILE:pvserver>
--server-postflags --enable-streaming
--client ${CLIENT_EXECUTABLE}
-dr
--enable-streaming
--disable-light-kit
--test-directory=${PARAVIEW_TEST_DIR}
BASELINE_DIR ${PARAVIEW_DATA_ROOT}/Baseline
TEST_SCRIPTS ${tname})
endforeach()
endif()
#------------------------------------------------------------------------------
# Probe picking does not work in render server mode
set(ProbePicking_DISABLE_CRS TRUE)
......
......@@ -61,7 +61,7 @@ vtkPVOptions::vtkPVOptions()
this->TellVersion = 0;
this->AMRStreaming = 0;
this->EnableStreaming = 0;
this->UseCudaInterop = 0;
......@@ -298,11 +298,10 @@ void vtkPVOptions::Initialize()
"When specified, the python script is processed symmetrically on all processes.",
vtkPVOptions::PVBATCH);
this->AddBooleanArgument("--amr-streaming", "-amr",
&this->AMRStreaming,
"EXPERIMENTAL: When specified, AMR streaming for volume rendering is "
"enabled",
vtkPVOptions::PVCLIENT | vtkPVOptions::PVSERVER);
this->AddBooleanArgument("--enable-streaming", 0, &this->EnableStreaming,
"EXPERIMENTAL: When specified, view-based streaming is enabled for certain "
"views and representation types.",
vtkPVOptions::ALLPROCESS);
this->AddBooleanArgument("--use-cuda-interop", "-cudaiop",
&this->UseCudaInterop,
......@@ -379,16 +378,6 @@ int vtkPVOptions::PostProcess(int, const char* const*)
}
#endif //PARAVIEW_ALWAYS_SECURE_CONNECTION
if (this->AMRStreaming)
{
vtkErrorMacro("FIXME");
// vtkPVView::SetEnableStreaming(true);
}
else
{
// vtkPVView::SetEnableStreaming(false);
}
return 1;
}
......@@ -538,7 +527,8 @@ void vtkPVOptions::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "SymmetricMPIMode: " << this->SymmetricMPIMode << endl;
os << indent << "ServerURL: "
<< (this->ServerURL? this->ServerURL : "(none)") << endl;
os << indent << "AMRStreaming:" << this->AMRStreaming << endl;
os << indent << "EnableStreaming:" <<
(this->EnableStreaming? "yes" : "no") << endl;
os << indent << "UseCudaInterop" << this->UseCudaInterop << std::endl;
}
......@@ -150,8 +150,9 @@ public:
vtkSetStringMacro(ParaViewDataName);
// Description:
// EXPERIMENTAL: When set, AMR streaming is enabled.
vtkGetMacro(AMRStreaming, int);
// Until streaming becomes mainstream, we enable streaming support by passing
// a command line argument to all processes.
vtkGetMacro(EnableStreaming, int);
// Description:
// When set, use cuda interop feature
......@@ -258,7 +259,7 @@ private:
vtkSetStringMacro(StereoType);
char* StereoType;
int AMRStreaming;
int EnableStreaming;
int UseCudaInterop;
......
......@@ -30,7 +30,9 @@
#==========================================================================
set (Module_SRCS
vtk3DWidgetRepresentation.cxx
vtkAMRVolumeRepresentation.cxx
vtkAMROutlineRepresentation.cxx
vtkAMRStreamingPriorityQueue.cxx
vtkAMRStreamingVolumeRepresentation.cxx
vtkCaveSynchronizedRenderers.cxx
vtkChartRepresentation.cxx
vtkClientServerMoveData.cxx
......@@ -74,6 +76,7 @@ set (Module_SRCS
vtkPVRenderView.cxx
vtkPVRepresentedDataInformation.cxx
vtkPVSelectionInformation.cxx
vtkPVStreamingPiecesInformation.cxx
vtkPVSynchronizedRenderer.cxx
vtkPVSynchronizedRenderWindows.cxx
vtkPVView.cxx
......
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkAMROutlineRepresentation.h"
#include "vtkAlgorithmOutput.h"
#include "vtkAMRStreamingPriorityQueue.h"
#include "vtkAppendCompositeDataLeaves.h"
#include "vtkCompositeDataPipeline.h"
#include "vtkCompositePolyDataMapper2.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkOverlappingAMR.h"
#include "vtkPolyData.h"
#include "vtkProperty.h"
#include "vtkPVGeometryFilter.h"
#include "vtkPVLODActor.h"
#include "vtkPVRenderView.h"
#include "vtkPVStreamingMacros.h"
#include "vtkPVTrivialProducer.h"
#include "vtkRenderer.h"
#include <assert.h>
vtkStandardNewMacro(vtkAMROutlineRepresentation);
//----------------------------------------------------------------------------
vtkAMROutlineRepresentation::vtkAMROutlineRepresentation()
{
this->StreamingCapablePipeline = false;
this->InStreamingUpdate = false;
this->PriorityQueue = vtkSmartPointer<vtkAMRStreamingPriorityQueue>::New();
this->Mapper = vtkSmartPointer<vtkCompositePolyDataMapper2>::New();
this->Actor = vtkSmartPointer<vtkPVLODActor>::New();
this->Actor->SetMapper(this->Mapper);
this->Actor->GetProperty()->SetRepresentationToWireframe();
this->Actor->GetProperty()->SetAmbient(1.0);
this->Actor->GetProperty()->SetDiffuse(0.0);
this->Actor->GetProperty()->SetSpecular(0.0);
this->Actor->SetPickable(0);
}
//----------------------------------------------------------------------------
vtkAMROutlineRepresentation::~vtkAMROutlineRepresentation()
{
}
//----------------------------------------------------------------------------
void vtkAMROutlineRepresentation::SetVisibility(bool val)
{
this->Actor->SetVisibility(val);
this->Superclass::SetVisibility(val);
}
//----------------------------------------------------------------------------
int vtkAMROutlineRepresentation::ProcessViewRequest(
vtkInformationRequestKey* request_type, vtkInformation* inInfo, vtkInformation* outInfo)
{
// always forward to superclass first. Superclass returns 0 if the
// representation is not visible (among other things). In which case there's
// nothing to do.
if (!this->Superclass::ProcessViewRequest(request_type, inInfo, outInfo))
{
return 0;
}
if (request_type == vtkPVView::REQUEST_UPDATE())
{
// Standard representation stuff, first.
// 1. Provide the data being rendered.
vtkPVRenderView::SetPiece(inInfo, this, this->ProcessedData);
// 2. Provide the bounds.
double bounds[6];
this->DataBounds.GetBounds(bounds);
vtkPVRenderView::SetGeometryBounds(inInfo, bounds);
// The only thing extra we need to do here is that we need to let the view
// know that this representation is streaming capable (or not).
vtkPVRenderView::SetStreamable(inInfo, this, this->GetStreamingCapablePipeline());
}
else if (request_type == vtkPVView::REQUEST_RENDER())
{
if (this->RenderedData == NULL)
{
vtkStreamingStatusMacro(<< this << ": cloning delivered data.");
vtkAlgorithmOutput* producerPort = vtkPVRenderView::GetPieceProducer(inInfo, this);
vtkAlgorithm* producer = producerPort->GetProducer();
this->RenderedData =
producer->GetOutputDataObject(producerPort->GetIndex());
this->Mapper->SetInputDataObject(this->RenderedData);
}
}
else if (request_type == vtkPVRenderView::REQUEST_STREAMING_UPDATE())
{
if (this->GetStreamingCapablePipeline())
{
// This is a streaming update request, request next piece.
double view_planes[24];
inInfo->Get(vtkPVRenderView::VIEW_PLANES(), view_planes);
if (this->StreamingUpdate(view_planes))
{
// since we indeed "had" a next piece to produce, give it to the view
// so it can deliver it to the rendering nodes.
vtkPVRenderView::SetNextStreamedPiece(
inInfo, this, this->ProcessedPiece);
}
}
}
else if (request_type == vtkPVRenderView::REQUEST_PROCESS_STREAMED_PIECE())
{
vtkDataObject* piece = vtkPVRenderView::GetCurrentStreamedPiece(inInfo, this);
if (piece)
{
assert (this->RenderedData != NULL);
vtkStreamingStatusMacro( << this << ": received new piece.");
// merge with what we are already rendering.
vtkNew<vtkAppendCompositeDataLeaves> appender;
appender->AddInputDataObject(piece);
appender->AddInputDataObject(this->RenderedData);
appender->Update();
this->RenderedData = appender->GetOutputDataObject(0);
this->Mapper->SetInputDataObject(this->RenderedData);
}
}
return 1;
}
//----------------------------------------------------------------------------
int vtkAMROutlineRepresentation::RequestInformation(vtkInformation *rqst,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
// Determine if the input is streaming capable. A pipeline is streaming
// capable if it provides us with COMPOSITE_DATA_META_DATA() in the
// RequestInformation() pass. It implies that we can request arbitrary blocks
// from the input pipeline which implies stream-ability.
this->StreamingCapablePipeline = false;
if (inputVector[0]->GetNumberOfInformationObjects() == 1)
{
vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
if (inInfo->Has(vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA()) &&
vtkPVView::GetEnableStreaming())
{
this->StreamingCapablePipeline = true;
}
}
vtkStreamingStatusMacro(
<< this << ": streaming capable input pipeline? "
<< (this->StreamingCapablePipeline? "yes" : "no"));
return this->Superclass::RequestInformation(rqst, inputVector, outputVector);
}
//----------------------------------------------------------------------------
int vtkAMROutlineRepresentation::RequestUpdateExtent(
vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
if (!this->Superclass::RequestUpdateExtent(request, inputVector,
outputVector))
{
return 0;
}
for (int cc=0; cc < this->GetNumberOfInputPorts(); cc++)
{
for (int kk=0; kk < inputVector[cc]->GetNumberOfInformationObjects(); kk++)
{
vtkInformation* info = inputVector[cc]->GetInformationObject(kk);
if (this->InStreamingUpdate)
{
assert(this->PriorityQueue->IsEmpty() == false);
int cid = static_cast<int>(this->PriorityQueue->Pop());
vtkStreamingStatusMacro(<< this << ": requesting blocks: " << cid);
// Request the next "group of blocks" to stream.
info->Set(vtkCompositeDataPipeline::LOAD_REQUESTED_BLOCKS(), 1);
info->Set(vtkCompositeDataPipeline::UPDATE_COMPOSITE_INDICES(), &cid, 1);
}
else
{
// let the source deliver whatever is the default. What the reader does
// when the downstream doesn't request any particular blocks in poorly
// defined right now. I am assuming the reader will only read the root
// block or down to some user-specified level.
info->Remove(vtkCompositeDataPipeline::LOAD_REQUESTED_BLOCKS());
info->Remove(vtkCompositeDataPipeline::UPDATE_COMPOSITE_INDICES());
}
}
}
return 1;
}
//----------------------------------------------------------------------------
int vtkAMROutlineRepresentation::RequestData(vtkInformation *rqst,
vtkInformationVector **inputVector, vtkInformationVector *outputVector)
{
if (inputVector[0]->GetNumberOfInformationObjects() == 1)
{
vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
if (inInfo->Has(vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA()) &&
this->GetStreamingCapablePipeline() &&
!this->GetInStreamingUpdate())
{
// Since the representation reexecuted, it means that the input changed
// and we should initialize our streaming.
vtkOverlappingAMR* amr = vtkOverlappingAMR::SafeDownCast(
inInfo->Get(vtkCompositeDataPipeline::COMPOSITE_DATA_META_DATA()));
this->PriorityQueue->Initialize(amr->GetAMRInfo());
}
}
this->ProcessedPiece = 0;
if (inputVector[0]->GetNumberOfInformationObjects() == 1)
{
// Do the streaming independent "transformation" of the data here, in our
// case, generate the outline from the input data.
// To keep things simple here, we don't bother about the "flip-book" caching
// support used for animation playback.
vtkNew<vtkPVGeometryFilter> geomFilter;
geomFilter->SetUseOutline(1);
geomFilter->SetHideInternalAMRFaces(false);
// since we want to show the real data boundaries, we force the filter to
// not use the meta-data.
geomFilter->SetUseNonOverlappingAMRMetaDataForOutlines(false);
vtkOverlappingAMR* input = vtkOverlappingAMR::GetData(inputVector[0], 0);
geomFilter->SetInputData(input);
geomFilter->Update();
if (!this->GetInStreamingUpdate())
{
this->ProcessedData = geomFilter->GetOutputDataObject(0);
double bounds[6];
input->GetBounds(bounds);
this->DataBounds.SetBounds(bounds);
}
else
{
this->ProcessedPiece = geomFilter->GetOutputDataObject(0);
}
}
else
{
// create an empty dataset. This is needed so that view knows what dataset
// to expect from the other processes on this node.
this->ProcessedData = vtkSmartPointer<vtkMultiBlockDataSet>::New();
this->DataBounds.Reset();
}
if (!this->GetInStreamingUpdate())
{
this->RenderedData = 0;
// provide the mapper with an empty input. This is needed only because
// mappers die when input is NULL, currently.
vtkNew<vtkMultiBlockDataSet> tmp;
this->Mapper->SetInputDataObject(tmp.GetPointer());
}
return this->Superclass::RequestData(rqst, inputVector, outputVector);
}
//----------------------------------------------------------------------------
bool vtkAMROutlineRepresentation::StreamingUpdate(const double view_planes[24])
{
assert(this->InStreamingUpdate == false);
if (!this->PriorityQueue->IsEmpty())
{
this->InStreamingUpdate = true;
vtkStreamingStatusMacro(<< this << ": doing streaming-update.")
// update the priority queue, if needed.
this->PriorityQueue->Update(view_planes);
// This ensure that the representation re-executes.
this->MarkModified();
// Execute the pipeline.
this->Update();
this->InStreamingUpdate = false;
return true;
}
return false;
}
//----------------------------------------------------------------------------
int vtkAMROutlineRepresentation::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkOverlappingAMR");
// Saying INPUT_IS_OPTIONAL() is essential, since representations don't have
// any inputs on client-side (in client-server, client-render-server mode) and
// render-server-side (in client-render-server mode).
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
return 1;
}
//----------------------------------------------------------------------------
bool vtkAMROutlineRepresentation::AddToView(vtkView* view)
{
vtkPVRenderView* rview = vtkPVRenderView::SafeDownCast(view);
if (rview)
{
rview->GetRenderer()->AddActor(this->Actor);
return true;
}
return false;
}
//----------------------------------------------------------------------------
bool vtkAMROutlineRepresentation::RemoveFromView(vtkView* view)
{
vtkPVRenderView* rview = vtkPVRenderView::SafeDownCast(view);
if (rview)
{
rview->GetRenderer()->RemoveActor(this->Actor);
return true;
}
return false;
}
//----------------------------------------------------------------------------
void vtkAMROutlineRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "StreamingCapablePipeline: " << this->StreamingCapablePipeline
<< endl;
}
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkAMROutlineRepresentation - a simple outline representation for AMR
// datasets that supports streaming.
// .SECTION Description
// vtkAMROutlineRepresentation is a simple representation for Overlapping-AMR
// datasets that with streaming capabilities. It demonstrates how a
// representation can exploit streaming capabilities provided by ParaView's
// Render View (vtkPVRenderView).
#ifndef __vtkAMROutlineRepresentation_h
#define __vtkAMROutlineRepresentation_h
#include "vtkPVDataRepresentation.h"
#include "vtkSmartPointer.h" // for smart pointer.
#include "vtkWeakPointer.h" // for weak pointer.
#include "vtkBoundingBox.h" // needed for vtkBoundingBox.
class vtkAMRStreamingPriorityQueue;
class vtkCompositePolyDataMapper2;
class vtkPVLODActor;