/[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 973 by jongui, Thu Feb 15 04:06:23 2007 UTC revision 992 by jongui, Fri Feb 23 03:35:33 2007 UTC
# Line 26  class Velocity(DataSetMapper, Actor3D, A Line 26  class Velocity(DataSetMapper, Actor3D, A
26      # If no vector field is specified, the first encountered in the file will      # If no vector field is specified, the first encountered in the file will
27      # be loaded automatically. If no lut is specified, the color scheme will      # be loaded automatically. If no lut is specified, the color scheme will
28      # be used.      # be used.
29      def __init__(self, scene, data_collector, vector = None,      def __init__(self, scene, data_collector, vector = None, scalar = None,
30              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
31              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
32    
# Line 38  class Velocity(DataSetMapper, Actor3D, A Line 38  class Velocity(DataSetMapper, Actor3D, A
38          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for visualisation
39          @type vector: String          @type vector: String
40          @param vector: Vector field to load from the source file          @param vector: Vector field to load from the source file
41            @type scalar: String
42            @param scalar: Scalar field to load from the source file
43          @type arrow: L{Arrow <constant.Arrow>} constant          @type arrow: L{Arrow <constant.Arrow>} constant
44          @param arrow: Type of arrow (two dimensional or three dimensional)          @param arrow: Type of arrow (two dimensional or three dimensional)
45          @type color_mode: L{ColorMode <constant.ColorMode>} constant          @type color_mode: L{ColorMode <constant.ColorMode>} constant
# Line 75  class Velocity(DataSetMapper, Actor3D, A Line 77  class Velocity(DataSetMapper, Actor3D, A
77    
78          # ----- Velocity -----          # ----- Velocity -----
79    
80            # NOTE: Two 'ifs' were used instead of an if-elif because an active
81            # scalar and an active vector attribute may be specified at the same
82            # time. One may be for the color mode and the other for the
83            # scaling mode.
84          if(vector != None):          if(vector != None):
85              data_collector._setActiveVector(vector)              data_collector._setActiveVector(vector)
86            if(scalar != None):
87                data_collector._setActiveScalar(scalar)
88    
89          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
90          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
# Line 105  class Velocity(DataSetMapper, Actor3D, A Line 113  class Velocity(DataSetMapper, Actor3D, A
113                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
114    
115          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.
             print "vector .."  
116              Glyph3D._setColorModeByVector(self)              Glyph3D._setColorModeByVector(self)
117              Glyph3D._setRange(self, data_collector._getVectorRange())              Glyph3D._setRange(self, data_collector._getVectorRange())
118              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
119                      data_collector._getVectorRange())                      data_collector._getVectorRange())
             print data_collector._getVectorRange()  
120          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.
             print "scalar.."  
121              Glyph3D._setColorModeByScalar(self)              Glyph3D._setColorModeByScalar(self)
122              Glyph3D._setRange(self, data_collector._getScalarRange())              Glyph3D._setRange(self, data_collector._getVectorRange())
123              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
124                      data_collector._getScalarRange())                      data_collector._getScalarRange())
             print data_collector._getScalarRange()  
