[vtkusers] Deep copy of vtk Object vtkModifiedBSPTree

Biddiscombe, John A. biddisco at cscs.ch
Thu Dec 3 18:19:44 EST 2015


I was trying to say that on the first call to intersect, if the tree has
not been built, it will be built - and the build routine is not thread
safe for sure. So call ForceBuild first, or make sure that the first call
to intersect only happens on one thread.
I’m not saying the intersect routine is thread safe, but at least
eliminate the obvious cases first.

JB

On 03/12/15 23:54, "Normand Robert" <normand.robert at sri.utoronto.ca> wrote:

>Hi John
>
>Thank you for your reply. Please let me make sure I understand your
>statement by asking a question: Are you saying that only the first call to
>bspTree->IntersectWithLine(P1, P2, tolerance, points, cellIds); should
>be protected because some allocations or other housekeeping occurs and
>that subsequently many threads can call IntersectWithLine() at the same
>time?
>
>Regards
>
>N.
>
>
>On 15-12-03 02:54 AM, Biddiscombe, John A. wrote:
>> Making copies of the tree is a very bad idea as the locator stores a
>>lot of extra info for accelerating ray-traces.
>>
>> If you could send a stack trace of where you are getting errors I might
>>be able to suggest something. I had a quick look over the intersection
>>code (which I wrote originally back in 1997 or thereabouts - so I'm a
>>bit rusty with it) but I do not see any obvious misuses of vars. The
>>initial build tree is not thread safe, so you should ensure that two
>>threads are not calling the first ray intersection simultaneously if
>>buildtree has not already been called.
>>
>> JB
>>
>> -----Original Message-----
>> From: vtkusers [mailto:vtkusers-bounces at vtk.org] On Behalf Of Normand
>>Robert
>> Sent: 01 December 2015 04:07
>> To: vtkusers at vtk.org
>> Subject: [vtkusers] Deep copy of vtk Object vtkModifiedBSPTree
>>
>> Hi
>>
>> I wish to use vtkModifiedBSPTree with OpenMP by making copies of
>>vtkModifiedBSPTree instances local to each thread but there does not
>>seem to be any methods to copy this object. I naively thought that all
>>vtk objects would have ShallowCopy() or DeepCopy(). I have to do this
>>because using IntersectWithLine() in different threads for the same
>>object instance causes crashes. Is there a solution to this?
>>
>> Regards
>> Normand Robert PhD
>> Sunnybrook Research Institute
>> University of Toronto
>>
>> _______________________________________________
>> 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 VTK FAQ at:
>>http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>-- 
>Normand Robert PhD
>Sunnybrook Health Sciences Centre
>Room S632, 2075 Bayview Avenue, Toronto, ON M4N 3M5
>



More information about the vtkusers mailing list