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

Diff of /trunk/pyvisi/py_src/velocity.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1043 by jongui, Mon Mar 19 06:46:34 2007 UTC revision 1051 by jongui, Wed Mar 21 21:56:54 2007 UTC
# Line 10  from constant import Viewport, Color, Ar Line 10  from constant import Viewport, Color, Ar
10  from arrow import Arrow2D, Arrow3D  from arrow import Arrow2D, Arrow3D
11  from glyph import  Glyph3D  from glyph import  Glyph3D
12  from outline import Outline  from outline import Outline
13  from probe import Probe  #from probe import Probe
14  from point import StructuredPoints  from point import MaskPoints
15  from average import CellDataToPointData  from average import CellDataToPointData
16    
17  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, StructuredPoints and  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D and
18  # Probe were inherited to allow access to their public methods from the driver.  # MaskPoints were inherited to allow access to their public
19  class Velocity(DataSetMapper, Actor3D, Arrow2D, Arrow3D,  Glyph3D,  # methods from the driver.
20          StructuredPoints, Probe):  class Velocity(DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, MaskPoints):
21      """      """
22      Class that shows a vector field using arrows. The arrows can either be      Class that shows a vector field using arrows. The arrows can either be
23      colored or grey-scaled, depending on the lookup table used. If the arrows      colored or grey-scaled, depending on the lookup table used. If the arrows
# Line 86  class Velocity(DataSetMapper, Actor3D, A Line 86  class Velocity(DataSetMapper, Actor3D, A
86          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.          elif(lut == Lut.GREY_SCALE): # Grey scaled lookup table.
87              lookup_table = LookupTable()              lookup_table = LookupTable()
88              lookup_table._setLookupTableToGreyScale()              lookup_table._setLookupTableToGreyScale()
89            
         """  
90          if(cell_to_point == True): # Converts cell data to point data.          if(cell_to_point == True): # Converts cell data to point data.
             print "YES..."  
91              c2p = CellDataToPointData(data_collector._getOutput())              c2p = CellDataToPointData(data_collector._getOutput())
92              StructuredPoints.__init__(self, c2p._getOutput())              MaskPoints.__init__(self, c2p._getOutput())
             Probe.__init__(self, c2p._getOutput(),  
                     StructuredPoints._getStructuredPoints(self))  
93          elif(cell_to_point == False): # No conversion happens.            elif(cell_to_point == False): # No conversion happens.  
94              print "NO..."              MaskPoints.__init__(self, data_collector._getOutput())
95              StructuredPoints.__init__(self, data_collector._getOutput())      
             Probe.__init__(self, data_collector._getOutput(),  
                     StructuredPoints._getStructuredPoints(self))  
         """  
         StructuredPoints.__init__(self, data_collector._getOutput())  
         Probe.__init__(self, data_collector._getOutput(),  
                 StructuredPoints._getStructuredPoints(self))  
   
96          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(arrow == Arrow.TWO_D): # Use 2D arrows.
97              Arrow2D.__init__(self)              Arrow2D.__init__(self)
98              Glyph3D.__init__(self, Probe._getOutput(self),              Glyph3D.__init__(self, MaskPoints._getOutput(self),
99                      Arrow2D._getOutput(self))                      Arrow2D._getOutput(self))
100          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
101              Arrow3D.__init__(self)              Arrow3D.__init__(self)
102              #Glyph3D.__init__(self, data_collector._getOutput(),              Glyph3D.__init__(self, MaskPoints._getOutput(self),
             Glyph3D.__init__(self, Probe._getOutput(self),  
103                      Arrow3D._getOutput(self))                      Arrow3D._getOutput(self))
104    
           
         #c2p = CellDataToPointData(Glyph3D._getOutput(self))  
         #DataSetMapper.__init__(self, c2p._getOutput(),  
         #       lookup_table._getLookupTable())  
   
