[vtkusers] FW: Deep copy of vtk Object vtkModifiedBSPTree

Biddiscombe, John A. biddisco at cscs.ch
Fri Dec 4 04:14:07 EST 2015


cc'ing list for future reference

> -----Original Message-----
> From: Biddiscombe, John A.
> Sent: 04 December 2015 10:13
> To: 'Normand Robert'
> Subject: RE: [vtkusers] Deep copy of vtk Object vtkModifiedBSPTree
> 
> Robert
> 
> #0  0x00007ffff500f7cf in vtkPoints::SetData(vtkDataArray*) () from
> /usr/lib/x86_64-linux-gnu/libvtkCommonCore-6.0.so.6.0
> #1  0x00007ffff5400f1a in vtkGenericCell::SetCellType(int) () from
> /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-6.0.so.6.0
> #2  0x00007ffff54ce1a5 in vtkPolyData::GetCell(long long,
> vtkGenericCell*) () from
> /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-6.0.so.6.0
> #3  0x00007ffff774539f in vtkModifiedBSPTree::IntersectCellInternal(long
> long, double const*, double const*, double, double&, double*, double*,
> int&) ()
>     from /usr/lib/x86_64-linux-gnu/libvtkFiltersFlowPaths-6.0.so.6.0
> #4  0x00007ffff7749502 in vtkModifiedBSPTree::IntersectWithLine(double
> const*, double const*, double, vtkPoints*, vtkIdList*) ()
>     from /usr/lib/x86_64-linux-gnu/libvtkFiltersFlowPaths-6.0.so.6.0
> 
> 
> Intersect with line calls GetCell, which states
>   // Description:
>   // Get cell with cellId such that: 0 <= cellId < NumberOfCells.
>   // This is a thread-safe alternative to the previous GetCell()
>   // method.
>   // THIS METHOD IS THREAD SAFE IF FIRST CALLED FROM A SINGLE THREAD
> AND
>   // THE DATASET IS NOT MODIFIED
>   virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
> 
> and this in turn calls vtkPolyData::GetCell, which then calls
>   if ( !this->Cells )
>     {
>     this->BuildCells();
>     }
> 
> which is certainly not thread safe, so make sure you call BuildCells on your input
> dataset before doing any intersection tests. (and you might just call mydata-
> >GetCell(0,a dummy generic cell) before the threaded part to ensure that
> initialization takes place for the main code path).
> 
> Unfortunately, there are a many gotchas like this deep in the internals of vtk, so
> I suggest you step through with a debugger and look at each call to see if there's
> likely to be a race. I'm going away for almost a  week so I won't be able to
> respond very quickly after this ...
> 
> JB


More information about the vtkusers mailing list