Package: python-pyvtk
Version: 0.4.66-6
Severity: Important
Tags: patch

Hi Steve,
  I am having problems writing CellData to vtk file using pyvtk.VtkData. If
I pass in StructuredGrid
Data and Scalars to pyvtk.VtkData I get this error:

File "/usr/lib/python2.4/site-packages/pyvtk/__init__.py", line 165, in
__init__
   raise ValueError,'DataSet (cell_size=%s) and CellData (size=%s) have
different sizes'%(s,s1)
ValueError: DataSet (cell_size=0) and CellData (size=8) have different sizes

The error seems to be in the /lib/__init__.py file:
Line 162:
s = self.structure.get_cell_size()

But if you see the definition of get_cell_size function in DataSet.py it
just returns zero irrespective
of the object size.

Line 130 DataSet.py
---snipp--
def
get_cell_size(self):

       return 0
--snapp--

I changed the line 162 in __init__.py to use get_size() instead of
get_cell_size() and it works.

Could you please check what is wrong. Please correct me if I am wrong.
I am attaching the patch.

Regards
Varun



--
Varun Hiremath
Undergraduate Student,
Aerospace Engg. Department,
Indian Institute of Technology Madras,
Chennai, India
--------------------------------------------------
Homepage : http://varun.travisbsd.org
diff -urN PyVTK-0.4.66.orig/lib/__init__.py PyVTK-0.4.66/lib/__init__.py
--- PyVTK-0.4.66.orig/lib/__init__.py	2006-11-30 21:54:32.000000000 +0530
+++ PyVTK-0.4.66/lib/__init__.py	2006-11-30 21:55:11.000000000 +0530
@@ -159,7 +159,7 @@
         else:
             self.point_data = PointData()
         if self.cell_data is not None:
-            s = self.structure.get_cell_size()
+            s = self.structure.get_size()
             s1 = self.cell_data.get_size()
             if s1 != s:
                 raise ValueError,'DataSet (cell_size=%s) and CellData (size=%s) have different sizes'%(s,s1)

Reply via email to