105          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          DataSetMapper.__init__(self, Glyph3D._getOutput(self),
106                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
107    
# Line 152  from plane import Plane Line 135  from plane import Plane
135  from cutter import Cutter  from cutter import Cutter
136    
137  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,
138  # Cutter, StructuredPoints and Probe were inherited to allow access to  # Cutter and MaskPoints were inherited to allow access to
139  # their public methods from the driver.  # their public methods from the driver.
140  class VelocityOnPlaneCut(DataSetMapper, Actor3D, Arrow2D, Arrow3D,    class VelocityOnPlaneCut(DataSetMapper, Actor3D, Arrow2D, Arrow3D,  
141          Glyph3D, Transform, Plane, Cutter, StructuredPoints, Probe):          Glyph3D, Transform, Plane, Cutter, MaskPoints):
142      """      """
143      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},      This class works in a similar way to L{MapOnPlaneCut <map.MapOnPlaneCut>},
144      except that it shows a vector field using arrows on a plane.      except that it shows a vector field using arrows on a plane.
# Line 166  class VelocityOnPlaneCut(DataSetMapper, Line 149  class VelocityOnPlaneCut(DataSetMapper,
149      # If no lut is specified, the color scheme willbe used.      # If no lut is specified, the color scheme willbe used.
150      def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,      def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
151              color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,              color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,
152              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
153          """          """
154          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
155          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 181  class VelocityOnPlaneCut(DataSetMapper, Line 164  class VelocityOnPlaneCut(DataSetMapper,
164          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
165          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
166          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
167            @type cell_to_point: Boolean
168            @param cell_to_point: Converts cell data to point data (by averaging)
169          @type outline: Boolean          @type outline: Boolean
170          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
171          """          """
# Line 223  class VelocityOnPlaneCut(DataSetMapper, Line 208  class VelocityOnPlaneCut(DataSetMapper,
208          Transform.__init__(self)              Transform.__init__(self)    
209          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
210    
211          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
212          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
213                  StructuredPoints._getStructuredPoints(self))              MaskPoints.__init__(self, c2p._getOutput())
214            elif(cell_to_point == False): # No conversion happens.  
215          Cutter.__init__(self, Probe._getOutput(self),              MaskPoints.__init__(self, data_collector._getOutput())
216                  Plane._getPlane(self))            
217    
218          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(arrow == Arrow.TWO_D): # Use 2D arrows.
219              Arrow2D.__init__(self)              Arrow2D.__init__(self)
220              Glyph3D.__init__(self, Cutter._getOutput(self),              #Glyph3D.__init__(self, Cutter._getOutput(self),
221                Glyph3D.__init__(self, MaskPoints._getOutput(self),
222                      Arrow2D._getOutput(self))                      Arrow2D._getOutput(self))
223          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
224              Arrow3D.__init__(self)              Arrow3D.__init__(self)
225              Glyph3D.__init__(self, Cutter._getOutput(self),              Glyph3D.__init__(self, MaskPoints._getOutput(self),
226                      Arrow3D._getOutput(self))                      Arrow3D._getOutput(self))
227    
228          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          Cutter.__init__(self, Glyph3D._getOutput(self),
229                    Plane._getPlane(self))  
230    
231            DataSetMapper.__init__(self, Cutter._getOutput(self),
232                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
233    
234          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.
# Line 270  class VelocityOnPlaneCut(DataSetMapper, Line 259  class VelocityOnPlaneCut(DataSetMapper,
259  from clipper import Clipper  from clipper import Clipper
260    
261  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,  # NOTE: DataSetMapper, Actor3D, Arrow2D, Arrow3D, Glyph3D, Transform, Plane,
262  # Clipper, StructuredPoints and Probe  were inherited to allow access to  # Clipper and MaskPoints  were inherited to allow access to
263  # their public methods from the driver.  # their public methods from the driver.
264  class VelocityOnPlaneClip(DataSetMapper, Actor3D, Arrow2D, Arrow3D,    class VelocityOnPlaneClip(DataSetMapper, Actor3D, Arrow2D, Arrow3D,  
265          Glyph3D, Transform, Plane, Clipper, StructuredPoints, Probe):          Glyph3D, Transform, Plane, Clipper, MaskPoints):
266      """      """
267      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>}      This class works in a similar way to L{MapOnPlaneClip <map.MapOnPlaneClip>}
268      , except that it shows a vector field using arrows clipped using a plane.      , except that it shows a vector field using arrows clipped using a plane.
# Line 284  class VelocityOnPlaneClip(DataSetMapper, Line 273  class VelocityOnPlaneClip(DataSetMapper,
273      # If no lut is specified, the color scheme will be used.      # If no lut is specified, the color scheme will be used.
274      def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,      def __init__(self, scene, data_collector, arrow = Arrow.TWO_D,
275              color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,              color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,
276              lut = Lut.COLOR, outline = True):              lut = Lut.COLOR, cell_to_point = False, outline = True):
277          """          """
278          @type scene: L{Scene <scene.Scene>} object          @type scene: L{Scene <scene.Scene>} object
279          @param scene: Scene in which objects are to be rendered on          @param scene: Scene in which objects are to be rendered on
# Line 299  class VelocityOnPlaneClip(DataSetMapper, Line 288  class VelocityOnPlaneClip(DataSetMapper,
288          @param viewport: Viewport in which objects are to be rendered on          @param viewport: Viewport in which objects are to be rendered on
289          @type lut : L{Lut <constant.Lut>} constant          @type lut : L{Lut <constant.Lut>} constant
290          @param lut: Lookup table color scheme          @param lut: Lookup table color scheme
291            @type cell_to_point: Boolean
292            @param cell_to_point: Converts cell data to point data (by averaging)
293          @type outline: Boolean          @type outline: Boolean
294          @param outline: Places an outline around the domain surface          @param outline: Places an outline around the domain surface
295          """          """
# Line 341  class VelocityOnPlaneClip(DataSetMapper, Line 332  class VelocityOnPlaneClip(DataSetMapper,
332          Transform.__init__(self)              Transform.__init__(self)    
333          Plane.__init__(self, Transform._getTransform(self))          Plane.__init__(self, Transform._getTransform(self))
334    
335          StructuredPoints.__init__(self, data_collector._getOutput())          if(cell_to_point == True): # Converts cell data to point data.
336          Probe.__init__(self, data_collector._getOutput(),              c2p = CellDataToPointData(data_collector._getOutput())
337                  StructuredPoints._getStructuredPoints(self))              MaskPoints.__init__(self, c2p._getOutput())
338            elif(cell_to_point == False): # No conversion happens.  
339                MaskPoints.__init__(self, data_collector._getOutput())
340    
341          # NOTE: Glyph3D must come before Clipper. Otherwise, the output will          # NOTE: Glyph3D must come before Clipper. Otherwise, the output will
342          # be incorrect.          # be incorrect.
343          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(arrow == Arrow.TWO_D): # Use 2D arrows.
344              Arrow2D.__init__(self)              Arrow2D.__init__(self)
345              Glyph3D.__init__(self, Probe._getOutput(self),              Glyph3D.__init__(self, MaskPoints._getOutput(self),
346                      Arrow2D._getOutput(self))                      Arrow2D._getOutput(self))
347          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
348              Arrow3D.__init__(self)              Arrow3D.__init__(self)
349              Glyph3D.__init__(self, Probe._getOutput(self),              Glyph3D.__init__(self, MaskPoints._getOutput(self),
350                      Arrow3D._getOutput(self))                      Arrow3D._getOutput(self))
351                    
352          # NOTE: Clipper must come after Glyph3D. Otherwise, the output will          # NOTE: Clipper must come after Glyph3D. Otherwise, the output will

Legend:
Removed from v.1043  
changed lines
  Added in v.1051

  ViewVC Help
Powered by ViewVC 1.1.26