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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2365 - (show annotations)
Mon Apr 6 01:25:25 2009 UTC (10 years, 4 months ago) by gross
File MIME type: text/x-python
File size: 2815 byte(s)
all tests passed under scons on 4 mpi processes with  openmpi on shake34
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="https://launchpad.net/escript-finley"
21
22 """
23 @var __author__: name of author
24 @var __copyright__: copyrights
25 @var __license__: licence agreement
26 @var __url__: url entry point on documentation
27 @var __version__: version
28 @var __date__: date of the version
29 """
30
31 __author__="John Ngui, john.ngui@uq.edu.au"
32
33 from esys.escript import getMPISizeWorld
34 if getMPISizeWorld()==1: import vtk
35
36 class Tube:
37 """
38 Class that defines the tube wrapped around the streamlines.
39 """
40
41 def __init__(self):
42 """
43 Initialise the tube.
44 """
45 if getMPISizeWorld()>1:
46 raise ValueError,"pyvisi.Tube is not running on more than one processor."
47 self.__vtk_tube = vtk.vtkTubeFilter()
48
49 def _setupTube(self, object):
50 """
51 Setup the tube.
52
53 @type object: vtkPolyData, etc
54 @param object: Input for the tube
55 """
56
57 self.__object = object
58
59 self.__setInput()
60 # Default radius of the tube is 0.02.
61 self.setTubeRadius(0.02)
62 # Default number of sides for the tube is 12.
63 self.setTubeNumberOfSides(12)
64 self.setTubeRadiusToVaryByVector()
65
66 def __setInput(self):
67 """
68 Set the input for the tube.
69 """
70
71 self.__vtk_tube.SetInput(self.__object)
72
73 def setTubeRadius(self, radius):
74 """
75 Set the radius of the tube.
76
77 @type radius: Number
78 @param radius: Radius of the tube
79 """
80
81 self.__vtk_tube.SetRadius(radius)
82
83 def setTubeNumberOfSides(self, sides):
84 """
85 Set the number of sides for the tube. Minimum number of sides is 3.
86 The larger the number of sides, the higher the quality.
87
88 @type sides: Number
89 @param sides: Number of sides for the tube
90 """
91
92 self.__vtk_tube.SetNumberOfSides(sides)
93
94 def setTubeRadiusToVaryByVector(self):
95 """
96 Set the radius to vary by vector data.
97 """
98
99 self.__vtk_tube.SetVaryRadiusToVaryRadiusByVector()
100
101 def setTubeRadiusToVaryByScalar(self):
102 """
103 Set the radius to vary by scalar data.
104 """
105
106 self.__vtk_tube.SetVaryRadiusToVaryRadiusByScalar()
107
108 def _getTubeOutput(self):
109 """
110 Return the output of the tube.
111
112 @rtype: vtkPolyData
113 @return: Polygonal data
114 """
115
116 return self.__vtk_tube.GetOutput()

  ViewVC Help
Powered by ViewVC 1.1.26