Commit ba62e7ab authored by Dan Lipsa's avatar Dan Lipsa

Enable editing of filename, frequency for Catalyst writers through Live.

Change-Id: Ib98a5412dc7b0a0d5f4ceff1e23bd6073288ac5e
parent bb0fc3f0
......@@ -17,6 +17,7 @@
// vtkPVCatalystSessionCore is used by vtkSMSession.
// vtkPVCatalystSessionCore handle catalyst based proxy which don't contains any
// real data and therefore are not allowed to execute the VTK pipeline.
// @ingroup LiveInsitu
#ifndef __vtkPVCatalystSessionCore_h
#define __vtkPVCatalystSessionCore_h
......
......@@ -100,7 +100,6 @@ target_link_libraries(vtkPVServerManagerApplication
#------------------------------------------------------------------------------
SET(requestedResourceFiles
${CMAKE_CURRENT_SOURCE_DIR}/Resources/3d_widgets.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/catalyst.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/filters.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/internal_writers.xml
${CMAKE_CURRENT_SOURCE_DIR}/Resources/readers.xml
......
......@@ -13268,5 +13268,262 @@ found and the point will be rejected.</Documentation>
</IntVectorProperty>
<!-- End ImageDataToUniformGrid -->
</SourceProxy>
<!-- Catalyst client only proxies, used to generate a coprocessing script
and to modify writer filename and frequency through ParaView Live -->
<!-- ================================================================= -->
<SourceProxy name="XMLPImageDataWriter" class="vtkPVNullSource"
label="Parallel Image Data Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkImageData" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvti">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPImageDataWriter" />
</Hints>
<!-- End of XMLPImageDataWriter -->
</SourceProxy>
<SourceProxy name="XMLPRectilinearGridWriter" class="vtkPVNullSource"
label="Parallel Rectilinear Grid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkRectilinearGrid" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtr">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPRectilinearGridWriter" />
</Hints>
<!-- End of XMLRectilinearGridWriter -->
</SourceProxy>
<SourceProxy name="XMLPStructuredGridWriter" class="vtkPVNullSource"
label="Parallel Structured Grid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkStructuredGrid" composite_data_supported="0"/>
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvts">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPStructuredGridWriter" />
</Hints>
<!-- End of XMLPStructuredGridWriter -->
</SourceProxy>
<SourceProxy name="XMLPPolyDataWriter" class="vtkPVNullSource"
label="Parallel PolyData Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type" composite_data_supported="0">
<DataType value="vtkPolyData" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtp">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPPolyDataWriter" />
</Hints>
<!-- End of XMLPPolyDataWriter -->
</SourceProxy>
<SourceProxy name="XMLPUnstructuredGridWriter" class="vtkPVNullSource"
label="Parallel UnstructuredGrid Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkUnstructuredGrid" composite_data_supported="0"/>
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.pvtu">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLPUnstructuredGridWriter" />
</Hints>
<!-- End of XMLPUnstructuredGridWriter -->
</SourceProxy>
<SourceProxy name="XMLMultiBlockDataWriter" class="vtkPVNullSource"
label="Parallel MultiBlockDataSet Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkMultiBlockDataSet" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.vtm">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLMultiBlockDataWriter" />
</Hints>
<!-- End of XMLMultiBlockDataWriter -->
</SourceProxy>
<SourceProxy name="XMLHierarchicalBoxDataWriter" class="vtkPVNullSource"
label="Parallel Hierarchical Box Data Writer">
<InputProperty name="Input">
<ProxyGroupDomain name="groups">
<Group name="sources" />
<Group name="filters" />
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkHierarchicalBoxDataSet" />
</DataTypeDomain>
<Documentation>
The input.
</Documentation>
</InputProperty>
<StringVectorProperty name="FileName"
number_of_elements="1"
default_values="filename_%t.vth">
</StringVectorProperty>
<IntVectorProperty name="WriteFrequency"
number_of_elements="1"
default_values="1">
<IntRangeDomain name="range" min="1" />
</IntVectorProperty>
<Hints>
<!-- TODO: this doesn't work yet -->
<PipelineIcon name=":pqComponents/pqSave32.png" />
<!-- This will help us when exporting the script state -->
<WriterProxy group="writers" name="XMLHierarchicalBoxDataWriter" />
</Hints>
<!-- End of XMLHierarchicalBoxDataWriter -->
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -69,7 +69,6 @@ ADD_PARAVIEW_PLUGIN(
CoProcessingPlugin
#"${CoProcessing_VERSION_MAJOR}.${CoProcessing_VERSION_MINOR}.${CoProcessing_VERSION_PATCH}"
"0.1.0"
SERVER_MANAGER_XML Resources/servermanagercp.xml
GUI_INTERFACES
${PARAVIEW_PLUGIN_IFACES}
${PARAVIEW_PLUGIN_IFACES2}
......
......@@ -115,9 +115,12 @@ class CoProcessor(object):
write-frequencies set on the writers."""
timestep = datadescription.GetTimeStep()
for writer in self.__WritersList:
if (timestep % writer.cpFrequency) == 0 or \
frequency = writer.parameters.GetProperty(
"WriteFrequency").GetElement(0)
fileName = writer.parameters.GetProperty("FileName").GetElement(0)
if (timestep % frequency) == 0 or \
datadescription.GetForceOutput() == True:
writer.FileName = writer.cpFileName.replace("%t", str(timestep))
writer.FileName = fileName.replace("%t", str(timestep))
writer.UpdatePipeline(datadescription.GetTime())
def WriteImages(self, datadescription, rescale_lookuptable=False):
......@@ -157,8 +160,8 @@ class CoProcessor(object):
# Create the vtkLiveInsituLink i.e. the "link" to the visualization processes.
self.__LiveVisualizationLink = servermanager.vtkLiveInsituLink()
# Tell vtkLiveInsituLink what host/port must it connect to for the visualization
# process.
# Tell vtkLiveInsituLink what host/port must it connect to
# for the visualization process.
self.__LiveVisualizationLink.SetHostname(hostname)
self.__LiveVisualizationLink.SetInsituPort(int(port))
......@@ -227,12 +230,33 @@ class CoProcessor(object):
write the output files appropriately in WriteData() is called."""
if not isinstance(writer, servermanager.Proxy):
raise RuntimeError, "Invalid 'writer' argument passed to RegisterWriter."
writerParametersProxy = self.WriterParametersProxy(
writer, filename, freq)
writer.FileName = filename
writer.add_attribute("cpFrequency", freq)
writer.add_attribute("cpFileName", filename)
writer.add_attribute("parameters", writerParametersProxy)
self.__WritersList.append(writer)
return writer
def WriterParametersProxy(self, writer, filename, freq):
"""Creates a client only proxy that will be synchronized with ParaView
Live, allowing a user to set filename and frequency.
"""
controller = servermanager.ParaViewPipelineController()
# assume that a client only proxy with the same name as a writer
# is available in "filters"
proxy = servermanager.ProxyManager().NewProxy(
"filters", writer.GetXMLName())
controller.PreInitializeProxy(proxy)
proxy.GetProperty("Input").SetInputConnection(
0, writer.Input.SMProxy, 0)
proxy.GetProperty("FileName").SetElement(0, filename)
proxy.GetProperty("WriteFrequency").SetElement(0, freq)
controller.PostInitializeProxy(proxy)
controller.RegisterPipelineProxy(proxy)
return proxy
def RegisterView(self, view, filename, freq, fittoscreen, magnification, width, height):
"""Register a view for image capture with extra meta-data such
as magnification, size and frequency."""
......
......@@ -132,8 +132,12 @@ class WriterAccessor(smtrace.RealProxyAccessor):
print "WARNING: Could not find", xmlname, "writer in", xmlgroup, \
"XML group. This is not a problem as long as the writer is available with " \
"the ParaView build used by the simulation code."
return servermanager._make_name_valid(xmlname)
return servermanager._make_name_valid(prototype.GetXMLLabel())
ctor = servermanager._make_name_valid(xmlname)
else:
ctor = servermanager._make_name_valid(prototype.GetXMLLabel())
# we create the writer proxy such that it is not registered with the
# ParaViewPipelineController, so its state is not sent to ParaView Live.
return "servermanager.%s.%s" % (xmlgroup, ctor)
def trace_ctor(self, ctor, filter, ctor_args=None, skip_assignment=False):
xmlElement = self.get_object().GetHints().FindNestedElementByName("WriterProxy")
......
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