/usr/lib/python2.7/dist-packages/pyvtk/DataSet.py is in python-pyvtk 0.4.74-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/usr/bin/env python
"""
DataSet
"""
"""
Copyright 2001 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the LGPL. See http://www.fsf.org
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
$Revision: 1.3 $
$Date: 2001-05-31 17:48:54 $
Pearu Peterson
"""
__version__ = "$Id: DataSet.py,v 1.3 2001-05-31 17:48:54 pearu Exp $"
import common
class DataSet(common.Common):
"""Abstract class.
It describes the geometry and topology of VTK dataset.
"""
def get_size(self):
if hasattr(self,'points'):
return len(self.points)
return reduce(lambda x,y:x*y,self.dimensions,1)
def get_cell_size(self):
return 0
def _check_dimensions(self):
for i in range(3):
d = self.dimensions[i]
if not common.is_int(d):
self.error('dimensions[%s] must be int but got %s'%(i,type(d)))
return 1
if d<=0:
self.error('dimensions[%s] must be positive int but got %s'%(i,d))
return 1
if hasattr(self,'points'):
d = reduce(lambda x,y:x*y,self.dimensions,1)
if len(self.points)!=d:
self.error('mismatch of points length (%s) and dimensions size (%s)'%(len(self.points),d))
return 1
return 0
def _check_origin(self):
for i in range(3):
d = self.origin[i]
if not common.is_number(d):
self.error('origin[%s] must be number but got %s'%(i,type(d)))
return 1
return 0
def _check_spacing(self):
for i in range(3):
d = self.spacing[i]
if not common.is_number(d):
self.error('spacing[%s] must be number but got %s'%(i,type(d)))
return 1
if d<=0:
self.error('spacing[%s] must be positive number but got %s'%(i,d))
return 1
return 0
def _check_int_seq(self,obj,mx_int):
if common.is_sequence(obj):
for o in obj:
if self._check_int_seq(o,mx_int):
return 1
elif not common.is_int(obj) or obj>=mx_int:
return 1
return 0
def Scalars(self,func,name = None,lookup_table = None):
return Scalars.Scalars([func(*p) for p in self.get_points()],name,lookup_table)
def ColorScalars(self,func,name = None):
return ColorScalars.ColorScalars([func(*p) for p in self.get_points()],name)
def LookupTable(self,func,name = None):
return LookupTable.LookupTable([func(*p) for p in self.get_points()],name)
def Vectors(self,func,name = None):
return Vectors.Vectors([func(*p) for p in self.get_points()],name)
def Normals(self,func,name = None):
return Normals.Normals([func(*p) for p in self.get_points()],name)
def TextureCoordinates(self,func,name = None):
return TextureCoordinates.TextureCoordinates([func(*p) for p in self.get_points()],name)
def Tensors(self,func,name = None):
return Tensors.Tensors([func(*p) for p in self.get_points()],name)
def Field(self,func,name = None, **kws):
return Field.Field([func(*p) for p in self.get_points()],name, **kws)
import Scalars
import ColorScalars
import LookupTable
import Vectors
import Normals
import TextureCoordinates
import Tensors
import Field
|