[Paraview] Xdmf GlobalID attribute removed by Clip

Eric E. Monson emonson at cs.duke.edu
Tue Apr 27 11:25:17 EDT 2010


Hey Dave,

Unfortunately, that didn't fix it. There's something else strange going on. 

The Clip filter seems to lose both the (point data) array that's set as the Global IDs (whether int, long or idtype), plus any array that is "idtype". You can see the latter behavior by doing Generate IDs filter on a Point Source, and a Clip will lose the (point) Ids array (even though Generate IDs doesn't set the array it generates as the Global IDs for the point or cell data). 

I've tested this out a few different ways, and this seems to be the pattern -- the Clip doesn't seem to lose any plain (i.e. non-global-id) int or long point attributes, it will lose any Global ID array (int, long or idtype), and it loses all idtype arrays. I haven't tried much with Cell Data (although the Clip doesn't lose the idtype cell data attribute generated by Generate IDs).

Here are the changes I made just so you can check that I didn't make a silly mistake in trying out your fix:

diff --git a/Graphics/vtkTableBasedClipDataSet.cxx b/Graphics/vtkTableBasedClipDataSet.cxx
index 392b1b4..2ea36b4 100644
--- a/Graphics/vtkTableBasedClipDataSet.cxx
+++ b/Graphics/vtkTableBasedClipDataSet.cxx
@@ -1283,6 +1283,7 @@ void vtkTableBasedClipperVolumeFromVolume::
   int centroidStart  = numUsed + pt_list.GetTotalNumberOfPoints();
   int nOutPts        = centroidStart + centroid_list.GetTotalNumberOfPoints();
   outPts->SetNumberOfPoints( nOutPts );
+  outPD->SetCopyGlobalIds(1,vtkDataSetAttributes::COPYTUPLE);
   outPD->CopyAllocate( inPD, nOutPts );
   
   if ( origNodes != NULL )
@@ -1479,6 +1480,7 @@ void vtkTableBasedClipperVolumeFromVolume::
     conn_size += ( shapes[i]->GetShapeSize() + 1 ) * ns;
     }
 
+  outCD->SetCopyGlobalIds(1,vtkDataSetAttributes::COPYTUPLE);
   outCD->CopyAllocate( inCD, ncells );
 
   vtkIdTypeArray * nlist = vtkIdTypeArray::New();
@@ -2366,6 +2368,8 @@ void vtkTableBasedClipDataSet::ClipPolyData( vtkDataSet * inputGrd,
       if ( numCants == 0 )
         {
         specials->GetCellData()
+                ->SetCopyGlobalIds(1,vtkDataSetAttributes::COPYTUPLE);
+        specials->GetCellData()
                 ->CopyAllocate( polyData->GetCellData(), numCells );
         }
 

I haven't tried this in pure VTK, but I can do that if you'd like (in the next day or two). If a quick fix isn't obvious to you based on these observations, you can let me know whether you think this should go in as a VTK or ParaView bug.

Thanks again,
-Eric


On Apr 23, 2010, at 4:11 PM, David E DeMarle wrote:

> The XDMF in 3.6 did not have the global id attribute so it did the
> unsafe thing and let filters have their way with them. It kept the
> array around, but in most cases the values in the array at the end of
> the pipeline were worthless.
> 
> Not that XDMF does have global ids, the clip filter (like most of the
> other filters) is doing the safe thing and not keeping the globalids.
> 
> Off the top of my head, I can not think of a reason really why the
> clip filter shouldn't be allowed to copy the globalids across though.
> 
> Erik, try this and see if it works for you:
> 
> in vtkTableBasedClipDataSet, look for the three places where it calls
> CopyAllocate.
> For example:
>   outPD->CopyAllocate(inPD, nOutPts);
> 
> Insert a line before each one of those that tells VTK that it is OK
> top copy this array across.
> In that case:
>   outPD->SetCopyGlobalIds(1,vtkDataSetAttributes::COPYTUPLE);
> 
> The globalIDS will then make it through this filter.
> 
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x109
> 
> 
> 
> On Mon, Apr 19, 2010 at 1:48 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
>> Hello,
>> 
>> It seems that we're sort of getting the worst of both worlds right now ParaView and Xdmf GlobalID AttributeType: Besides not being read in as "idtype", a Clip filter removes the GlobalID attribute from the data set.
>> 
>> Attached is a simple XML example adapted from the Xdmf source data sets, but with a duplicate scalar point attribute labeled as AttributeType="GlobalID". Load it into PV and apply a Clip filter and you'll see the IDvalues array disappear.
>> 
>> I see this behavior with PV 3.8-RC1 and last week's CVS, but not with 3.6.2. I can't remember if the Xdmf reader in 3.6.2 had GlobalID type or not. (OS X 10.6.3)
>> 
>> I can file a bug report for this if someone can replicate it.
>> 
>> Thanks a lot,
>> -Eric
>> 
>> ------------------------------------------------------
>> Eric E Monson
>> Duke Visualization Technology Group
>> 
>> 
>> _______________________________________________
>> 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
>> 
>> 



More information about the ParaView mailing list