Skip to content

VTK 6 #36

@sanguinariojoe

Description

@sanguinariojoe

Latest version of tvtk already supports VTK-6, however small changes should be conveniently implemented in sailfish to extend such feature.

It is working to me with the following patch:

diff --git a/sailfish/io.py b/sailfish/io.py
index 53b8aac..8c838a2 100644
--- a/sailfish/io.py
+++ b/sailfish/io.py
@@ -190,6 +190,7 @@ class VTKOutput(LBOutput):
         self.mask_nonfluid_nodes()
         os.environ['ETS_TOOLKIT'] = 'null'
         from tvtk.api import tvtk
+        from tvtk.common import configure_input
         idata = tvtk.ImageData(spacing=(1, 1, 1), origin=(0, 0, 0))

         first = True
@@ -204,7 +205,7 @@ class VTKOutput(LBOutput):
                 t = idata.point_data.add_array(field.flatten())
                 idata.point_data.get_array(t).name = name

-        idata.update()
+        idata.update_traits()
         dim = len(sample_field.shape)

         for name, field in self._vector_fields.iteritems():
@@ -223,7 +224,8 @@ class VTKOutput(LBOutput):
             idata.dimensions = list(reversed(sample_field.shape)) + [1]

         fname = filename(self.basename, self.digits, self.subdomain_id, i, suffix='.vti')
-        w = tvtk.XMLImageDataWriter(input=idata, file_name=fname)
+        w = tvtk.XMLImageDataWriter(file_name=fname)
+        configure_input(w, idata)
         w.write()

     # TODO: Implement this function.

Unfortunately I don't know if it would be incompatible with older versions of tvtk

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions