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: write_frequencies = {'input': ['1']}
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? Andy On Thu, Nov 8, 2012 at 6:41 PM, Tim Gallagher <tim.gallag...@gatech.edu>wrote: > Andy, > > Thanks for the answer. > > 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: > > Load file -> CellDataToPointData -> Slice > > This results in a RequestDataDescription: > > def RequestDataDescription(datadescription): > "Callback to populate the request for current timestep" > if datadescription.GetForceOutput() == True: > for i in range(datadescription.GetNumberOfInputDescriptions()): > datadescription.GetInputDescription(i).AllFieldsOn() > datadescription.GetInputDescription(i).GenerateMeshOn() > return > > for input_name in simulation_input_map.values(): > LoadRequestedData(datadescription, input_name) > > 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. > > 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. > > I got it to work by making a new variable just under simulation_input_map: > > simulation_cell_fields_needed = {simulation_input_map['rest_00000.xmf']: > ["Temperature [K]", "Density [kg/m^3]"]} > simulation_point_fields_needed = {simulation_input_map['rest_00000.xmf']: > []} > > and putting in RequestDataDescription before the loop that calls > LoadRequestedData: > > for input_name in simulation_input_map.values(): > idd = datadescription.GetInputDescriptionByName(input_name) > for cell_fields in simulation_cell_fields_needed[input_name]: > idd.AddCellField(cell_fields) > for point_fields in simulation_point_fields_needed[input_name]: > idd.AddPointField(point_fields) > > When I do that, it all works. > > 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: > > REST_00207_xmf.CellArrays = ['APD_mass_fraction', 'APD_reaction_rate', > 'AP_mass_fraction', 'AP_reaction_rate', 'BND_mass_fraction', 'BND\ > _reaction_rate', 'Density [kg/m^3]', 'HybridSwitch', 'N2_mass_fraction', > 'PRD_mass_fraction', 'PRD_reaction_rate', 'Pressure [Pa]', 'Subgrid\ > kinetic energy [m^2/s^2]', 'Temperature [K]', 'Velocity [m/s]', 'iblanks'] > > and I expected something similar in the exported state script. But I don't > see anything like that. > > Following the Fortran API, I call the ClearFieldDataFromGrid which may get > rid of the fields that Paraview told it the pipeline needs. > > 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. > > Thanks again, > > Tim > > ------------------------------ > *From: *"Andy Bauer" <andy.ba...@kitware.com> > *To: *"tim gallagher" <tim.gallag...@gatech.edu> > *Cc: *"ParaView list" <paraview@paraview.org> > *Sent: *Thursday, November 8, 2012 6:20:01 PM > *Subject: *Re: [Paraview] CoProcessing needed fields > > > Hi Tim, > > 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. > > Answering your final question, this is something that is done > automatically in the generated script. > > Andy > > On Wed, Nov 7, 2012 at 2:57 PM, Tim Gallagher <tim.gallag...@gatech.edu>wrote: > >> Hi, >> >> I see in the example code for >> ParaView/CoProcessing/Adaptors/FortranAdaptors/PhastaAdaptor/PhastaAdaptor.cxx >> calls like: >> >> vtkCPInputDataDescription* idd = >> >> ParaViewCoProcessing::GetCoProcessorData()->GetInputDescriptionByName("input"); >> >> ... >> >> if(idd->IsFieldNeeded("velocity")) >> { >> ... >> >> The only way IsFieldNeeded returns true is if that name field was added >> with AddCellField or AddPointField. >> >> 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. >> >> 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? >> >> Thanks, >> >> Tim >> _______________________________________________ >> 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 >> >> Follow this link to subscribe/unsubscribe: >> http://www.paraview.org/mailman/listinfo/paraview >> > > >
_______________________________________________ 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 Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview