[Paraview] Multi-Threading issues

liuning tantics at gmail.com
Tue Jun 1 07:16:32 EDT 2010


Hi Biddiscombe,

I do a similar thing. But I use a Qt thread instead of a timer. The thread
controls the entire progress. I define a iteration steps in the thread,
e.g.,1024. In each iteration, the thread triggers the slot accept() method
(in ParaView3/Qt/Components/pqObjectInspectorWidget), in which the pipeline
is forced to update, then the source will call its RequestData() method and
invoke the simulation program to get the data. Maybe it is more appropriate
to let the simulation the control the entire progress, that is, when one
step simulation is done, then it will notify the ParaView to do the
corresponding rendering stuff. I just do it in the reverse way, because it
is easier to implement.

========================

//the added thread class

pqSimulationThread::pqSimulationThread(pqObjectInspectorWidget* _gui){
this->gui=_gui;
connect(this,SIGNAL(oneStepSimulationFinished()),this->gui,SLOT(accept()));
}

pqSimulationThread::~pqSimulationThread(){
}

void pqSimulationThread::run(){

for(int i=0;i<NUM_ITERATION;i++){
emit this->oneStepSimulationFinished();

//for synchronization
mutex.lock();
renderringFinishedCondatin.wait(&mutex);
mutex.unlock();
}
}

=======================

// in the method accept() of pqObjectInspectorWidget

//force the pipeline to update
// i add a property to the source
//and any filters used will need this property too

source->pqProxy::setModifiedState(pqProxy::MODIFIED);
vtkSMSourceProxy * vp  = vtkSMSourceProxy::SafeDownCast(source->getProxy());
vp->InvokeCommand("FakePropertyForUpdate");

=======================

Then do some other little changes it will work with the simulation program.
I hope this can be of some help.

By the way, I hate the added property "FakePropertyForUpdate" , but I do not
know how to remove it . I have tried many other methods to force the
pipeline to update but got nothing good. And I also want to change the logic
to be more natural, that is, let the simulation program to control the whole
progress. I appreciate any help from anybody.

Thanks.

-Ning

On Tue, Jun 1, 2010 at 3:06 AM, Biddiscombe, John A. <biddisco at cscs.ch>wrote:

> Utkarsh
>
> > It is possible that the timer times out in middle of a progress event
> > which happens while filters are executing.
>
>
> OK. This we have detected, though what progress is going on I'm unsure
> about (!) - by which I mean that the only thing paraview should be doing is
> updating our stuff and we block more updates whilst one is happening.
>
> Question : Is there a mutex of any kind on the update vtk objects, or
> update pipeline stuff which we can make use of to ensure that only one pull
> from the server occurs at any given time?
>
> JB
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20100601/0388b22f/attachment.htm>


More information about the ParaView mailing list