[vtk-developers] Started on VTK 4 compatibility removal

Berk Geveci berk.geveci at kitware.com
Mon May 16 16:47:43 EDT 2011


Yes there is a better way. It is <no op>. After my changes, the output
will not have a dependency on its source hence no need to decouple
them. So the following will work fine:

vtkDataSet* o = some_filter->GetOutput();
o->Register(NULL);
some_filter->Delete();


On Mon, May 16, 2011 at 3:22 PM, tom fogal <tfogal at sci.utah.edu> wrote:
> Another one (sorry to bombard you).
>
> We've been using the idiom:
>
>  vtkDataSet* o = some_filter->GetOutput();
>  o->Register(NULL);
>  o->SetSource(NULL);
>  some_filter->Delete();
>
> to decouple the output of a pipeline from the pipeline itself, allowing us
> to clean up the pipeline whilst keeping the output around for a bit.  See:
>
>
> http://visitusers.org/index.php?title=Memory_Management#How_to_manage_memory_for_a_VTK_object
>
> "SetSource" no longer exists in the update.  I've always wondered if there
> was a better way to accomplish the above goal anyway, the
> register/source-null trick seems a bit hackish.
>
> What should we replace such code with?
>
> -tom
>
> On 05/04/2011 02:23 PM, Berk Geveci wrote:
>>
>> Hi folks,
>>
>> For those that are interested, I started working on removing the VTK 4
>> backwards compatibility layer as described here:
>>
>> http://www.vtk.org/Wiki/VTK/Remove_VTK_4_Compatibility
>>
>> I am going to regularly send updates to mailing list so that folks can
>> try out these changes and see if they break their own code. For now, I
>> am publishing a branch called remove-vtk-4-compatibility to
>> https://gitorious.org/~berkgeveci/kitware/berkgevecis-vtk. In the near
>> future, there will be a branch in the VTK stage as well.
>>
>> My changes so far:
>>
>> - I removed vtkProcessObject and all of its subclasses (including
>> vtkSource). A list of files I removed is at the bottom. If you have a
>> subclass of any of these, you have to change it to subclass from
>> vtkAlgorithm or one of its subclasses.
>>
>> - I removed vtkPLOT3DReader. This reader created one output per block
>> in the file. VTK no longer supports variable number of outputs. Such
>> readers/filters should be converted to produce multi-block datasets.
>> The replacement for this filter is vtkMultiBlockPLOT3DReader. In the
>> future, I will probably rename it to be vtkPLOT3DReader.
>>
>> - I changed vtkSpatialRepresentationFilter to produce a multi-block
>> dataset for the same reason as with vtkPLOT3DReader. I also had to
>> change the API as which output the filter produced was dependent on
>> the GetOutput() method which I had to remove. See the header file for
>> details.
>>
>> - I removed vtkPOPReader. This is a clean-up. This class never passed
>> development stage and the POP flavor it loaded was in-house to
>> Kitware.
>>
>> I am currently working on changes that are likely to have an impact on
>> some of the never code. I am removing the dependency of vtkDataObject
>> on the pipeline. This means that any code that did something like:
>>
>> output->SetWholeExtent(...);
>>
>> or
>>
>> output->GetWholeExtent(...);
>>
>> will break. More on this next time.
>>
>> Please feel free to ask questions.
>>
>> Best,
>> -berk
>>
>>
>> vtkProcessObject and subclasses removed:
>>  Filtering/vtkDataObjectSource.cxx Filtering/vtkDataObjectSource.h
>>  Filtering/vtkDataSetSource.cxx Filtering/vtkDataSetSource.h
>>  Filtering/vtkDataSetToDataSetFilter.cxx
>>  Filtering/vtkDataSetToDataSetFilter.h
>>  Filtering/vtkDataSetToImageFilter.cxx
>>  Filtering/vtkDataSetToImageFilter.h
>>  Filtering/vtkDataSetToPolyDataFilter.cxx
>>  Filtering/vtkDataSetToPolyDataFilter.h
>>  Filtering/vtkDataSetToStructuredGridFilter.cxx
>>  Filtering/vtkDataSetToStructuredGridFilter.h
>>  Filtering/vtkDataSetToStructuredPointsFilter.cxx
>>  Filtering/vtkDataSetToStructuredPointsFilter.h
>>  Filtering/vtkDataSetToUnstructuredGridFilter.cxx
>>  Filtering/vtkDataSetToUnstructuredGridFilter.h
>>  Filtering/vtkImageMultipleInputFilter.cxx
>>  Filtering/vtkImageMultipleInputFilter.h
>>  Filtering/vtkImageMultipleInputOutputFilter.cxx
>>  Filtering/vtkImageMultipleInputOutputFilter.h
>>  Filtering/vtkImageSource.cxx Filtering/vtkImageSource.h
>>  Filtering/vtkImageToImageFilter.cxx Filtering/vtkImageToImageFilter.h
>>  Filtering/vtkImageTwoInputFilter.cxx
>>  Filtering/vtkImageTwoInputFilter.h Filtering/vtkPointSetSource.cxx
>>  Filtering/vtkPointSetSource.h
>>  Filtering/vtkPointSetToPointSetFilter.cxx
>>  Filtering/vtkPointSetToPointSetFilter.h
>>  Filtering/vtkPolyDataSource.cxx Filtering/vtkPolyDataSource.h
>>  Filtering/vtkPolyDataToPolyDataFilter.cxx
>>  Filtering/vtkPolyDataToPolyDataFilter.h
>>  Filtering/vtkProcessObject.cxx Filtering/vtkProcessObject.h
>>  Filtering/vtkRectilinearGridSource.cxx
>>  Filtering/vtkRectilinearGridSource.h
>>  Filtering/vtkRectilinearGridToPolyDataFilter.cxx
>>  Filtering/vtkRectilinearGridToPolyDataFilter.h
>>  Filtering/vtkSource.cxx Filtering/vtkSource.h
>>  Filtering/vtkStructuredGridSource.cxx
>>  Filtering/vtkStructuredGridSource.h
>>  Filtering/vtkStructuredGridToPolyDataFilter.cxx
>>  Filtering/vtkStructuredGridToPolyDataFilter.h
>>  Filtering/vtkStructuredGridToStructuredGridFilter.cxx
>>  Filtering/vtkStructuredGridToStructuredGridFilter.h
>>  Filtering/vtkStructuredPointsSource.cxx
>>  Filtering/vtkStructuredPointsSource.h
>>  Filtering/vtkStructuredPointsToPolyDataFilter.cxx
>>  Filtering/vtkStructuredPointsToPolyDataFilter.h
>>  Filtering/vtkStructuredPointsToStructuredPointsFilter.cxx
>>  Filtering/vtkStructuredPointsToStructuredPointsFilter.h
>>  Filtering/vtkStructuredPointsToUnstructuredGridFilter.cxx
>>  Filtering//vtkStructuredPointsToUnstructuredGridFilter.h
>>  Filtering/vtkUnstructuredGridSource.cxx
>>  Filtering/vtkUnstructuredGridSource.h
>>  Filtering/vtkUnstructuredGridToPolyDataFilter.cxx
>>  Filtering/vtkUnstructuredGridToPolyDataFilter.h
>>  Filtering/vtkUnstructuredGridToUnstructuredGridFilter.h
>>  Filtering/vtkUnstructuredGridToUnstructuredGridFilter.cxx
>>  Imaging/vtkImageSpatialFilter.cxx Imaging/vtkImageSpatialFilter.h
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>
>



More information about the vtk-developers mailing list