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

Contents of /trunk/pyvisi/py_src/cube.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: 2751 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 CubeSource:
38 """
39 Class that defines a cube source. The center of the cube souce defines
40 the point from which the cube is to be generated and the X, Y
41 and Z lengths define the length of the cube from the center point. If
42 X length is 3, then the X length to the left and right of the center
43 point is 1.5 respectively.
44 """
45
46 def __init__(self):
47 """
48 Initialise the cube source.
49 """
50 if getMPISizeWorld()>1:
51 raise ValueError,"pyvisi.CubeSource is not running on more than one processor"
52 self.__vtk_cube_source = vtk.vtkCubeSource()
53
54 def setCenter(self, center):
55 """
56 Set the cube source center.
57
58 @type center: L{GlobalPosition <position.GlobalPosition>} object
59 @param center: Cube source center
60 """
61
62 self.__vtk_cube_source.SetCenter(center._getGlobalPosition())
63
64 def setXLength(self, length):
65 """
66 Set the cube source length along the x-axis.
67
68 @type length: Number
69 @param length: Cube source length along the x-axis
70 """
71 self.__vtk_cube_source.SetXLength(length)
72
73 def setYLength(self, length):
74 """
75 Set the cube source length along the y-axis.
76
77 @type length: Number
78 @param length: Cube source length along the y-axis
79 """
80
81 self.__vtk_cube_source.SetYLength(length)
82
83 def setZLength(self, length):
84 """
85 Set the cube source length along the z-axis.
86
87 @type length: Number
88 @param length: Cube source length along the z-axis
89 """
90
91 self.__vtk_cube_source.SetZLength(length)
92
93 def _getCubeSourceOutput(self):
94 """
95 Return the output of the cube source
96
97 @rtype: vtkPolyData
98 @return: Polygonal data
99 """
100
101 return self.__vtk_cube_source.GetOutput()
102
103
104

  ViewVC Help
Powered by ViewVC 1.1.26