Hi Tim,<br><br>Sorry for the slow reply. I&#39;m away at a conference. <br><br>It shouldn&#39;t matter how the data object was created in the adaptor.<br><br>For the life of me, I can&#39;t figure out why you&#39;re getting this behavior. You can probably just take out the IsFieldNeeded() check in coprocessingwrap.cxx. You should be making sure that if flag is set to 0 in your checktime_() method that the grid and fields aren&#39;t reconstructed anyways and you can skip the call to coprocess_(). <br>
<br>Andy<br><br><div class="gmail_quote">On Fri, Nov 9, 2012 at 3:45 PM, Tim Gallagher <span dir="ltr">&lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif">Andy,<br><br>Attached are the outputs. wavelet.tar.gz is from your script, cpModif.tar.gz are the images from my modified version and cpOrig.tar.gz is the output from the original script exported from PV. <br>
<br>Clearly the wavelet works. Does it have something to do with using a VTK generator (pvsimple.Wavelet()) vs generating a CP script from a loaded data file? <br><br>In other words, this wavelet example and the example online use a VTK data generator so the pipeline knows what fields are generated and thus what are needed. But, in my case, I set up my CP script by loading an Xdmf file. There must be some magic that goes on inside the XdmfReader that sets the fields available, just like the wavelet generator does? And since CP isn&#39;t using the Xdmf reader but I am building the VTK dataset myself, I need to do the same field-setting magic?<br>
<br>If that&#39;s the case, then it should be true for a CP script generated from *any* data file reader. I know when I open my data file I get to choose which fields to load. Maybe this should be added to the export state script (which is what I did by hand) automatically? Like it is in the python trace file?<br>
<br>Tim<br><br><hr><div style="font-size:12pt;font-style:normal;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal"><div class="im"><b>From: </b>&quot;Andy Bauer&quot; &lt;<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>&gt;<br>
<b>To: </b>&quot;tim gallagher&quot; &lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;<br><b>Cc: </b>&quot;ParaView list&quot; &lt;<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>&gt;<br>
</div><b>Sent: </b>Friday, November 9, 2012 4:21:48 PM<div><div class="h5"><br><b>Subject: </b>Re: [Paraview] CoProcessing needed fields<br><br>I can&#39;t tell for sure but what are you using as inputName in ParaViewCoProcessor.cxx? It should be &#39;input&#39;. Also, how many time steps have you run? It should output information only every 10th time step.<br>
<br>
Can you try running the attached files as &quot;&lt;exe path&gt;/pvbatch waveletdriver.py cpwaveletrender.py 5&quot; and send me the output? This should generate 5 images. You should probably update your paraview source too before doing this as a couple of bugs got fixed that may be required to run this example.<br>

<br>
Andy<br><br><div class="gmail_quote">On Thu, Nov 8, 2012 at 8:02 PM, Tim Gallagher <span dir="ltr">&lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif">That was also a bug that resulted in errors I fixed, it wasn&#39;t what is causing this other issue. <br><br>Attached is a tar file with a few files:<br>


<br>cpScript_orig.py is what comes out of Python, but after I changed the write_frequencies thing to get rid of the quotes. That generates an image where the slice is gray. <br><br>cpScript.py is the one I modified to add the needed fields. This generates an image where the slice is colored by the colormap. This is the PNG file in the tar file.<br>


<br>coprocessingwrap.cxx is the interface for Fortran. <br><br>ParaviewCoProcessor.hxx/cxx is the class to handle the CP handles. <br><br>This is called from a Fortran code where each time step it calls a function that does:<br>


<br>   CALL ClearData(...)<br>   CALL CheckTime(...)<br>   <br>   DO blk = 1, numBlocks<br>        &lt;set a bunch of pointers to Fortran data arrays&gt;<br>        CALL AddData(...)<br>   END DO<br><br>   CALL CoProcess(...)<br>


<br>All those functions are in the wrapper C++ code. <br><br>I may be doing something horribly wrong... But it works when I modified the script as you see in cpScript.py.<br><br>Thanks,<br><br>Tim<br><br><hr><div style="font-size:12pt;font-style:normal;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal">


<div><b>From: </b>&quot;Andy Bauer&quot; &lt;<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>&gt;<br><b>To: </b>&quot;tim gallagher&quot; &lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;<br>


<b>Cc: </b>&quot;ParaView list&quot; &lt;<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>&gt;<br></div><b>Sent: </b>Thursday, November 8, 2012 7:47:50 PM<div><div><br><b>Subject: </b>Re: [Paraview] CoProcessing needed fields<br>


<br>Ah, I think I see what&#39;s going on now. I think it was a bug in the generated scripts that was causing problems. Were you getting something like the following in your script:<br>write_frequencies    = {&#39;input&#39;: [&#39;1&#39;]}<br>



<br>The bug was that the 1 shouldn&#39;t be in quotes. If you take that out do you start getting the results you expect? If not, can you share your generated Python script?<br><br>Andy<br><br><br><div class="gmail_quote">



On Thu, Nov 8, 2012 at 6:41 PM, Tim Gallagher <span dir="ltr">&lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif">Andy,<br><br>Thanks for the answer. <br><br>What I&#39;m doing doesn&#39;t use any writers -- I just want the CoProcessor to output images only. So I don&#39;t attach a writer, I just export the state and tell it to &quot;Output Rendering Components&quot;. My pipeline looks like:<br>



