<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000'>It is 'input'. I ran for 120 time steps so I got 12 images -- the original export script generated all gray and the modified one generated the correct data. <br><br>I will update the source/rebuild and run your files and let you know. <br><br>Thanks,<br><br>Tim<br><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Andy Bauer" <andy.bauer@kitware.com><br><b>To: </b>"tim gallagher" <tim.gallagher@gatech.edu><br><b>Cc: </b>"ParaView list" <paraview@paraview.org><br><b>Sent: </b>Friday, November 9, 2012 4:21:48 PM<br><b>Subject: </b>Re: [Paraview] CoProcessing needed fields<br><br>I can't tell for sure but what are you using as inputName in ParaViewCoProcessor.cxx? It should be 'input'. 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 "<exe path>/pvbatch waveletdriver.py cpwaveletrender.py 5" 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"><<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><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'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> <set a bunch of pointers to Fortran data arrays><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>"Andy Bauer" <<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>><br><b>To: </b>"tim gallagher" <<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>><br>
<b>Cc: </b>"ParaView list" <<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>><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'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 = {'input': ['1']}<br>
<br>The bug was that the 1 shouldn'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"><<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><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'm doing doesn't use any writers -- I just want the CoProcessor to output images only. So I don't attach a writer, I just export the state and tell it to "Output Rendering Components". My pipeline looks like:<br>
<br>Load file -> CellDataToPointData -> Slice<br><br>This results in a RequestDataDescription:<br><br>def RequestDataDescription(datadescription):<br> "Callback to populate the request for current timestep"<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'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't exist for them to plot. It'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['rest_00000.xmf']: ["Temperature [K]", "Density [kg/m^3]"]}<br>simulation_point_fields_needed = {simulation_input_map['rest_00000.xmf']: []}<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 = ['APD_mass_fraction', 'APD_reaction_rate', 'AP_mass_fraction', 'AP_reaction_rate', 'BND_mass_fraction', 'BND\<br>_reaction_rate', 'Density [kg/m^3]', 'HybridSwitch', 'N2_mass_fraction', 'PRD_mass_fraction', 'PRD_reaction_rate', 'Pressure [Pa]', 'Subgrid\<br>
kinetic energy [m^2/s^2]', 'Temperature [K]', 'Velocity [m/s]', 'iblanks']<br><br>and I expected something similar in the exported state script. But I don'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'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>"Andy Bauer" <<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>><br>
<b>To: </b>"tim gallagher" <<a href="mailto:tim.gallagher@gatech.edu" target="_blank">tim.gallagher@gatech.edu</a>><br><b>Cc: </b>"ParaView list" <<a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a>><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'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'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 "datadescription.GetInputDescription(i).AllFieldsOn()" 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"><<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">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()->GetInputDescriptionByName("input");<br>
<br>
...<br>
<br>
if(idd->IsFieldNeeded("velocity"))<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 "Velocity", I expected the script from Export State to contain a call to AddCellField("Velocity"). 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'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><br></div></body></html>