125    
126          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))          Actor3D.__init__(self, DataSetMapper._getDataSetMapper(self))
127          scene._addActor3D(viewport, Actor3D._getActor3D(self))          scene._addActor3D(viewport, Actor3D._getActor3D(self))
# Line 144  class VelocityOnPlaneCut(DataSetMapper, Line 148  class VelocityOnPlaneCut(DataSetMapper,
148      # If no vector field is specified, the first encountered in the file will      # If no vector field is specified, the first encountered in the file will
149      # be loaded automatically.  If no lut is specified, the color scheme will      # be loaded automatically.  If no lut is specified, the color scheme will
150      # be used.      # be used.
151      def __init__(self, scene, data_collector, vector = None,      def __init__(self, scene, data_collector, vector = None, scalar = None,
152              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
153              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
154          """          """
# Line 155  class VelocityOnPlaneCut(DataSetMapper, Line 159  class VelocityOnPlaneCut(DataSetMapper,
159          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for visualisation
160          @type vector: String          @type vector: String
161          @param vector: Vector field to load from the source file          @param vector: Vector field to load from the source file
162            @type scalar: String
163            @param scalar: Scalar field to load from the source file
164          @type arrow: L{Arrow <constant.Arrow>} constant          @type arrow: L{Arrow <constant.Arrow>} constant
165          @param arrow: Type of arrow (two dimensional or three dimensional)          @param arrow: Type of arrow (two dimensional or three dimensional)
166          @type color_mode: L{ColorMode <constant.ColorMode>} constant          @type color_mode: L{ColorMode <constant.ColorMode>} constant
# Line 192  class VelocityOnPlaneCut(DataSetMapper, Line 198  class VelocityOnPlaneCut(DataSetMapper,
198    
199          # ----- Velocity on a cut plane -----          # ----- Velocity on a cut plane -----
200    
201            # NOTE: Two 'ifs' were used instead of an if-elif because an active
202            # scalar and an active vector attribute may be specified at the same
203            # time. One may be for the color mode and the other for the
204            # scaling mode.
205          if(vector != None):          if(vector != None):
206              data_collector._setActiveVector(vector)              data_collector._setActiveVector(vector)
207            if(scalar != None):
208                data_collector._setActiveScalar(scalar)
209    
210          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
211          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
# Line 218  class VelocityOnPlaneCut(DataSetMapper, Line 230  class VelocityOnPlaneCut(DataSetMapper,
230          if(arrow == Arrow.TWO_D): # Use 2D arrows.          if(arrow == Arrow.TWO_D): # Use 2D arrows.
231              Arrow2D.__init__(self)              Arrow2D.__init__(self)
232              Glyph3D.__init__(self, Cutter._getOutput(self),              Glyph3D.__init__(self, Cutter._getOutput(self),
233                      Arrow2D._getOutput(self), data_collector._getScalarRange())                      Arrow2D._getOutput(self))
234          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
235              Arrow3D.__init__(self)              Arrow3D.__init__(self)
236              Glyph3D.__init__(self, Cutter._getOutput(self),              Glyph3D.__init__(self, Cutter._getOutput(self),
237                      Arrow3D._getOutput(self), data_collector._getScalarRange())                      Arrow3D._getOutput(self))
238    
239          DataSetMapper.__init__(self, Glyph3D._getOutput(self),          DataSetMapper.__init__(self, Glyph3D._getOutput(self),
240                  lookup_table._getLookupTable())                  lookup_table._getLookupTable())
241    
242          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.
243              Glyph3D._setColorModeByVector(self)              Glyph3D._setColorModeByVector(self)
244                Glyph3D._setRange(self, data_collector._getVectorRange())
245              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
246                      data_collector._getVectorRange())                      data_collector._getVectorRange())
247          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.
248              Glyph3D._setColorModeByScalar(self)              Glyph3D._setColorModeByScalar(self)
249                Glyph3D._setRange(self, data_collector._getVectorRange())
250              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
251                      data_collector._getScalarRange())                      data_collector._getScalarRange())
252    
# Line 259  class VelocityOnPlaneClip(DataSetMapper, Line 273  class VelocityOnPlaneClip(DataSetMapper,
273      # If no vector field is specified, the first encountered in the file will      # If no vector field is specified, the first encountered in the file will
274      # be loaded automatically.  If no lut is specified, the color scheme will      # be loaded automatically.  If no lut is specified, the color scheme will
275      # be used.      # be used.
276      def __init__(self, scene, data_collector, vector = None,      def __init__(self, scene, data_collector, vector = None, scalar = None,
277              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,              arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
278              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):              viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, outline = True):
279          """          """
# Line 270  class VelocityOnPlaneClip(DataSetMapper, Line 284  class VelocityOnPlaneClip(DataSetMapper,
284          @param data_collector: Deal with source of data for visualisation          @param data_collector: Deal with source of data for visualisation
285          @type vector: String          @type vector: String
286          @param vector: Vector field to load from the source file          @param vector: Vector field to load from the source file
287            @type scalar: String
288            @param scalar: Scalar field to load from the source file
289          @type arrow: L{Arrow <constant.Arrow>} constant          @type arrow: L{Arrow <constant.Arrow>} constant
290          @param arrow: Type of arrow (two dimensional or three dimensional)          @param arrow: Type of arrow (two dimensional or three dimensional)
291          @type color_mode: L{ColorMode <constant.ColorMode>} constant          @type color_mode: L{ColorMode <constant.ColorMode>} constant
# Line 307  class VelocityOnPlaneClip(DataSetMapper, Line 323  class VelocityOnPlaneClip(DataSetMapper,
323    
324          # ----- Velocity on a clipped plane -----          # ----- Velocity on a clipped plane -----
325    
326            # NOTE: Two 'ifs' were used instead of an if-elif because an active
327            # scalar and an active vector attribute may be specified at the same
328            # time. One may be for the color mode and the other for the
329            # scaling mode.
330          if(vector != None):          if(vector != None):
331              data_collector._setActiveVector(vector)              data_collector._setActiveVector(vector)
332            if(scalar != None):
333                data_collector._setActiveScalar(scalar)
334    
335          # NOTE: Lookup table color mapping (color or grey scale) MUST be set          # NOTE: Lookup table color mapping (color or grey scale) MUST be set
336          # before DataSetMapper. If it is done after DataSetMapper, no effect          # before DataSetMapper. If it is done after DataSetMapper, no effect
# Line 333  class VelocityOnPlaneClip(DataSetMapper, Line 355  class VelocityOnPlaneClip(DataSetMapper,
355              Arrow2D.__init__(self)              Arrow2D.__init__(self)
356              #Glyph3D.__init__(self, data_collector._getOutput(),              #Glyph3D.__init__(self, data_collector._getOutput(),
357              Glyph3D.__init__(self, Probe._getOutput(self),              Glyph3D.__init__(self, Probe._getOutput(self),
358                      Arrow2D._getOutput(self), data_collector._getScalarRange())                      Arrow2D._getOutput(self))
359          elif(arrow == Arrow.THREE_D): # Use 3D arrows.          elif(arrow == Arrow.THREE_D): # Use 3D arrows.
360              Arrow3D.__init__(self)              Arrow3D.__init__(self)
361              Glyph3D.__init__(self, Probe._getOutput(self),              Glyph3D.__init__(self, Probe._getOutput(self),
362                      Arrow3D._getOutput(self), data_collector._getScalarRange())                      Arrow3D._getOutput(self))
363                    
364          # NOTE: Clipper must come after Glyph3D. Otherwise, the output will          # NOTE: Clipper must come after Glyph3D. Otherwise, the output will
365          # be incorrect.          # be incorrect.
# Line 350  class VelocityOnPlaneClip(DataSetMapper, Line 372  class VelocityOnPlaneClip(DataSetMapper,
372    
373          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.          if(color_mode == ColorMode.VECTOR): # Color velocity by vector.
374              Glyph3D._setColorModeByVector(self)              Glyph3D._setColorModeByVector(self)
375                Glyph3D._setRange(self, data_collector._getVectorRange())
376              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
377                      data_collector._getVectorRange())                      data_collector._getVectorRange())
378          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.          elif(color_mode == ColorMode.SCALAR): # Color velocity by scalar.
379              Glyph3D._setColorModeByScalar(self)              Glyph3D._setColorModeByScalar(self)
380                Glyph3D._setRange(self, data_collector._getVectorRange())
381              DataSetMapper._setScalarRange(self,              DataSetMapper._setScalarRange(self,
382                      data_collector._getScalarRange())                      data_collector._getScalarRange())
383    

Legend:
Removed from v.973  
changed lines
  Added in v.992

  ViewVC Help
Powered by ViewVC 1.1.26