<br>Load file -&gt; CellDataToPointData -&gt; Slice<br><br>This results in a RequestDataDescription:<br><br>def RequestDataDescription(datadescription):<br>    &quot;Callback to populate the request for current timestep&quot;<br>



    if datadescription.GetForceOutput() == True:<br>        for i in range(datadescription.GetNumberOfInputDescriptions()):<br>            datadescription.GetInputDescription(i).AllFieldsOn()<br>            datadescription.GetInputDescription(i).GenerateMeshOn()<br>



        return<br><br>    for input_name in simulation_input_map.values():<br>       LoadRequestedData(datadescription, input_name)<br><br>This means in my case, there are no fields defined inside the datadescription. So when I try to do the IsFieldNeeded() call in my adaptor, it&#39;s always false. If I print the number of fields from GetNumberOfFields(), I get 0. <br>



<br>So my images when they pop out have no data -- the fields don&#39;t exist for them to plot. It&#39;s just the slice using the default color for the surface.<br><br>I got it to work by making a new variable just under simulation_input_map:<br>



<br>simulation_cell_fields_needed = {simulation_input_map[&#39;rest_00000.xmf&#39;]: [&quot;Temperature [K]&quot;, &quot;Density [kg/m^3]&quot;]}<br>simulation_point_fields_needed = {simulation_input_map[&#39;rest_00000.xmf&#39;]: []}<br>



<br>and putting in RequestDataDescription before the loop that calls LoadRequestedData:<br><br>    for input_name in simulation_input_map.values():<br>      idd = datadescription.GetInputDescriptionByName(input_name)<br>


      for cell_fields in simulation_cell_fields_needed[input_name]:<br>
        idd.AddCellField(cell_fields)<br>      for point_fields in simulation_point_fields_needed[input_name]:<br>        idd.AddPointField(point_fields)<br><br>When I do that, it all works. <br><br>Now, I guess my question is this... Where in the exported state script does it say what fields there are in the data? If I do a trace, when I load a file, I get something like:<br>



<br>REST_00207_xmf.CellArrays = [&#39;APD_mass_fraction&#39;, &#39;APD_reaction_rate&#39;, &#39;AP_mass_fraction&#39;, &#39;AP_reaction_rate&#39;, &#39;BND_mass_fraction&#39;, &#39;BND\<br>_reaction_rate&#39;, &#39;Density [kg/m^3]&#39;, &#39;HybridSwitch&#39;, &#39;N2_mass_fraction&#39;, &#39;PRD_mass_fraction&#39;, &#39;PRD_reaction_rate&#39;, &#39;Pressure [Pa]&#39;, &#39;Subgrid\<br>



 kinetic energy [m^2/s^2]&#39;, &#39;Temperature [K]&#39;, &#39;Velocity [m/s]&#39;, &#39;iblanks&#39;]<br><br>and I expected something similar in the exported state script. But I don&#39;t see anything like that. <br><br>



Following the Fortran API, I call the ClearFieldDataFromGrid which may get rid of the fields that Paraview told it the pipeline needs.<br><br>I could be misunderstanding something, I&#39;ve never used VTK before this little project attempt. I can certainly send my adaptor code and python script if it helps clarify. <br>



<br>Thanks again,<br><br>Tim<br><br><hr><div style="font-size:12pt;font-style:normal;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal"><b>From: </b>&quot;Andy Bauer&quot; &lt;<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>&gt;<br>



<b>To: </b>&quot;tim gallagher&quot; &lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;<br><b>Cc: </b>&quot;ParaView list&quot; &lt;<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>&gt;<br>



<b>Sent: </b>Thursday, November 8, 2012 6:20:01 PM<br><b>Subject: </b>Re: [Paraview] CoProcessing needed fields<div><div><br><br>Hi Tim,<br><br>This should get set in the RequestDataDescription method in the generated Python script. When I first did it I thought we&#39;d easily be able to figure out which fields were needed in order to update all of the required pipelines and/or views. Unfortunately this isn&#39;t trivial in VTK so basically what happens is that if a writer or view should output it specifies that all fields should be made available. This is the &quot;datadescription.GetInputDescription(i).AllFieldsOn()&quot; part of the generated python script. <br>




<br>Answering your final question, this is something that is done automatically in the generated script.<br><br>Andy<br><br><div class="gmail_quote">On Wed, Nov 7, 2012 at 2:57 PM, Tim Gallagher <span dir="ltr">&lt;<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I see in the example code for ParaView/CoProcessing/Adaptors/FortranAdaptors/PhastaAdaptor/PhastaAdaptor.cxx calls like:<br>
<br>
  vtkCPInputDataDescription* idd =<br>
    ParaViewCoProcessing::GetCoProcessorData()-&gt;GetInputDescriptionByName(&quot;input&quot;);<br>
<br>
  ...<br>
<br>
  if(idd-&gt;IsFieldNeeded(&quot;velocity&quot;))<br>
  {<br>
  ...<br>
<br>
The only way IsFieldNeeded returns true is if that name field was added with AddCellField or AddPointField.<br>
<br>
Where does that happen? My intuition says that the python or C++ processing script (generated by exporting state) would have those calls in it for the datasets that are actually used. In other words, if I set up my view in the GUI and I load my data and put a Slice through it and color by &quot;Velocity&quot;, I expected the script from Export State to contain a call to AddCellField(&quot;Velocity&quot;). At the very least I expected to see calls to add the fields I chose to load when I loaded my sample file to set up the view.<br>





<br>
So is that something that I need to put in the script on my own after it&#39;s exported or did I miss something? If I have to put it there myself, is RequestDataDescription the correct place to put that?<br>
<br>
Thanks,<br>
<br>
Tim<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br>
</div></div></div><br></div></div></blockquote></div><br>
</div></div></div><br></div></div></blockquote></div><br>
</div></div></div><br></div></div></blockquote></div><br>