[vtkusers] vtk+wxWindows+Diffpack: Rendering at each step of a simulation.

stefano mininel mininel.ml at gnbts.univ.trieste.it
Tue Dec 4 09:26:58 EST 2001


Trying to create a framework for partial differences equations solution
(Diffpack libraries) with wxWindows (for portability) and vtk
(visualization of results) with VC++ on Win2000.
First example: 2D wave equation solution.
In the MyApp::OnInit() I call myFrame->InitialConfiguration() in which I
create initial conditions in an array u[nx,ny], copy data in a
vtkStructuredGrid and visualize them in a wxVTKWindow linked to a panel
in myFrame. Everything OK.
Then, after adjusting camera for best visualization, a menu event may
call myFrame->OnSimulation(), that has a cycle:

while (t <= tstop) {
  t +=dt;
  ... //calculating with wave equation situation in next temporal step
and replacin values in array u[] ...
  ... //recalculating points and scalars values from u[] ...
  ... //re-assigning to the vtkStructuredGrid object with:
grid->SetPoints(points);
grid->GetPointData()->SetScalars(scalars);
...
... //TRYING (in vain) to visualize situation after each step of the
simulation with:
gridMapper->SetInput(grid);
gridMapper->Update();
gridActor->SetMapper(gridMapper);
gridActor->Update(); //no need to say what kind of objects they are!
 pRenderer->Render();
} //end time-while

The visualization remains in the initial state and I'm no able to obtain
rendering of the subsequent steps. Did I forget something apparently
trivial but important? Or is it a more complicated matter and I need,
for example, to send a message to the main frame to force its update or
.... what??? Please, ANY help will be greatly appreciated!

    Stefano Mininel




More information about the vtkusers mailing list