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

Contents of /trunk/pyvisi/py_src/rotation.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: 2565 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
34 from esys.escript import getMPISizeWorld
35 if getMPISizeWorld()==1: import vtk
36
37 class Rotation:
38 """
39 Class that sweeps 2D data around the z-axis to create a 3D looking effect.
40 """
41
42 def __init__(self):
43 """
44 Initialise the rotation.
45 """
46 if getMPISizeWorld()>1:
47 raise ValueError,"pyvisi.Rotation is not running on more than one processor."
48 self.__vtk_rotational_extrusion_filter = \
49 vtk.vtkRotationalExtrusionFilter()
50
51 def _setupRotationExtrusionFilter(self, object):
52 """
53 Setup the rotation.
54
55 @type object: vtkUnstructuredGrid, etc
56 @param object: Input for the clipper
57 """
58
59 self.__object = object
60 self.__setInput()
61
62 def __setInput(self):
63 """
64 Set the input for the rotation.
65 """
66
67 self.__vtk_rotational_extrusion_filter.SetInput(self.__object)
68 self.__vtk_rotational_extrusion_filter.Update()
69
70 def setResolution(self, resolution):
71 """
72 Set the resolution of the sweep for the rotation, which controls the
73 number of intermediate points
74
75 @type resolution: Number
76 @param resolution: Resolution of the rotation
77 """
78
79 self.__vtk_rotational_extrusion_filter.SetResolution(resolution)
80
81 def setAngle(self, angle):
82 """
83 Set the angle of rotation.
84
85 @type angle: Number
86 @param angle: Angle of rotation
87 """
88
89 self.__vtk_rotational_extrusion_filter.SetAngle(angle)
90
91 def _getRotationOutput(self):
92 """
93 Return the output of the rotation.
94
95 @rtype: vtkPolyData
96 @return: Polygonal data
97 """
98
99 return self.__vtk_rotational_extrusion_filter.GetOutput()
100

  ViewVC Help
Powered by ViewVC 1.1.26