[vtkusers] Multithreading and VTK
Ben Harris
pben at arlut.utexas.edu
Thu Sep 11 14:12:56 EDT 2003
Thank you for the guidance! Then I gather that in order to pull this off
as I described, then I would have to derive at least two threadsafe
classes: one for the RenderWindowInteractor class, and one for the
simulation. These represent the two ends of the pipeline.
If it's not too much of an imposition--what would you do in my
situation? Perhaps you have a better idea. Is there a built-in framework
within vtk that I have overlooked, that better handles this problem?
Because I seek event-driven user control of the camera, and independent
updates to the data by a simulation, I can't see any way around the
threading issue. Perhaps another process could derive the simulation
data, but still that data would have received and processed by end
application. That end application would still have to coordinate data
updates with events (update requests) received by the UI.
Thanks,
Ben Harris
Berk Geveci wrote:
> Although this is not what I would do in your situation, it is
> possible. There are a few things to be aware of:
> 1. If you are visualizing the output of the simulation in the
> VTK thread, you have to make sure that VTK does not access
> the data while the simulation is writing it
> 2. Never, ever, ever render from two threads
> 3. Two threads can not share VTK filters or any other pipeline
> objects
> 4. Two threads can have independent pipelines, working
> on independent data
> 5. If two threads share data, you are responsible of creating
> the necessary mutexes to avoid access violations
>
> -Berk
>
> On Thu, 2003-09-11 at 10:37, Ben Harris wrote:
>
>>Hello all,
>>
>>After referring to the books, and online documentation, and searching
>>the vtkusers list, I am still stumped.
>>
>>Is it possible for a RenderWindowInteractor to process events and
>>control the camera on one thread, while on another thread a simulation
>>is running? At the heart of this question, I believe, is the level of
>>thread-safety associated with the visualization pipeline.
>>
>>Here is my application: I am writing an N-body simulation--a numerical
>>simulation of celestial bodies which move due to gravitational
>>interaction. I would like to run the simulation while allowing the user
>>to pan and zoom the camera.
>>
>>Thanks in advance,
>>Ben Harris
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
--
R. BENJAMIN HARRIS Space & Geophysics Laboratory
pben at arlut.utexas.edu Applied Research Laboratories
(512) 835-3116 The University of Texas at Austin
Fax: (512) 835-3544 http://www.arlut.utexas.edu/
More information about the vtkusers
mailing list