<div dir="ltr"><div><div>Glad to hear that you've got it working the way you want. <br><br></div>As far as the generated script, you are right that it should just be seen as an example. All it really needs is the RequestDataDescription() and DoCoProcessing() methods (you can also have an optional Finalize() method as well that takes in a datasecription object if you want to do something upon exit). What you do in those methods is pretty much up to your knowledge and imagination. Note that you don't even need to use filters to do data processing. Have you looked at the Python data set adaptor blogs? They start at <a href="https://blog.kitware.com/improved-vtk-numpy-integration/">https://blog.kitware.com/improved-vtk-numpy-integration/</a> and allow you to deal with the data sets in a more Pythonic way and simplify using numpy to do operations.<br><br></div>I have trouble myself figuring out what stuff is actual Python code and what stuff is C++ wrapped. From a functionality standpoint it probably doesn't make a difference but from a debugging standpoint it makes it a bit more tough.<br><div><br><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 7, 2017 at 11:58 AM, Gallagher, Timothy P <span dir="ltr"><<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-3487279973503730073divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif" dir="ltr">
<p>Okay, I'm solidly impressed now. <br>
</p>
<p><br>
</p>
<p>I know it says all over the place that because Paraview uses Python, you can use Python. But for some reason, I always just look at it as using the grammar/structure of Python to interface with vtk and Paraview -- for some reason it takes me some time to
recognize that I can use everything that comes with Python. Not sure why since I use Python every day for a lot of things.
<br>
</p>
<p><br>
</p>
<p>I also get stuck on what is a transparent, helper function and what is an opaque interface to some vtk C++ function. For example, it didn't occur to me that the coprocessor.WriteData() function just looped over a list of writers, formatted the file name,
and then updated the filter. I thought it was something in C++ that did things that weren't exposed to the Python interface.
<br>
</p>
<p><br>
</p>
<p>Now that I'm slowly recognizing those things though, Catalyst is immensely more useful than the way I was using it before. I was sort of pigeonholed into thinking it had to look identical to the output from the generator and the only thing to tweak was in
the pipeline. <br>
</p>
<p><br>
</p>
<p>I've got it set up now to track volume integrated variables every fixed unit of time and also to check if different features appear in the solution. If they appear, it writes some different data files and images. I've attached the processing method just
to close the loop and provide an example of how to do the things I couldn't figure out (and didn't think was possible). I know there's several things that could probably be done better in it, but it works for me at the moment.<br>
</p>
<p><br>
</p>
<p>Thanks again!</p>
<p><br>
</p>
<p>Tim<br>
</p>
<br>
<br>
<div style="color:rgb(49,55,57)">
<hr style="display:inline-block;width:98%">
<div id="m_-3487279973503730073divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Andy Bauer <<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>><br>
<b>Sent:</b> Tuesday, February 7, 2017 11:03 AM<div><div class="h5"><br>
<b>To:</b> Gallagher, Timothy P<br>
<b>Cc:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] Pipeline update with Catalyst</div></div></font>
<div> </div>
</div><div><div class="h5">
<div>
<div dir="ltr">
<div>Indeed it is possibly to write whenever you choose instead of just based on time step number. If you skip the RegisterWriter() when making a Pipeline object writer and then setting the file name and writing it manually you will get what you want. It would
look something like the attached file.<br>
<br>
</div>
Note that I've set the outputfrequency to 1 here since I want to have DoCoProcessing() called every time step. You can put more logic into RequestDataDescription() if you don't want to have to create your grid and have DoCoProcessing() called every time step.<br>
<div><br>
</div>
<div>Thanks for asking detailed questions! There is a whole lot of flexibility provided by using the Python scripts in Catalyst but it can take a bit of expertise to get exactly what you want. I am glad that you are taking advantage of this.<br>
<br>
</div>
<div>Cheers,<br>
</div>
<div>Andy<br>
</div>
<div><br>
<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 7, 2017 at 10:33 AM, Gallagher, Timothy P <span dir="ltr">
<<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-3487279973503730073m_8456282204725794359divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Along those lines, is it possible to turn on/off specific data writers based on something other than time step number?
<br>
</p>
<p><br>
</p>
<p>I have the data collection based on something from IntegrateVariables (it did require a broadcast from root), but I am creating multiple surfaces and would like to only save the data files when the surface appears.
<br>
</p>
<p><br>
</p>
<p>Is there a way to turn on/off the writers through the coprocessor.Pipeline object, or maybe through arguments to WriteData?
<br>
</p>
<p><br>
</p>
<p>As always, thanks for your help.</p>
<p><br>
</p>
<p>Tim<br>
</p>
<br>
<div style="color:rgb(49,55,57)">
<hr style="display:inline-block;width:98%">
<div id="m_-3487279973503730073m_8456282204725794359divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Andy Bauer <<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>><br>
<b>Sent:</b> Tuesday, February 7, 2017 10:05 AM
<div>
<div class="m_-3487279973503730073h5"><br>
<b>To:</b> Gallagher, Timothy P<br>
<b>Cc:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] Pipeline update with Catalyst</div>
</div>
</font>
<div> </div>
</div>
<div>
<div class="m_-3487279973503730073h5">
<div>
<div dir="ltr">
<div>
<div>
<div>The pipeline is update mechanism is often called a lazy update scheme meaning only do the requested work and no more. If the UpdateProducers() method automatically updated all of the filters there would be a lot of unneeded work that would be done. Think
about a Catalyst script that branched into 3 separate outputs with a lot of work done in each branch. If only one output was wanted during a time step that could potentially be a lot of extra, unneeded work.<br>
<br>
</div>
As for parallel communication in Catalyst, again it's an efficiency thing meaning that if we can avoid communication we may as well do it. In interactive mode (i.e. through the GUI) it's useful to know things like the total number of points and cells, bounds
and field ranges which requires communication. In Catalyst this information isn't usually needed so that's the type of information that would need to be globally communicated. For filters like the Integrate Attributes filter, you should get the same behavior
in the GUI as in Catalyst with regard to parallel output since the filter itself does not know how ParaView is running. Some filters (e.g. Resample with Dataset) though only have non-empty results on process 0 so it is definitely safest to check filters like
Integrate Attributes in parallel.<br>
<br>
</div>
Cheers,<br>
</div>
Andy<br>
<div>
<div><br>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 7, 2017 at 7:51 AM, Gallagher, Timothy P <span dir="ltr">
<<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thanks Andy,</p>
<p><br>
</p>
<p>I had a feeling the pipeline had to be manually updated. I thought maybe the UpdateProducers also updated the pipeline. Thanks for clarifying that.
<br>
</p>
<p><br>
</p>
<p>I also have the same concern about the value stored in each block's CellData field. I couldn't find any documentation that indicates how the IntegrateVariables filter distributes the data. But, looking at the block VTK files that are written out, they all
contain the same value of Area so I think a global reduction is done in the filter and all blocks have the total values. I could be wrong though.
<br>
</p>
<p><br>
</p>
<p>Thanks again,</p>
<p><br>
</p>
<p>Tim<br>
</p>
<br>
<br>
<div style="color:rgb(49,55,57)">
<hr style="display:inline-block;width:98%">
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Andy Bauer <<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>><br>
<b>Sent:</b> Tuesday, February 7, 2017 7:44 AM<br>
<b>To:</b> Gallagher, Timothy P<br>
<b>Cc:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] Pipeline update with Catalyst</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div><span>
<div>
<div>
<div>Hi Tim,<br>
<br>
</div>
The short answer is that you need to do coprocessor.Pipeline.flameArea<wbr>.UpdatePipeline() before checking for the area. You also may need to use MPI to do the global sum or broadcast of the value since I think that value will either just have local values
or maybe just the proper global value on processor 0. You should have access to mpi4py in the Python script in order to do that.<br>
<br>
</div>
The long answer is that ParaView & VTK use a demand-driven pipeline design meaning that until something explicitly tells a pipeline to update it won't. For the Catalyst scripts this is done in the coprocessor.WriteData(), coprocessor.WriteImages() and coprocessor.DoLiveVisualizatio<wbr>n()
calls for each output that is required (e.g. for a writer that is supposed to output at that time step but not for other writers that are not supposed to output at that time step). You can manually force a filter to update by using the UpdatePipeline() method
which will update that pipeline along with everything it depends on. It won't update any filters though that don't have an effect on it computing its requested information which means that for the flameArea filter it won't affect any writers or image output
stuff which is what you want.<br>
<br>
</div>
There is some information on Catayst script details at <a id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPlnk924266" href="https://blog.kitware.com/anatomy-of-a-paraview-catalyst-python-script/" target="_blank">
https://blog.kitware.com/anato<wbr>my-of-a-paraview-catalyst-pyth<wbr>on-script/</a> but I don't think that contains this information.
</span>
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPBorder_GT_14864716254810.48106436051284385" style="margin-bottom:20px;overflow:auto;width:100%;text-indent:0px">
<table id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPContainer_14864716254740.027265943784062774" style="width:90%;background-color:rgb(255,255,255);overflow:auto;padding-top:20px;padding-bottom:20px;margin-top:20px;border-top:1px dotted rgb(200,200,200);border-bottom:1px dotted rgb(200,200,200)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td colspan="1" id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524ImageCell_14864716254770.07028136411092378" style="width:250px;display:table-cell;padding-right:20px">
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPImageContainer_14864716254770.7280136240546761" style="background-color:rgb(255,255,255);height:125px;margin:auto;display:table;width:100px">
<a href="https://blog.kitware.com/anatomy-of-a-paraview-catalyst-python-script/" id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPImageAnchor_14864716254770.3321707710676972" style="display:table-cell;text-align:center" target="_blank"><img id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPThumbnailImageID_14864716254780.00860112815762426" style="display:inline-block;max-width:250px;max-height:250px;height:125px;width:100px;border-width:0px;vertical-align:bottom" src="https://blog.kitware.com/source/files/Small.4_447936566.jpg" width="100" height="125"></a></div>
</td>
<td colspan="2" id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524TextCell_14864716254780.2558702480370797" style="vertical-align:top;padding:0px;display:table-cell">
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPRemovePreviewContainer_14864716254780.7398717076792145">
</div>
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPTitle_14864716254780.7697739656531463" style="color:rgb(17,111,160);font-weight:400;font-size:21px;font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;line-height:21px">
<a href="https://blog.kitware.com/anatomy-of-a-paraview-catalyst-python-script/" id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPUrlAnchor_14864716254790.7649144835302768" style="text-decoration:none" target="_blank">Anatomy of a ParaView Catalyst Python Script
| The Kitware ...</a></div>
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPMetadata_14864716254790.039913772958364735" style="margin:10px 0px 16px;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:14px">
<a href="http://blog.kitware.com" target="_blank">blog.kitware.com</a></div>
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524LPDescription_14864716254800.5245668952580711" style="display:block;color:rgb(102,102,102);font-weight:400;font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;font-size:14px;line-height:20px;max-height:100px;overflow:hidden">
Introduction. ParaView Catalyst has yielded some amazing results. Such results include iso-surfacing and generating images with 256K Message Passing Interface (MPI ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
Cheers,<br>
</div>
Andy<br>
</div>
<div>
<div class="m_-3487279973503730073m_8456282204725794359h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Feb 7, 2017 at 7:14 AM, Gallagher, Timothy P <span dir="ltr">
<<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div id="m_-3487279973503730073m_8456282204725794359m_3978744253390802524m_-3543213876447494334divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hello again,</p>
<p><br>
</p>
<p>I am working on a pipeline using Catalyst that writes data only when features are detected. The idea is to have a 3D contour generated in the pipeline, and when it is big enough, start recording data. There is a long lead-up to when the features appear,
and then they disappear rapidly, so I would like to only collect data when the features are present.
<br>
</p>
<p><br>
</p>
<p>To that end, my DoCoProcessing() function has something that checks the 'Area' value in the CellData of an IntegrateVariables filter. The full function is below. However, this doesn't ever write any images or data. It also doesn't throw any errors, so I
have a feeling the pipeline isn't actually evaluated/updated after the call to UpdateProducers.
<br>
</p>
<p><br>
</p>
<p>So, my question -- at what point in the DoCoProcessing function is the pipeline actually evaluated? Do all the filters execute when the UpdatedProducers function is called? Or do they only update when the outputs to which they are connected are called, ie.
WriteData and WriteImages? <br>
</p>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Tim</p>
<p><br>
</p>
<p></p>
<div>def DoCoProcessing(datadescription<wbr>):<br>
"Callback to do co-processing for current timestep"<br>
global coprocessor<br>
global lastTime<br>
global deltaT<br>
<br>
# Update the coprocessor by providing it the newly generated simulation data. <wbr> <wbr> <wbr> <wbr> <br>
# If the pipeline hasn't been setup yet, this will setup the pipeline. <wbr> <wbr> <wbr> <wbr> <br>
coprocessor.UpdateProducers(da<wbr>tadescription)<br>
<br>
curTime = datadescription.GetTime()<br>
<br>
if curTime >= lastTime + deltaT:<br>
lastTime = curTime<br>
<br>
if coprocessor.Pipeline.flameArea<wbr>.CellData['Area'] > 1e-9:<br>
# Write output data, if appropriate. <wbr> <wbr> <wbr> <wbr> <wbr> <br>
coprocessor.WriteData(datadesc<wbr>ription);<br>
<br>
# Write image capture (Last arg: rescale lookup table), if appropriate. <wbr> <wbr> <wbr> <wbr> <br>
coprocessor.WriteImages(datade<wbr>scription, rescale_lookuptable=False)<br>
<br>
# Live Visualization, if enabled. <wbr> <wbr> <wbr> <wbr> <wbr> <br>
coprocessor.DoLiveVisualizatio<wbr>n(datadescription, "localhost", 22222)<br>
</div>
<br>
<p></p>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">
http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">
http://paraview.org/Wiki/ParaV<wbr>iew</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">
http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/paraview</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br></div>