Hi Andy,
Strange! To test the idea and eliminate other problems i am using same
script twice with little mods (i just changed the name of the output png
file). So, if i pass script_1.py and script_2.py to the model, it gives
warning like before and creates output just for second script
(script_2.py). If i pass only one of them then the code is working
without any problem and produces desired output.
Thanks,
Regards,
--ufuk
On 06/07/2017 18:09, Andy Bauer wrote:
Hi Ufuk,
I'm guessing the issue is that the calls to Catalyst are not
consistent. Could you share your Python scripts? Also, did you modify
them manually?
I tried with PV 5.3. with
the ../ParaView-v5.3.0/Examples/Catalyst/CxxFullExample/ example with
the attached scripts simultaneously by running with "./CxxFullExample
doubleoutputs.py output3.py image11.py" and got the correct output and
no warnings.
Cheers,
Andy
On Tue, Jul 4, 2017 at 7:04 AM, Ufuk Utku Turuncoglu (BE)
<u.utku.turunco...@be.itu.edu.tr
<mailto:u.utku.turunco...@be.itu.edu.tr>> wrote:
Hi Andy,
I tested you suggestion about using multiple script in
co-processing. In this case, i used following code in the adaptor
side to add multiple pipeline
for (int i = 0; i < *nscript; i++) {
pipeline->Initialize(pythonScriptNames[i]);
g_coprocessor->AddPipeline(pipeline);
}
When i run the simulation, i am getting following warning
Warning: In
/okyanus/users/uturuncoglu/progs/paraview-5.3.0/src/ParaViewCore/VTKExtensions/Core/vtkPVTrivialProducer.cxx,
line 66
vtkPVTrivialProducer (0x13816760): New time step is not after last
time step.
the output seems not correct and it is zoom out version of second
pipeline (png file). The first pipeline is not even triggered. Do
i missing something in here? BTW, i am using PV 5.3.
Thanks,
--ufuk
On 16/05/2017 16:08, Andy Bauer wrote:
Hi Ufuk,
If you create a vtkCPythonScriptPipeline, when you initialize it
with the script file name (which has to be done on each process)
everything will be taken care of with respect to broadcasting the
file contents from process 0 to the others. We aren't
sophisticated enough to parse the Python script to see if it
imports other scripts that are not part of ParaView (e.g.
paraview.simple) or Python (e.g. sys). That is why I recommended
the first approach as opposed to the second approach above.
Depending on the compute platform and how many MPI processes are
in the run the difference may be negligible but having 100K
processes or more trying to access the same file can seriously
slow down an HPC machine.
Cheers,
Andy
On Tue, May 16, 2017 at 8:24 AM, Ufuk Utku Turuncoglu (BE)
<u.utku.turunco...@be.itu.edu.tr
<mailto:u.utku.turunco...@be.itu.edu.tr>> wrote:
Thanks Andy. That is exactly what i am looking for. The
broadcasting mechanism is not clear to me yet. Do i need to
broadcast only the file names? Anyway, i will try to
implement it and see what is going on there.
Thanks again,
Regards,
--ufuk
On 16/05/2017 14:58, Andy Bauer wrote:
Hi Ufuk,
Unless I'm not understanding your question correctly, I
think you can get what you want by adding in multiple
vtkCPPythonScriptPipelines to your vtkCPProcessor object in
your adaptor. Alternatively if you want to have a single,
master Catalyst script handling other Catalyst scripts you
can do something like the following:
================
import script_a
import script_b
import script_c
def RequestDataDescription(datadescription):
script_a.RequestDataDescription(datadescription)
script_b.RequestDataDescription(datadescription)
script_c.RequestDataDescription(datadescription)
def DoCoProcessing(datadescription):
script_a.DoCoProcessing(datadescription)
script_b.DoCoProcessing(datadescription)
script_c.DoCoProcessing(datadescription)
===================
The first way is the recommended way though as that should
be more efficient by having process 0 read the scripts and
broadcasting the script contents to the other processes for
use. The second method will only do that for the master script.
Please let me know if this doesn't answer your question.
Cheers,
Andy
On Tue, May 16, 2017 at 5:46 AM, Ufuk Utku Turuncoglu (BE)
<u.utku.turunco...@be.itu.edu.tr
<mailto:u.utku.turunco...@be.itu.edu.tr>> wrote:
Hi All,
I just wonder that is it possible to trigger multiple
visualization pipeline in the same time with
co-processing. The co-processing script generator plugin
mainly outputs only single pipeline at a time and that
is fine but what about combining multiple Python script
(generated by plugin) using higher level Python script
to trigger multiple pipelines. So, i think that this
will be much efficient way to look at different part of
the data without writing to the disk. I am not sure but
somebody else might do it before.
Regards,
--ufuk
_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
<http://www.kitware.com/opensource/opensource.html>
Please keep messages on-topic and check the ParaView
Wiki at: http://paraview.org/Wiki/ParaView
<http://paraview.org/Wiki/ParaView>
Search the list archives at:
http://markmail.org/search/?q=ParaView
<http://markmail.org/search/?q=ParaView>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview
<http://public.kitware.com/mailman/listinfo/paraview>
from paraview.simple import *
from paraview import coprocessing
#--------------------------------------------------------------
# Code generated from cpstate.py to create the CoProcessor.
# ParaView 5.3.0 64 bits
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
# state file generated using paraview version 5.3.0
# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# Create a new 'Render View'
renderView1 = CreateView('RenderView')
renderView1.ViewSize = [1113, 756]
renderView1.InteractionMode = '2D'
renderView1.AxesGrid = 'GridAxes3DActor'
renderView1.CenterOfRotation = [-77.36604544860647, 23.486562272948845, 0.0]
renderView1.StereoType = 0
renderView1.CameraPosition = [-77.36604544860647, 23.486562272948845, 143.99432596285266]
renderView1.CameraFocalPoint = [-77.36604544860647, 23.486562272948845, 0.0]
renderView1.CameraParallelScale = 37.26847394588663
renderView1.Background = [0.32, 0.34, 0.43]
# register the view with coprocessor
# and provide it with information such as the filename to use,
# how frequently to write the images, etc.
coprocessor.RegisterView(renderView1,
filename='image_s1_%t.png', freq=1, fittoscreen=0, magnification=1, width=1113, height=756, cinema={})
renderView1.ViewTime = datadescription.GetTime()
# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------
# create a new 'XML MultiBlock Data Reader'
# create a producer from a simulation input
atm_input2d_3vtm = coprocessor.CreateProducer(datadescription, 'atm_input2d')
# ----------------------------------------------------------------
# setup color maps and opacity mapes used in the visualization
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------
# get color transfer function/color map for 'topo'
topoLUT = GetColorTransferFunction('topo')
topoLUT.RGBPoints = [0.0, 0.231373, 0.298039, 0.752941, 1733.1236204565378, 0.865003, 0.865003, 0.865003, 3466.2472409130755, 0.705882, 0.0156863, 0.14902]
topoLUT.ScalarRangeInitialized = 1.0
# get opacity transfer function/opacity map for 'topo'
topoPWF = GetOpacityTransferFunction('topo')
topoPWF.Points = [0.0, 0.0, 0.5, 0.0, 3466.2472409130755, 1.0, 0.5, 0.0]
topoPWF.ScalarRangeInitialized = 1
# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------
# show data from atm_input2d_3vtm
atm_input2d_3vtmDisplay = Show(atm_input2d_3vtm, renderView1)
# trace defaults for the display properties.
atm_input2d_3vtmDisplay.Representation = 'Surface'
atm_input2d_3vtmDisplay.ColorArrayName = ['POINTS', 'topo']
atm_input2d_3vtmDisplay.LookupTable = topoLUT
atm_input2d_3vtmDisplay.OSPRayScaleArray = 'mask'
atm_input2d_3vtmDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
atm_input2d_3vtmDisplay.SelectOrientationVectors = 'None'
atm_input2d_3vtmDisplay.ScaleFactor = 6.2690730052172885
atm_input2d_3vtmDisplay.SelectScaleArray = 'None'
atm_input2d_3vtmDisplay.GlyphType = 'Arrow'
atm_input2d_3vtmDisplay.PolarAxes = 'PolarAxesRepresentation'
atm_input2d_3vtmDisplay.ScalarOpacityUnitDistance = 2.187782201235087
# show color legend
atm_input2d_3vtmDisplay.SetScalarBarVisibility(renderView1, True)
# setup the color legend parameters for each legend in this view
# get color legend/bar for topoLUT in view renderView1
topoLUTColorBar = GetScalarBar(topoLUT, renderView1)
topoLUTColorBar.Title = 'topo'
topoLUTColorBar.ComponentTitle = ''
# ----------------------------------------------------------------
# finally, restore active source
SetActiveSource(atm_input2d_3vtm)
# ----------------------------------------------------------------
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
coprocessor = CoProcessor()
# these are the frequencies at which the coprocessor updates.
freqs = {'atm_input2d': [1]}
coprocessor.SetUpdateFrequencies(freqs)
return coprocessor
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False, 1)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);
# Write image capture (Last arg: rescale lookup table), if appropriate.
coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
# Live Visualization, if enabled.
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
from paraview.simple import *
from paraview import coprocessing
#--------------------------------------------------------------
# Code generated from cpstate.py to create the CoProcessor.
# ParaView 5.3.0 64 bits
# ----------------------- CoProcessor definition -----------------------
def CreateCoProcessor():
def _CreatePipeline(coprocessor, datadescription):
class Pipeline:
# state file generated using paraview version 5.3.0
# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# Create a new 'Render View'
renderView1 = CreateView('RenderView')
renderView1.ViewSize = [1113, 756]
renderView1.InteractionMode = '2D'
renderView1.AxesGrid = 'GridAxes3DActor'
renderView1.CenterOfRotation = [-77.36604544860647, 23.486562272948845, 0.0]
renderView1.StereoType = 0
renderView1.CameraPosition = [-77.36604544860647, 23.486562272948845, 143.99432596285266]
renderView1.CameraFocalPoint = [-77.36604544860647, 23.486562272948845, 0.0]
renderView1.CameraParallelScale = 37.26847394588663
renderView1.Background = [0.32, 0.34, 0.43]
# register the view with coprocessor
# and provide it with information such as the filename to use,
# how frequently to write the images, etc.
coprocessor.RegisterView(renderView1,
filename='image_s2_%t.png', freq=1, fittoscreen=0, magnification=1, width=1113, height=756, cinema={})
renderView1.ViewTime = datadescription.GetTime()
# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------
# create a new 'XML MultiBlock Data Reader'
# create a producer from a simulation input
atm_input2d_3vtm = coprocessor.CreateProducer(datadescription, 'atm_input2d')
# ----------------------------------------------------------------
# setup color maps and opacity mapes used in the visualization
# note: the Get..() functions create a new object, if needed
# ----------------------------------------------------------------
# get color transfer function/color map for 'topo'
topoLUT = GetColorTransferFunction('topo')
topoLUT.RGBPoints = [0.0, 0.231373, 0.298039, 0.752941, 1733.1236204565378, 0.865003, 0.865003, 0.865003, 3466.2472409130755, 0.705882, 0.0156863, 0.14902]
topoLUT.ScalarRangeInitialized = 1.0
# get opacity transfer function/opacity map for 'topo'
topoPWF = GetOpacityTransferFunction('topo')
topoPWF.Points = [0.0, 0.0, 0.5, 0.0, 3466.2472409130755, 1.0, 0.5, 0.0]
topoPWF.ScalarRangeInitialized = 1
# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------
# show data from atm_input2d_3vtm
atm_input2d_3vtmDisplay = Show(atm_input2d_3vtm, renderView1)
# trace defaults for the display properties.
atm_input2d_3vtmDisplay.Representation = 'Surface'
atm_input2d_3vtmDisplay.ColorArrayName = ['POINTS', 'topo']
atm_input2d_3vtmDisplay.LookupTable = topoLUT
atm_input2d_3vtmDisplay.OSPRayScaleArray = 'mask'
atm_input2d_3vtmDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
atm_input2d_3vtmDisplay.SelectOrientationVectors = 'None'
atm_input2d_3vtmDisplay.ScaleFactor = 6.2690730052172885
atm_input2d_3vtmDisplay.SelectScaleArray = 'None'
atm_input2d_3vtmDisplay.GlyphType = 'Arrow'
atm_input2d_3vtmDisplay.PolarAxes = 'PolarAxesRepresentation'
atm_input2d_3vtmDisplay.ScalarOpacityUnitDistance = 2.187782201235087
# show color legend
atm_input2d_3vtmDisplay.SetScalarBarVisibility(renderView1, True)
# setup the color legend parameters for each legend in this view
# get color legend/bar for topoLUT in view renderView1
topoLUTColorBar = GetScalarBar(topoLUT, renderView1)
topoLUTColorBar.Title = 'topo'
topoLUTColorBar.ComponentTitle = ''
# ----------------------------------------------------------------
# finally, restore active source
SetActiveSource(atm_input2d_3vtm)
# ----------------------------------------------------------------
return Pipeline()
class CoProcessor(coprocessing.CoProcessor):
def CreatePipeline(self, datadescription):
self.Pipeline = _CreatePipeline(self, datadescription)
coprocessor = CoProcessor()
# these are the frequencies at which the coprocessor updates.
freqs = {'atm_input2d': [1]}
coprocessor.SetUpdateFrequencies(freqs)
return coprocessor
#--------------------------------------------------------------
# Global variables that will hold the pipeline for each timestep
# Creating the CoProcessor object, doesn't actually create the ParaView pipeline.
# It will be automatically setup when coprocessor.UpdateProducers() is called the
# first time.
coprocessor = CreateCoProcessor()
#--------------------------------------------------------------
# Enable Live-Visualizaton with ParaView
coprocessor.EnableLiveVisualization(False, 1)
# ---------------------- Data Selection method ----------------------
def RequestDataDescription(datadescription):
"Callback to populate the request for current timestep"
global coprocessor
if datadescription.GetForceOutput() == True:
# We are just going to request all fields and meshes from the simulation
# code/adaptor.
for i in range(datadescription.GetNumberOfInputDescriptions()):
datadescription.GetInputDescription(i).AllFieldsOn()
datadescription.GetInputDescription(i).GenerateMeshOn()
return
# setup requests for all inputs based on the requirements of the
# pipeline.
coprocessor.LoadRequestedData(datadescription)
# ------------------------ Processing method ------------------------
def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
# Update the coprocessor by providing it the newly generated simulation data.
# If the pipeline hasn't been setup yet, this will setup the pipeline.
coprocessor.UpdateProducers(datadescription)
# Write output data, if appropriate.
coprocessor.WriteData(datadescription);
# Write image capture (Last arg: rescale lookup table), if appropriate.
coprocessor.WriteImages(datadescription, rescale_lookuptable=False)
# Live Visualization, if enabled.
coprocessor.DoLiveVisualization(datadescription, "localhost", 22222)
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview