[vtk-developers] RFC: proposed changes to vtkDataSetAttributes

David E DeMarle dave.demarle at kitware.com
Mon Mar 6 10:13:01 EST 2006


Greetings vtk-developers.

    I am planning to add to the interpretations that VTK can attach to 
vtkDataSet's attribute data. Currently, one can say that a particular 
array in a vtkDataSet's point data is the SCALARS for instance. Once one 
array is named as the SCALARS, the entire VTK pipeline can handle that 
array differently because all filters know to interpret it as the 
important scalar array.

    What I plan to do is add one or more new attribute types to 
vtkDataSetAttributes that have to be interpreted as non-numeric data. 
The first example is a GLOBALID array, which can be created in order to 
uniquely identify each point and cell in a vtkDataSet.  Because the 
contents of the array are unique identifiers, interpolation of the array 
is undefined and should never occur. To support this interpretation of 
the array the Interpolate*, Copy* and PassData  copy method families in 
vtkDataSetAttributes need separate CopyAttributeFlags. For GLOBALID, 
interpolation and copy will be prevented by default, while pass will be 
allowed.

    To make this happen, I propose to:

1) Add a new enumerator:
 enum AttributeCopyOperations
 {
   COPYTUPLE=0,
   INTERPOLATE=1,
   PASSTHROUGH=2,
   ALLCOPY  //all of the above
 };

2) Change the copy flags to guide copying, interpolating, and passing
individually.

int CopyAttributeFlags[NUM_ATTRIBUTES];

becomes

int CopyAttributeFlags[3][NUM_ATTRIBUTES];

3) Change the SetCopyAttribute operations to take a new 
AttributeCopyOperations flag. This lets the filter programmer select a 
copy method family to control or when set to ALLCOPY (the default) it 
will set all three flags together.

4) Change the GetCopyAttribute operations to take the same flag.
This lets the filter programmer select any one of the copy method 
families to inspect, or when set to ALLCOPY (the default) it will return 
true only if all three copy flags are true.

Comments and suggestions are invited,

Dave DeMarle



More information about the vtk-developers mailing list