/[escript]/trunk/pyvisi/py_src/tube.py
ViewVC logotype

Annotation of /trunk/pyvisi/py_src/tube.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1158 - (hide annotations)
Tue May 22 04:24:01 2007 UTC (12 years, 6 months ago) by jongui
File MIME type: text/x-python
File size: 1603 byte(s)
Made some changes to fix the memory leak problem. However, the problem still persists for run_escript_with_lazy_evaluation.py, run_streamline.py and run_streamline_with_lazy_evaluation.py.

1 ksteube 1147 """
2     @author: John NGUI
3     """
4    
5     import vtk
6    
7     class Tube:
8     """
9     Class that defines the tube wrapped around the streamlines.
10     """
11    
12 jongui 1148 def __init__(self):
13 ksteube 1147 """
14     Initialise the tube.
15     """
16    
17     self.__vtk_tube = vtk.vtkTubeFilter()
18    
19 jongui 1148 def _setupTube(self, object):
20 ksteube 1147 """
21     Setup the tube.
22     """
23    
24 jongui 1158 self.__setInput(object)
25 ksteube 1147 # Default radius of the tube is 0.02.
26     self.setTubeRadius(0.02)
27     # Default number of sides for the tube is 12.
28     self.setTubeNumberOfSides(12)
29     self.setTubeRadiusToVaryByVector()
30    
31 jongui 1158 def __setInput(self, object):
32 ksteube 1147 """
33     Set the input for the tube.
34 jongui 1158
35     @type object: vtkPolyData, etc
36     @param object: Input for the tube
37 ksteube 1147 """
38    
39 jongui 1158 self.__vtk_tube.SetInput(object)
40 ksteube 1147
41     def setTubeRadius(self, radius):
42     """
43     Set the radius of the tube.
44    
45     @type radius: Number
46     @param radius: Radius of the tube
47     """
48    
49     self.__vtk_tube.SetRadius(radius)
50    
51     def setTubeNumberOfSides(self, sides):
52     """
53     Set the number of sides for the tube. Minimum number of sides is 3.
54     The larger the number of sides, the higher the quality.
55    
56     @type sides: Number
57     @param sides: Number of sides for the tube
58     """
59    
60     self.__vtk_tube.SetNumberOfSides(sides)
61    
62     def setTubeRadiusToVaryByVector(self):
63     """
64     Set the radius to vary by vector data.
65     """
66    
67     self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
68    
69     def setTubeRadiusToVaryByScalar(self):
70     """
71     Set the radius to vary by scalar data.
72     """
73    
74     self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
75    
76 jongui 1148 def _getTubeOutput(self):
77 ksteube 1147 """
78     Return the output of the tube.
79    
80     @rtype: vtkPolyData
81     @return: Polygonal data
82     """
83    
84     return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26