1 |
|
2 |
######################################################## |
3 |
# |
4 |
# Copyright (c) 2003-2010 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-2010 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 Arrow2D: |
38 |
""" |
39 |
Class that defines 2D arrows. |
40 |
""" |
41 |
|
42 |
def __init__(self): |
43 |
""" |
44 |
Initialise the 2D arrows. |
45 |
""" |
46 |
if getMPISizeWorld()>1: |
47 |
raise ValueError,"pyvisi.Arrow2D is not running on more than one processor" |
48 |
self.__vtk_arrow2D = vtk.vtkGlyphSource2D() |
49 |
self.__setupArrow2D() |
50 |
|
51 |
def __setupArrow2D(self): |
52 |
""" |
53 |
Setup the 2D arrows. |
54 |
""" |
55 |
|
56 |
# Use arrows instead of cone or sphere. |
57 |
self.__vtk_arrow2D.SetGlyphTypeToArrow() |
58 |
# Fill the inside of the arrows. |
59 |
self.__vtk_arrow2D.SetFilled(0) |
60 |
|
61 |
def _getArrow2DOutput(self): |
62 |
""" |
63 |
Return the output of the 2D arrows. |
64 |
|
65 |
:rtype: vtkPolyData |
66 |
:return: Polygonal data |
67 |
""" |
68 |
|
69 |
return self.__vtk_arrow2D.GetOutput() |
70 |
|
71 |
|
72 |
############################################################################### |
73 |
|
74 |
|
75 |
class Arrow3D: |
76 |
""" |
77 |
Class that defines 3D arrows. |
78 |
""" |
79 |
|
80 |
def __init__(self): |
81 |
""" |
82 |
Initialise the 3D arrows. |
83 |
""" |
84 |
if getMPISizeWorld()>1: |
85 |
raise ValueError,"pyvisi.Arrow3D is not running on more than one processor" |
86 |
self.__vtk_arrow3D = vtk.vtkArrowSource() |
87 |
|
88 |
def _getArrow3DOutput(self): |
89 |
""" |
90 |
Return the output of the 3D arrows. |
91 |
|
92 |
:rtype: vtkPolyData |
93 |
:return: Polygonal data |
94 |
""" |
95 |
|
96 |
return self.__vtk_arrow3D.GetOutput() |
97 |
|