Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTK 6 #36

Open
sanguinariojoe opened this issue Apr 7, 2016 · 0 comments
Open

VTK 6 #36

sanguinariojoe opened this issue Apr 7, 2016 · 0 comments

Comments

@sanguinariojoe
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant