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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2313 - (hide annotations)
Tue Mar 17 03:41:17 2009 UTC (10 years, 5 months ago) by gross
File MIME type: text/x-python
File size: 2461 byte(s)
pyvisi is now rejecting to work under MPI with more than 1 processor. Tests for this configuration are dropped now.



1 ksteube 1809
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__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 ksteube 1147 """
23 jongui 1197 @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 ksteube 1147 """
30    
31 jongui 1197 __author__="John Ngui, john.ngui@uq.edu.au"
32    
33    
34 ksteube 1147 import vtk
35     from constant import WarpMode
36 gross 2313 from esys.escript import getMPISizeWorld
37 ksteube 1147
38     class Warp:
39     """
40     Class that defines the deformation of a scalar field.
41     """
42    
43 jongui 1148 def __init__(self, warp_mode):
44 ksteube 1147 """
45     Initialise the warp scalar/vector.
46    
47     @type warp_mode: L{WarpMode <constant.WarpMode>} constant
48     @param warp_mode: Mode in which to deform the data
49     """
50 gross 2313 if getMPISizeWorld()>1:
51     raise ValueError,"pyvisi.Warp is not running on more than one processor."
52 ksteube 1147 if(warp_mode == WarpMode.SCALAR): # Deform data with scalar data.
53     self.__vtk_warp = vtk.vtkWarpScalar()
54     elif(warp_mode == WarpMode.VECTOR): # Deform data with vector data.
55     self.__vtk_warp = vtk.vtkWarpVector()
56    
57 jongui 1148 def _setupWarp(self, object):
58     """
59     Setup the warp.
60    
61     @type object: vtkPolyData, etc
62 jongui 1199 @param object: Input for the warp scalar or warp vector
63 jongui 1148 """
64    
65     self.__object = object
66 ksteube 1147 self.__setInput()
67    
68     def __setInput(self):
69     """
70     Set the input for the warp scalar/vector.
71     """
72    
73     self.__vtk_warp.SetInput(self.__object)
74    
75     def setScaleFactor(self, scale_factor):
76     """
77     Set the displacement scale factor.
78    
79     @type scale_factor: Number
80 jongui 1199 @param scale_factor: Scale factor for the displacement
81 ksteube 1147 """
82    
83     self.__vtk_warp.SetScaleFactor(scale_factor)
84    
85 jongui 1148 def _getWarpOutput(self):
86 ksteube 1147 """
87     Return the output of the deformed data.
88    
89     @rtype: vtkPointSet
90     @return: PointSet data
91     """
92    
93     return self.__vtk_warp.GetOutput()
94    

  ViewVC Help
Powered by ViewVC 1.1.26