/[escript]/trunk/doc/user/pyvisi.tex
ViewVC logotype

Diff of /trunk/doc/user/pyvisi.tex

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

revision 1154 by jongui, Fri May 18 02:46:32 2007 UTC revision 1318 by ksteube, Wed Sep 26 04:39:14 2007 UTC
# Line 1  Line 1 
1  \chapter{The module \pyvisi}  \chapter{The Module \pyvisi}
2  \label{PYVISI CHAP}  \label{PYVISI CHAP}
3  \declaremodule{extension}{esys.pyvisi}  \declaremodule{extension}{esys.pyvisi}
4  \modulesynopsis{Python Visualization Interface}  \modulesynopsis{Python Visualization Interface}
# Line 6  Line 6 
6  \section{Introduction}  \section{Introduction}
7  \pyvisi is a Python module that is used to generate 2D and 3D visualization  \pyvisi is a Python module that is used to generate 2D and 3D visualization
8  for escript and its PDE solvers: finley and bruce. This module provides  for escript and its PDE solvers: finley and bruce. This module provides
9  an easy to use interface to the \VTK library (\VTKUrl). There are three  an easy to use interface to the \VTK library (\VTKUrl). Pyvisi can be used to
10    render (generate) surface maps and contours for scalar fields, arrows and
11    streamlines for vector fields, and ellipsoids for tensor fields.  
12    There are three
13  approaches for rendering an object. (1) Online - object is rendered on-screen  approaches for rendering an object. (1) Online - object is rendered on-screen
14  with interaction capability (i.e. zoom and rotate), (2) Offline - object is  with interaction capability (i.e. zoom and rotate), (2) Offline - object is
15  rendered off-screen (no pop-up window) and (3) Display - object is rendered  rendered off-screen (no pop-up window) and (3) Display - object is rendered
16  on-screen but with no interaction capability (able to produce on-the-fly  on-screen but with no interaction capability (on-the-fly
17  animation). All three approaches have the option to save the rendered object  animation). All three approaches have the option to save the rendered object
18  as an image (i.e. jpg).  as an image (i.e. jpg) and subsequently converting a series of images into a
19    movie (.mpg).
20    
21  The following outlines the general guidelines when using Pyvisi:  The following outlines the general steps to use Pyvisi:
22    
23  \begin{enumerate}  \begin{enumerate}
24  \item Create a \Scene instance, a window in which objects are to be rendered on.  \item Create a \Scene instance - a window in which objects are to be
25  \item Create a data input instance (i.e. \DataCollector or \ImageReader), which  rendered on.
26    \item Create a data input instance (i.e. \DataCollector or \ImageReader) -
27  reads and loads the source data for visualization.  reads and loads the source data for visualization.
28  \item Create a data visualization instance (i.e. \Map, \Velocity, \Ellipsoid,  \item Create a data visualization instance (i.e. \Map, \Velocity, \Ellipsoid,
29  \Contour, \Carpet, \StreamLine or \Image), which proccesses and manipulates the  \Contour, \Carpet, \StreamLine or \Image) -  processes and manipulates
30  source data.  the source data.
31  \item Create a \Camera or \Light instance, which controls the viewing angle and  \item Create a \Camera or \Light instance - controls the viewing angle and
32  lighting effects.  lighting effects.
33  \item Render the object using either the Online, Offline or Display approach.  \item Render the object - using either the Online, Offline or Display approach.
34    \item Generate movie - converts a series of images into a movie.
35  \end{enumerate}  \end{enumerate}
36  \begin{center}  \begin{center}
37  \begin{math}  \begin{math}
38  scene \rightarrow data \; input \rightarrow data \; visualization \rightarrow  scene \rightarrow data \; input \rightarrow data \; visualization \rightarrow
39  camer \, / \, light \rightarrow render  camera \, / \, light \rightarrow render \rightarrow movie
40  \end{math}  \end{math}
41  \end{center}  \end{center}
42    
# Line 115  Rotate the camera to view the isometric Line 121  Rotate the camera to view the isometric
121  \end{methoddesc}  \end{methoddesc}
122    
123  \begin{methoddesc}[Camera]{dolly}{distance}  \begin{methoddesc}[Camera]{dolly}{distance}
124  Move the camera towards (greater than 1) and away (less than 1) from  Move the camera towards (greater than 1) the rendered object. However,
125  the rendered object.  the camera is unable to be moved away from the rendered object.
126  \end{methoddesc}  \end{methoddesc}
127    
128  \subsubsection{\Light class}  \subsubsection{\Light class}
# Line 149  elevation and azimuth. Line 155  elevation and azimuth.
155    
156    
157  \subsection{Input Classes}  \subsection{Input Classes}
158    \label{INPUT SEC}
159  This subsection details the instances used to read and load the source data  This subsection details the instances used to read and load the source data
160  for visualization.  for visualization.
161    
162  \subsubsection{\DataCollector class}  \subsubsection{\DataCollector class}
 \label{DATACOLLECTOR SEC}  
163  \begin{classdesc}{DataCollector}{source = Source.XML}  \begin{classdesc}{DataCollector}{source = Source.XML}
164  A data collector is used to read data either from a XML file (using  A data collector is used to read data either from a XML file (using
165  \texttt{setFileName()}) or from an escript object directly (using  \texttt{setFileName()}) or from an escript object directly (using
# Line 223  Including methods from \ActorTwoD. Line 229  Including methods from \ActorTwoD.
229    
230    
231  \subsection{Data Visualization Classes}  \subsection{Data Visualization Classes}
232    \label{DATAVIS SEC}
233  This subsection details the instances used to process and manipulate the source  This subsection details the instances used to process and manipulate the source
234  data. The typical usage of some of the classes are also shown.  data. The typical usage of some of the classes are also shown.
235    
# Line 230  One point to note is that the source can Line 237  One point to note is that the source can
237  source is cell data, a conversion to point data may or may not be  source is cell data, a conversion to point data may or may not be
238  required, in order for the object to be rendered correctly.  required, in order for the object to be rendered correctly.
239  If a conversion is needed, the 'cell_to_point' flag (see below) must  If a conversion is needed, the 'cell_to_point' flag (see below) must
240  be set to 'True', otherwise 'False' (which is the default).  be set to 'True', otherwise 'False' (which is the default). On occasions, an
241    inaccurate object may be rendered from cell data even after conversion.
242    
243  \subsubsection{\Map class}  \subsubsection{\Map class}
244    
# Line 238  be set to 'True', otherwise 'False' (whi Line 246  be set to 'True', otherwise 'False' (whi
246  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
247  outline = True}  outline = True}
248  Class that shows a scalar field on a domain surface. The domain surface  Class that shows a scalar field on a domain surface. The domain surface
249  can either be colored or grey-scaled, depending on the lookup table used.  can either be color or gray-scale, depending on the lookup table used.
250  \end{classdesc}  \end{classdesc}
251    
252  The following are some of the methods available:\\  The following are some of the methods available:\\
253  Methods from \ActorThreeD.  Methods from \ActorThreeD and \DataSetMapper.
254    
255  A typical usage of \Map is shown below.  A typical usage of \Map is shown below.
256    
257  \begin{python}  \begin{python}
258    """
259    Author: John Ngui, john.ngui@uq.edu.au
260    """
261    
262  # Import the necessary modules.  # Import the necessary modules.
263  from esys.pyvisi import Scene, DataCollector, Map, Camera  from esys.pyvisi import Scene, DataCollector, Map, Camera
264  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 292  m2 = Map(scene = s, data_collector = dc2 Line 304  m2 = Map(scene = s, data_collector = dc2
304          lut = Lut.COLOR, cell_to_point = True, outline = True)          lut = Lut.COLOR, cell_to_point = True, outline = True)
305    
306  # Create a Camera for the third viewport  # Create a Camera for the third viewport
307  c1 = Camera(scene = s, viewport = Viewport.NORTH_EAST)  c2 = Camera(scene = s, viewport = Viewport.NORTH_EAST)
308    
309  # Render the object.  # Render the object.
310  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
# Line 309  X, Y and Z axes. Line 321  X, Y and Z axes.
321  \end{classdesc}  \end{classdesc}
322    
323  The following are some of the methods available:\\  The following are some of the methods available:\\
324  Methods from \ActorThreeD and \Transform.  Methods from \ActorThreeD, \Transform and \DataSetMapper.
325    
326  \subsubsection{\MapOnPlaneClip class}  \subsubsection{\MapOnPlaneClip class}
327    
# Line 321  scalar field clipped using a plane. Line 333  scalar field clipped using a plane.
333  \end{classdesc}  \end{classdesc}
334    
335  The following are some of the methods available:\\  The following are some of the methods available:\\
336  Methods from \ActorThreeD, \Transform and \Clipper.  Methods from \ActorThreeD, \Transform, \Clipper and \DataSetMapper.
337    
338  \subsubsection{\MapOnScalarClip class}  \subsubsection{\MapOnScalarClip class}
339    
# Line 333  field clipped using a scalar value. Line 345  field clipped using a scalar value.
345  \end{classdesc}  \end{classdesc}
346    
347  The following are some of the methods available:\\  The following are some of the methods available:\\
348  Methods from \ActorThreeD and \Clipper.  Methods from \ActorThreeD, \Clipper and \DataSetMapper.
349    
350    \subsubsection{\MapOnScalarClipWithRotation class}
351    
352    \begin{classdesc}{MapOnScalarClipWithRotation}{scene, data_collector,
353    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False}
354    This class works in a similar way to \Map except that it
355    shows a 2D scalar field clipped using a scalar value and subsequently
356    rotated around the z-axis to create a  3D looking effect. This class should
357    only be used with 2D data sets and NOT 3D.
358    \end{classdesc}
359    
360    The following are some of the methods available:\\
361    Methods from \ActorThreeD, \Clipper, \Rotation and \DataSetMapper.
362    
363  \subsubsection{\Velocity class}  \subsubsection{\Velocity class}
364    
# Line 341  Methods from \ActorThreeD and \Clipper. Line 366  Methods from \ActorThreeD and \Clipper.
366  color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,    color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,  
367  lut = Lut.COLOR, cell_to_point = False, outline = True}  lut = Lut.COLOR, cell_to_point = False, outline = True}
368  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
369  colored or grey-scaled, depending on the lookup table used. If the arrows  color or gray-scale, depending on the lookup table used. If the arrows
370  are colored, there are two possible coloring modes, either using vector data or  are colored, there are two possible coloring modes, either using vector data or
371  scalar data. Similarly, there are two possible types of arrows, either  scalar data. Similarly, there are two possible types of arrows, either
372  using two-dimensional or three-dimensional.  using two-dimensional or three-dimensional.
373  \end{classdesc}  \end{classdesc}
374    
375  The following are some of the methods available:\\  The following are some of the methods available:\\
376  Methods from \ActorThreeD, \GlyphThreeD and \MaskPoints.  Methods from \ActorThreeD, \GlyphThreeD, \MaskPoints and \DataSetMapper.
377    
378  \subsubsection{\VelocityOnPlaneCut class}  \subsubsection{\VelocityOnPlaneCut class}
379    
# Line 361  it shows a vector field using arrows cut Line 386  it shows a vector field using arrows cut
386  \end{classdesc}  \end{classdesc}
387    
388  The following are some of the methods available:\\  The following are some of the methods available:\\
389  Methods from \ActorThreeD, \GlyphThreeD, \Transform and \MaskPoints.  Methods from \ActorThreeD, \GlyphThreeD, \Transform, \MaskPoints and
390    \DataSetMapper.
391    
392  A typical usage of \VelocityOnPlaneCut is shown below.  A typical usage of \VelocityOnPlaneCut is shown below.
393    
394  \begin{python}  \begin{python}
395    """
396    Author: John Ngui, john.ngui@uq.edu.au
397    """
398    
399  # Import the necessary modules  # Import the necessary modules
400  from esys.pyvisi import Scene, DataCollector, VelocityOnPlaneCut, Camera  from esys.pyvisi import Scene, DataCollector, VelocityOnPlaneCut, Camera
401  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 381  FILE_3D = "interior_3D.xml" Line 411  FILE_3D = "interior_3D.xml"
411  IMAGE_NAME = "velocity.jpg"  IMAGE_NAME = "velocity.jpg"
412  JPG_RENDERER = Renderer.ONLINE_JPG  JPG_RENDERER = Renderer.ONLINE_JPG
413    
414  # Create a Scene with four viewports  # Create a Scene.
415  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
416          y_size = Y_SIZE)          y_size = Y_SIZE)
417    
# Line 420  vector field using arrows clipped using Line 450  vector field using arrows clipped using
450  \end{classdesc}  \end{classdesc}
451    
452  The following are some of the methods available:\\  The following are some of the methods available:\\
453  Methods from \ActorThreeD, \GlyphThreeD, \Transform, \Clipper and  Methods from \ActorThreeD, \GlyphThreeD, \Transform, \Clipper,
454  \MaskPoints.  \MaskPoints and \DataSetMapper.
455    
456  \subsubsection{\Ellipsoid class}  \subsubsection{\Ellipsoid class}
457    
# Line 429  Methods from \ActorThreeD, \GlyphThreeD, Line 459  Methods from \ActorThreeD, \GlyphThreeD,
459  viewport = Viewport = SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,  viewport = Viewport = SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
460  outline = True}  outline = True}
461  Class that shows a tensor field using ellipsoids. The ellipsoids can either be  Class that shows a tensor field using ellipsoids. The ellipsoids can either be
462  colored or grey-scaled, depending on the lookup table used.  color or gray-scale, depending on the lookup table used.
463  \end{classdesc}  \end{classdesc}
464    
465  The following are some of the methods available:\\  The following are some of the methods available:\\
466  Methods from \ActorThreeD, \Sphere, \TensorGlyph and \MaskPoints.  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \MaskPoints and
467    \DataSetMapper.
468    
469  \subsubsection{\EllipsoidOnPlaneCut class}  \subsubsection{\EllipsoidOnPlaneCut class}
470    
# Line 445  a tensor field using ellipsoids cut usin Line 476  a tensor field using ellipsoids cut usin
476  \end{classdesc}  \end{classdesc}
477    
478  The following are some of the methods available:\\  The following are some of the methods available:\\
479  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform and  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform,
480  \MaskPoints.  \MaskPoints and \DataSetMapper.
481    
482  \subsubsection{\EllipsoidOnPlaneClip class}  \subsubsection{\EllipsoidOnPlaneClip class}
483    
# Line 458  tensor field using ellipsoids clipped us Line 489  tensor field using ellipsoids clipped us
489  \end{classdesc}  \end{classdesc}
490                    
491  The following are some of the methods available:\\  The following are some of the methods available:\\
492  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform, \Clipper  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform, \Clipper,
493  and \MaskPoints.  \MaskPoints and \DataSetMapper.
494    
495  A typical usage of \EllipsoidOnPlaneClip is shown below.  A typical usage of \EllipsoidOnPlaneClip is shown below.
496    
497  \begin{python}  \begin{python}
498    """
499    Author: John Ngui, john.ngui@uq.edu.au
500    """
501    
502  # Import the necessary modules  # Import the necessary modules
503  from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera  from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera
504  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 488  dc1 = DataCollector(source = Source.XML) Line 523  dc1 = DataCollector(source = Source.XML)
523  dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))  dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
524  dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)  dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)
525    
526  # Create a EllipsoidOnPlaneClip.  # Create an EllipsoidOnPlaneClip.
527  eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,  eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,
528          viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,          viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,
529          outline = True)          outline = True)
# Line 496  eopc1.setPlaneToXY() Line 531  eopc1.setPlaneToXY()
531  eopc1.setScaleFactor(scale_factor = 0.2)  eopc1.setScaleFactor(scale_factor = 0.2)
532  eopc1.rotateX(angle = 10)  eopc1.rotateX(angle = 10)
533    
534  # Create a camera.  # Create a Camera.
535  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
536  c1.bottomView()  c1.bottomView()
537  c1.azimuth(angle = -90)  c1.azimuth(angle = -90)
# Line 512  s.render(image_name = os.path.join(PYVIS Line 547  s.render(image_name = os.path.join(PYVIS
547  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
548  outline = True}  outline = True}
549  Class that shows a scalar field using contour surfaces. The contour surfaces can  Class that shows a scalar field using contour surfaces. The contour surfaces can
550  either be colored or grey-scaled, depending on the lookup table used. This  either be color or gray-scale, depending on the lookup table used. This
551  class can also be used to generate iso surfaces.  class can also be used to generate iso surfaces.
552  \end{classdesc}  \end{classdesc}
553    
554  The following are some of the methods available:\\  The following are some of the methods available:\\
555  Methods from \ActorThreeD and \ContourModule.  Methods from \ActorThreeD, \ContourModule and \DataSetMapper.
556    
557  A typical usage of \Contour is shown below.  A typical usage of \Contour is shown below.
558    
559  \begin{python}  \begin{python}
560    """
561    Author: John Ngui, john.ngui@uq.edu.au
562    """
563    
564  # Import the necessary modules  # Import the necessary modules
565  from esys.pyvisi import Scene, DataCollector, Contour, Camera  from esys.pyvisi import Scene, DataCollector, Contour, Camera
566  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 569  scalar field using contour surfaces cut Line 608  scalar field using contour surfaces cut
608  \end{classdesc}  \end{classdesc}
609    
610  The following are some of the methods available:\\  The following are some of the methods available:\\
611  Methods from \ActorThreeD, \ContourModule and \Transform.  Methods from \ActorThreeD, \ContourModule, \Transform and \DataSetMapper.
612    
613  \subsubsection{\ContourOnPlaneClip class}  \subsubsection{\ContourOnPlaneClip class}
614    
# Line 581  scalar field using contour surfaces clip Line 620  scalar field using contour surfaces clip
620  \end{classdesc}  \end{classdesc}
621    
622  The following are some of the methods available:\\  The following are some of the methods available:\\
623  Methods from \ActorThreeD, \ContourModule, \Transform and \Clipper.  Methods from \ActorThreeD, \ContourModule, \Transform, \Clipper and
624    \DataSetMapper.
625    
626  \subsubsection{\StreamLine class}  \subsubsection{\StreamLine class}
627    
# Line 589  Methods from \ActorThreeD, \ContourModul Line 629  Methods from \ActorThreeD, \ContourModul
629  viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.VECTOR, lut = Lut.COLOR,  viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.VECTOR, lut = Lut.COLOR,
630  cell_to_point = False, outline = True}  cell_to_point = False, outline = True}
631  Class that shows the direction of particles of a vector field using streamlines.  Class that shows the direction of particles of a vector field using streamlines.
632  The streamlines can either be colored or grey-scaled, depending on the lookup  The streamlines can either be color or gray-scale, depending on the lookup
633  table used. If the streamlines are colored, there are two possible coloring  table used. If the streamlines are colored, there are two possible coloring
634  modes, either using vector data or scalar data.  modes, either using vector data or scalar data.
635  \end{classdesc}  \end{classdesc}
636    
637  The following are some of the methods available:\\  The following are some of the methods available:\\
638  Methods from \ActorThreeD, \PointSource, \StreamLineModule and \Tube.  Methods from \ActorThreeD, \PointSource, \StreamLineModule, \Tube and
639    \DataSetMapper.
640    
641  A typical usage of \StreamLine is shown below.  A typical usage of \StreamLine is shown below.
642    
643  \begin{python}  \begin{python}
644    """
645    Author: John Ngui, john.ngui@uq.edu.au
646    """
647    
648  # Import the necessary modules.  # Import the necessary modules.
649  from esys.pyvisi import Scene, DataCollector, StreamLine, Camera  from esys.pyvisi import Scene, DataCollector, StreamLine, Camera
650  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 628  sl1 = StreamLine(scene = s, data_collect Line 673  sl1 = StreamLine(scene = s, data_collect
673          viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.SCALAR,          viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.SCALAR,
674          lut = Lut.COLOR, cell_to_point = False, outline = True)          lut = Lut.COLOR, cell_to_point = False, outline = True)
675  sl1.setTubeRadius(radius = 0.02)  sl1.setTubeRadius(radius = 0.02)
676    sl1.setTubeNumberOfSides(3)
677    sl1.setTubeRadiusToVaryByVector()
678    sl1.setPointSourceRadius(0.9)
679    
680  # Create a Camera.  # Create a Camera.
681  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
# Line 643  s.render(image_name = os.path.join(PYVIS Line 691  s.render(image_name = os.path.join(PYVIS
691  viewport = Viewport.Viewport.SOUTH_WEST, warp_mode = WarpMode.SCALAR,  viewport = Viewport.Viewport.SOUTH_WEST, warp_mode = WarpMode.SCALAR,
692  lut = Lut.COLOR, cell_to_point = False, outline = True}  lut = Lut.COLOR, cell_to_point = False, outline = True}
693  This class works in a similar way to \MapOnPlaneCut, except that it shows a  This class works in a similar way to \MapOnPlaneCut, except that it shows a
694  scalar field cut on a plane and deformated (warp) along the normal. The  scalar field cut on a plane and deformed (warped) along the normal. The
695  plane can either be colored or grey-scaled, depending on the lookup table used.  plane can either be color or gray-scale, depending on the lookup table used.
696  Similarly, the plane can be deformated either using scalar data or vector data.  Similarly, the plane can be deformed either using scalar data or vector data.
697  \end{classdesc}  \end{classdesc}
698    
699  The following are some of the methods available:\\  The following are some of the methods available:\\
700  Methods from \ActorThreeD, \Warp and \Transform.  Methods from \ActorThreeD, \Warp, \Transform and \DataSetMapper.
701    
702  A typical usage of \Carpet is shown below.  A typical usage of \Carpet is shown below.
703    
704  \begin{python}  \begin{python}
705    """
706    Author: John Ngui, john.ngui@uq.edu.au
707    """
708    
709  # Import the necessary modules.  # Import the necessary modules.
710  from esys.pyvisi import Scene, DataCollector, Carpet, Camera  from esys.pyvisi import Scene, DataCollector, Carpet, Camera
711  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 693  c1.isometricView() Line 745  c1.isometricView()
745  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))  s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
746  \end{python}  \end{python}
747    
748    \subsubsection{\Legend class}
749    
750    \begin{classdesc}{Legend}{scene, data_collector,
751    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, legend = LegendType.SCALAR}
752    Class that shows a scalar field on a domain surface. The domain surface
753    can either be color or gray-scale, depending on the lookup table used
754    \end{classdesc}
755    
756    The following are some of the methods available:\\
757    Methods from \ActorThreeD, \ScalarBar and \DataSetMapper.
758    
759    \subsubsection{\Rectangle class}
760    
761    \begin{classdesc}{Rectangle}{scene, viewport = Viewport.SOUTH_WEST}
762    Class that generates a rectangle box.
763    \end{classdesc}
764    
765    The following are some of the methods available:\\
766    Methods from \ActorThreeD, \CubeSource and \DataSetMapper.
767    
768  \subsubsection{\Image class}  \subsubsection{\Image class}
769    
770  \begin{classdesc}{Image}{scene, image_reader, viewport = Viewport.SOUTH_WEST}  \begin{classdesc}{Image}{scene, image_reader, viewport = Viewport.SOUTH_WEST}
# Line 708  Methods from \ActorThreeD, \PlaneSource Line 780  Methods from \ActorThreeD, \PlaneSource
780  A typical usage of \Image is shown below.  A typical usage of \Image is shown below.
781    
782  \begin{python}  \begin{python}
783    """
784    Author: John Ngui, john.ngui@uq.edu.au
785    """
786    
787  # Import the necessary modules.  # Import the necessary modules.
788  from esys.pyvisi import Scene, DataCollector, Map, ImageReader, Image, Camera  from esys.pyvisi import Scene, DataCollector, Map, ImageReader, Image, Camera
789  from esys.pyvisi import GlobalPosition  from esys.pyvisi import GlobalPosition
# Line 768  of the logo can be specified. Line 844  of the logo can be specified.
844  The following are some of the methods available:\\  The following are some of the methods available:\\
845  Methods from \ImageReslice and \ActorTwoD.  Methods from \ImageReslice and \ActorTwoD.
846    
847    \subsubsection{\Movie class}
848    
849    \begin{classdesc}{Movie}{parameter_file = "make_movie"}
850    Class that creates a file called 'make_movie' by default (if a parameter
851    file name is not specified) which contains a list of parameters required
852    by the 'ppmtompeg' command to generate a movie from a series of images.
853    \end{classdesc}
854    
855    The following are some of the methods available:\\
856    \begin{methoddesc}[Movie]{imageRange}{input_directory, first_image, last_image}
857    The image range from which the movie is to be generated from.
858    \end{methoddesc}
859    
860    \begin{methoddesc}[Movie]{imageList}{input_directory, image_list}
861    The image list from which the movie is to be generated from.
862    \end{methoddesc}
863    
864    \begin{methoddesc}[Movie]{makeMovie}{movie}
865    Generate the movie.
866    \end{methoddesc}
867    
868    A typical usage of \Movie is shown below.
869    
870    \begin{python}
871    """
872    Author: John Ngui, john.ngui@uq.edu.au
873    """
874    
875    # Import the necessary modules.
876    from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend
877    from esys.pyvisi import Movie, LocalPosition
878    from esys.pyvisi.constant import *
879    import os
880    
881    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
882    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
883    X_SIZE = 800
884    Y_SIZE = 800
885    
886    SCALAR_FIELD_POINT_DATA = "temp"
887    FILE_2D = "tempvel-"
888    IMAGE_NAME = "movie"
889    JPG_RENDERER = Renderer.ONLINE_JPG
890    
891    # Create a Scene.
892    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
893            y_size = Y_SIZE)
894    
895    # Create a DataCollector reading from a XML file.
896    dc1 = DataCollector(source = Source.XML)
897    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
898    
899    # Create a Map.
900    m1 = Map(scene = s, data_collector = dc1,
901            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
902            outline = True)
903    
904    # Create a Camera.
905    cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
906    
907    # Create a movie.
908    mov = Movie()
909    #lst = []
910    
911    # Read in one file one after another and render the object.
912    for i in range(938, 949):
913        dc1.setFileName(file_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
914                FILE_2D + "%06d.vtu") % i)
915    
916        s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
917                IMAGE_NAME + "%06d.jpg") % i)
918    
919        #lst.append(IMAGE_NAME + "%06d.jpg" % i)
920    
921    # Images (first and last inclusive) from which the movie is to be generated.
922    mov.imageRange(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,
923            first_image = IMAGE_NAME + "000938.jpg",
924            last_image = IMAGE_NAME + "000948.jpg")
925    
926    # Alternatively, a list of images can be specified.
927    #mov.imageList(input_directory = PYVISI_EXAMPLE_IMAGES_PATH, image_list = lst)
928    
929    # Generate the movie.
930    mov.makeMovie(os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))
931    \end{python}
932    
933    
934  %##############################################################################  %##############################################################################
935    
# Line 775  Methods from \ImageReslice and \ActorTwo Line 937  Methods from \ImageReslice and \ActorTwo
937  \subsection{Coordinate Classes}  \subsection{Coordinate Classes}
938  This subsection details the instances used to position the rendered object.  This subsection details the instances used to position the rendered object.
939    
940    \subsubsection{\LocalPosition class}
941    
942  \begin{classdesc}{LocalPosition}{x_coor, y_coor}  \begin{classdesc}{LocalPosition}{x_coor, y_coor}
943  Class that defines the local positioning coordinate system (2D).  Class that defines the local positioning (X and Y) coordinate system (2D).
944  \end{classdesc}  \end{classdesc}
945    
946    \subsubsection{\GlobalPosition class}
947    
948  \begin{classdesc}{GlobalPosition}{x_coor, y_coor, z_coor}  \begin{classdesc}{GlobalPosition}{x_coor, y_coor, z_coor}
949  Class that defines the global positioning coordinate system (3D).  Class that defines the global positioning (X, Y and Z) coordinate system (3D).
950  \end{classdesc}  \end{classdesc}
951    
952    
# Line 788  Class that defines the global positionin Line 954  Class that defines the global positionin
954    
955    
956  \subsection{Supporting Classes}  \subsection{Supporting Classes}
957  This subsection details the supporting classes inherited by the data  This subsection details the supporting classes and their corresponding methods
958  visualization classes (see Section \ref{DATACOLLECTOR SEC}) and their  inherited by the input (see Section \ref{INPUT SEC}) and data
959  available methods.  visualization classes (see Section \ref{DATAVIS SEC}).
960    
961  \subsubsection{\ActorThreeD class}  \subsubsection{\ActorThreeD class}
962    Class that defines a 3D actor. \\
963    
964  The following are some of the methods available:  The following are some of the methods available:
965    
# Line 809  Set the representation of the 3D actor t Line 976  Set the representation of the 3D actor t
976  \end{methoddesc}  \end{methoddesc}
977    
978  \subsubsection{\ActorTwoD class}  \subsubsection{\ActorTwoD class}
979    Class that defines a 2D actor. \\
980    
981  The following are some of the methods available:  The following are some of the methods available:
982    
# Line 818  corner of the window / viewport. Line 986  corner of the window / viewport.
986  \end{methoddesc}  \end{methoddesc}
987    
988  \subsubsection{\Clipper class}  \subsubsection{\Clipper class}
989    Class that defines a clipper. \\
990    
991  The following are some of the methods available:  The following are some of the methods available:
992    
# Line 834  Set the scalar clip value (instead of us Line 1003  Set the scalar clip value (instead of us
1003  \end{methoddesc}  \end{methoddesc}
1004    
1005  \subsubsection{\ContourModule class}  \subsubsection{\ContourModule class}
1006    Class that defines the contour module. \\
1007    
1008  The following are some of the methods available:  The following are some of the methods available:
1009    
# Line 845  must be equal. Line 1015  must be equal.
1015  \end{methoddesc}  \end{methoddesc}
1016    
1017  \subsubsection{\GlyphThreeD class}  \subsubsection{\GlyphThreeD class}
1018    Class that defines 3D glyphs. \\
1019    
1020  The following are some of the methods available:  The following are some of the methods available:
1021    
# Line 861  Set the 3D glyph scale factor. Line 1032  Set the 3D glyph scale factor.
1032  \end{methoddesc}  \end{methoddesc}
1033    
1034  \subsubsection{\TensorGlyph class}  \subsubsection{\TensorGlyph class}
1035    Class that defines tensor glyphs. \\
1036    
1037  The following are some of the methods available:  The following are some of the methods available:
1038    
# Line 873  Set the maximum allowable scale factor f Line 1045  Set the maximum allowable scale factor f
1045  \end{methoddesc}  \end{methoddesc}
1046    
1047  \subsubsection{\PlaneSource class}  \subsubsection{\PlaneSource class}
1048    Class that defines a plane source.  A plane source is defined by an origin
1049    and two other points, which form the axes (X and Y). \\
1050    
1051  The following are some of the methods available:  The following are some of the methods available:
1052    
# Line 885  Set the second point from the origin of Line 1059  Set the second point from the origin of
1059  \end{methoddesc}  \end{methoddesc}
1060    
1061  \subsubsection{\PointSource class}  \subsubsection{\PointSource class}
1062    Class that defines the source (location) to generate points. The points are
1063    generated within the radius of a sphere. \\
1064    
1065  The following are some of the methods available:  The following are some of the methods available:
1066    
# Line 902  number of points, the more streamlines a Line 1078  number of points, the more streamlines a
1078  \end{methoddesc}  \end{methoddesc}
1079    
1080  \subsubsection{\Sphere class}  \subsubsection{\Sphere class}
1081    Class that defines a sphere. \\
1082    
1083  The following are some of the methods available:  The following are some of the methods available:
1084    
# Line 914  Set the phi resolution of the sphere. Line 1091  Set the phi resolution of the sphere.
1091  \end{methoddesc}  \end{methoddesc}
1092    
1093  \subsubsection{\StreamLineModule class}  \subsubsection{\StreamLineModule class}
1094    Class that defines the streamline module. \\
1095    
1096  The following are some of the methods available:  The following are some of the methods available:
1097    
# Line 927  goes) and backward (where the streamline Line 1105  goes) and backward (where the streamline
1105  \end{methoddesc}  \end{methoddesc}
1106    
1107  \subsubsection{\Transform class}  \subsubsection{\Transform class}
1108    Class that defines the orientation of planes. \\
1109    
1110  The following are some of the methods available:  The following are some of the methods available:
1111    
# Line 959  Set the plane orthogonal to the y-axis. Line 1138  Set the plane orthogonal to the y-axis.
1138  \end{methoddesc}  \end{methoddesc}
1139    
1140  \subsubsection{\Tube class}  \subsubsection{\Tube class}
1141    Class that defines the tube wrapped around the streamlines. \\
1142    
1143  The following are some of the methods available:  The following are some of the methods available:
1144    
# Line 975  Set the radius of the tube to vary by sc Line 1155  Set the radius of the tube to vary by sc
1155  \end{methoddesc}  \end{methoddesc}
1156    
1157  \subsubsection{\Warp class}  \subsubsection{\Warp class}
1158    Class that defines the deformation of a scalar field. \\
1159    
1160  The following are some of the methods available:  The following are some of the methods available:
1161    
# Line 983  Set the displacement scale factor. Line 1164  Set the displacement scale factor.
1164  \end{methoddesc}  \end{methoddesc}
1165    
1166  \subsubsection{\MaskPoints class}  \subsubsection{\MaskPoints class}
1167    Class that defines the masking of points
1168    every n'th point.  This is useful to prevent the rendered object
1169    from being cluttered with arrows or ellipsoids. \\
1170    
1171  The following are some of the methods available:  The following are some of the methods available:
1172    
1173  \begin{methoddesc}[MaskPoints]{setRatio}{ratio}  \begin{methoddesc}[MaskPoints]{setRatio}{ratio}
1174  Mask every nth point.  Mask every n'th point.
1175  \end{methoddesc}  \end{methoddesc}
1176    
1177  \begin{methoddesc}[MaskPoints]{randomOn}{}  \begin{methoddesc}[MaskPoints]{randomOn}{}
1178  Enables the randomization of the points selected for masking.  Enables the randomization of the points selected for masking.
1179  \end{methoddesc}  \end{methoddesc}
1180    
1181    \subsubsection{\ScalarBar class}
1182    Class that defines a scalar bar. \\
1183    
1184    The following are some of the methods available:
1185    
1186    \begin{methoddesc}[ScalarBar]{setTitle}{title}
1187    Set the title of the scalar bar.
1188    \end{methoddesc}
1189    
1190    \begin{methoddesc}[ScalarBar]{setPosition}{position}
1191    Set the local position of the scalar bar.
1192    \end{methoddesc}
1193    
1194    \begin{methoddesc}[ScalarBar]{setOrientationToHorizontal}{}
1195    Set the orientation of the scalar bar to horizontal.
1196    \end{methoddesc}
1197    
1198    \begin{methoddesc}[ScalarBar]{setOrientationToVertical}{}
1199    Set the orientation of the scalar bar to vertical.
1200    \end{methoddesc}
1201    
1202    \begin{methoddesc}[ScalarBar]{setHeight}{height}
1203    Set the height of the scalar bar.
1204    \end{methoddesc}
1205    
1206    \begin{methoddesc}[ScalarBar]{setWidth}{width}
1207    Set the width of the scalar bar.
1208    \end{methoddesc}
1209    
1210    \begin{methoddesc}[ScalarBar]{setLabelColor}{color}
1211    Set the color of the scalar bar's label.
1212    \end{methoddesc}
1213    
1214    \begin{methoddesc}[ScalarBar]{setTitleColor}{color}
1215    Set the color of the scalar bar's title.
1216    \end{methoddesc}
1217    
1218  \subsubsection{\ImageReslice class}  \subsubsection{\ImageReslice class}
1219    Class that defines an image reslice used to resize static
1220    (no interaction capability) images (i.e. logo). \\
1221    
1222  The following are some of the methods available:  The following are some of the methods available:
1223    
# Line 1003  Set the size of the image (logo in parti Line 1226  Set the size of the image (logo in parti
1226  displays the image in its original size (which is the default).  displays the image in its original size (which is the default).
1227  \end{methoddesc}  \end{methoddesc}
1228    
1229    \subsubsection{\DataSetMapper class}
1230    Class that defines a data set mapper. \\
1231    
1232    The following are some of the methods available:
1233    
1234    \begin{methoddesc}[DataSetMapper]{setScalarRange}{lower_range, upper_range}
1235    Set the minimum and maximum scalar range for the data set mapper. This
1236    method is called when the range has been specified by the user.
1237    Therefore, the scalar range read from the source will be ignored.
1238    \end{methoddesc}
1239    
1240    \subsubsection{\CubeSource class}
1241    Class that defines a cube source. The center of the cube source defines
1242    the point from which the cube is to be generated and the X, Y
1243    and Z lengths define the length of the cube from the center point. If
1244    X length is 3, then the X length to the left and right of the center
1245    point is 1.5 respectively.\\
1246    
1247    The following are some of the methods available:
1248    
1249    \begin{methoddesc}[CubeSource]{setCenter}{center}
1250    Set the cube source center.
1251    \end{methoddesc}
1252    
1253    \begin{methoddesc}[CubeSource]{setXLength}{length}
1254    Set the cube source length along the x-axis.
1255    \end{methoddesc}
1256    
1257    \begin{methoddesc}[CubeSource]{setYLength}{length}
1258    Set the cube source length along the y-axis.
1259    \end{methoddesc}
1260    
1261    \begin{methoddesc}[CubeSource]{setZLength}{length}
1262    Set the cube source length along the z-axis.
1263    \end{methoddesc}
1264    
1265    \subsubsection{\Rotation class}
1266    Class that sweeps 2D data around the z-axis to create a 3D looking effect. \\
1267    
1268    The following are some of the methods available:
1269    
1270    \begin{methoddesc}[Rotation]{setResolution}{resolution}
1271    Set the resolution of the sweep for the rotation, which controls the
1272    number of intermediate points
1273    \end{methoddesc}
1274    
1275    \begin{methoddesc}[Rotation]{setAngle}{angle}
1276    Set the angle of rotation.
1277    \end{methoddesc}
1278    
1279    
1280  % #############################################################################  % #############################################################################
1281    
# Line 1013  This section shows more examples. Line 1286  This section shows more examples.
1286  \textsf{Reading A Series of Files}  \textsf{Reading A Series of Files}
1287    
1288  \begin{python}  \begin{python}
1289    """
1290    Author: John Ngui, john.ngui@uq.edu.au
1291    """
1292    
1293  # Import the necessary modules.  # Import the necessary modules.
1294  from esys.pyvisi import Scene, DataCollector, Contour, Camera  from esys.pyvisi import Scene, DataCollector, Contour, Camera
1295  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 1026  Y_SIZE = 300 Line 1303  Y_SIZE = 300
1303  SCALAR_FIELD_POINT_DATA_1 = "lava"  SCALAR_FIELD_POINT_DATA_1 = "lava"
1304  SCALAR_FIELD_POINT_DATA_2 = "talus"  SCALAR_FIELD_POINT_DATA_2 = "talus"
1305  FILE_2D = "phi_talus_lava."  FILE_2D = "phi_talus_lava."
 FIRST_FILE_NAME = "phi_talus_lava.0099.vtu"  
1306    
1307  IMAGE_NAME = "seriesofreads"  IMAGE_NAME = "seriesofreads"
1308  JPG_RENDERER = Renderer.ONLINE_JPG  JPG_RENDERER = Renderer.ONLINE_JPG
# Line 1035  JPG_RENDERER = Renderer.ONLINE_JPG Line 1311  JPG_RENDERER = Renderer.ONLINE_JPG
1311  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1312          y_size = Y_SIZE)          y_size = Y_SIZE)
1313    
1314  # Create a DataCollector reading from a XML file. An initial file must always  # Create a DataCollector reading from a XML file.
 # be assigned when the DataCollector is created, although the same file is  
 # read again in the for-loop.    
1315  dc1 = DataCollector(source = Source.XML)  dc1 = DataCollector(source = Source.XML)
 dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \  
         FIRST_FILE_NAME))  
1316  dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)  dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
1317    
1318  # Create a Contour.  # Create a Contour.
# Line 1049  mosc1 = Contour(scene = s, data_collecto Line 1321  mosc1 = Contour(scene = s, data_collecto
1321          outline = True)          outline = True)
1322  mosc1.generateContours(0)  mosc1.generateContours(0)
1323    
1324  # Create a second DataCollector reading from the same XML file.  # Create a second DataCollector reading from the same XML file
1325    # but specifying a different scalar field.
1326  dc2 = DataCollector(source = Source.XML)  dc2 = DataCollector(source = Source.XML)
 dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \  
         FIRST_FILE_NAME))  
1327  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
1328    
1329  # Create a second Contour.  # Create a second Contour.
# Line 1078  for i in range(99, 104): Line 1349  for i in range(99, 104):
1349  \textsf{Manipulating A Single File with A Series of Translation}  \textsf{Manipulating A Single File with A Series of Translation}
1350    
1351  \begin{python}  \begin{python}
1352    """
1353    Author: John Ngui, john.ngui@uq.edu.au
1354    """
1355    
1356  # Import the necessary modules.  # Import the necessary modules.
1357  from esys.pyvisi import Scene, DataCollector, MapOnPlaneCut, Camera  from esys.pyvisi import Scene, DataCollector, MapOnPlaneCut, Camera
1358  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 1112  mopc1.setPlaneToYZ(offset = 0.1) Line 1387  mopc1.setPlaneToYZ(offset = 0.1)
1387  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
1388  c1.isometricView()  c1.isometricView()
1389    
1390  # Render the object with multiple cuts from a series of translation.  # Render the object with multiple cuts using a series of translation.
1391  for i in range(0, 5):  for i in range(0, 5):
1392      s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME +      s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME +
1393              "%02d.jpg") % i)              "%02d.jpg") % i)
1394      mopc1.translate(0.6,0,0)      mopc1.translate(0.6,0,0)
1395  \end{python}  \end{python}
1396    
1397    \textsf{Reading Data Directly from Escript Objects}
1398    
1399    \begin{python}
1400    """
1401    Author: Lutz Gross, l.gross@uq.edu.au
1402    Author: John Ngui, john.ngui@uq.edu.au
1403    """
1404    
1405    # Import the necessary modules.
1406    from esys.escript import *
1407    from esys.escript.linearPDEs import LinearPDE
1408    from esys.finley import Rectangle
1409    from esys.pyvisi import Scene, DataCollector, Map, Camera
1410    from esys.pyvisi.constant import *
1411    import os
1412    
1413    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
1414    X_SIZE = 400
1415    Y_SIZE = 400
1416    JPG_RENDERER = Renderer.ONLINE_JPG
1417    
1418    #... set some parameters ...
1419    xc=[0.02,0.002]
1420    r=0.001
1421    qc=50.e6
1422    Tref=0.
1423    rhocp=2.6e6
1424    eta=75.
1425    kappa=240.
1426    tend=5.
1427    # ... time, time step size and counter ...
1428    t=0
1429    h=0.1
1430    i=0
1431    
1432    #... generate domain ...
1433    mydomain = Rectangle(l0=0.05,l1=0.01,n0=250, n1=50)
1434    #... open PDE ...
1435    mypde=LinearPDE(mydomain)
1436    mypde.setSymmetryOn()
1437    mypde.setValue(A=kappa*kronecker(mydomain),D=rhocp/h,d=eta,y=eta*Tref)
1438    # ... set heat source: ....
1439    x=mydomain.getX()
1440    qH=qc*whereNegative(length(x-xc)-r)
1441    # ... set initial temperature ....
1442    T=Tref
1443    
1444    # Create a Scene.
1445    s = Scene(renderer = JPG_RENDERER, x_size = X_SIZE, y_size = Y_SIZE)
1446    
1447    # Create a DataCollector reading directly from escript objects.
1448    dc = DataCollector(source = Source.ESCRIPT)
1449    
1450    # Create a Map.
1451    m = Map(scene = s, data_collector = dc, \
1452            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, \
1453            cell_to_point = False, outline = True)
1454    
1455    # Create a Camera.
1456    c = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
1457    
1458    # ... start iteration:
1459    while t<0.4:
1460          i+=1
1461          t+=h
1462          mypde.setValue(Y=qH+rhocp/h*T)
1463          T=mypde.getSolution()
1464    
1465          dc.setData(temp = T)
1466          
1467          # Render the object.
1468          s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
1469                  "diffusion%02d.jpg") % i)
1470    \end{python}
1471    
1472    \newpage
1473    
1474  \section{Useful Keys}  \section{Useful Keys}
1475  This section shows some of the useful keys when interacting with the rendered  This section shows some of the useful keys when interacting with the rendered
1476  object.  object (in the Online approach).
1477    
1478  \begin{table}[h]  \begin{table}[ht]
1479  \begin{center}  \begin{center}
1480  \begin{tabular}{| c | p{13cm} |}  \begin{tabular}{| c | p{13cm} |}
1481  \hline  \hline
# Line 1147  Keypress 's' & Modify the representation Line 1499  Keypress 's' & Modify the representation
1499  \\ \hline  \\ \hline
1500  Keypress 'w' & Modify the representation of the rendered object to wireframe.  Keypress 'w' & Modify the representation of the rendered object to wireframe.
1501  \\ \hline  \\ \hline
1502    Keypress 'r' & Reset the position of the rendered object to the center.
1503    \\ \hline
1504  \end{tabular}  \end{tabular}
1505    \caption{Useful keys}
1506  \end{center}  \end{center}
1507  \end{table}  \end{table}
1508    
# Line 1155  Keypress 'w' & Modify the representation Line 1510  Keypress 'w' & Modify the representation
1510  % ############################################################################  % ############################################################################
1511    
1512    
1513    \newpage
1514    
1515  \section{Sample Output}  \section{Sample Output}
1516  This section displays thumbnails of sample output.    This section displays some of the sample output by Pyvisi.  
1517    
1518  \begin{table}[h]  \begin{table}[ht]
1519  \begin{tabular}{c c c}  \begin{tabular}{c c c}
1520  \includegraphics[width=\thumbnailwidth]{figures/Map} &  \includegraphics[width=\thumbnailwidth]{figures/Map} &
1521  \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} &  \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} &
1522  \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneClip} \\  \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneClip} \\
1523  Map & MapOnPlaneCut & MapOnPlaneClip \\  Map & MapOnPlaneCut & MapOnPlaneClip \\
1524  \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClip} &  \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClip} &
1525  \includegraphics[width=\thumbnailwidth]{figures/Velocity} &  \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClipWithRotation} &
1526  \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneCut}  \\  \includegraphics[width=\thumbnailwidth]{figures/Velocity} \\
1527  MapOnScalarClip & Velocity & VelocityOnPlaneCut \\  MapOnScalarClip & MapOnScalarClipWithRotation & Velocity \\ \\ \\ \\
1528    \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneCut} &
1529  \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneClip} &  \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneClip} &
1530  \includegraphics[width=\thumbnailwidth]{figures/Ellipsoid} &  \includegraphics[width=\thumbnailwidth]{figures/Ellipsoid} \\
1531  \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneCut}  \\  VelocityOnPlaneCut & VelocityOnPlaneClip & Ellipsoid \\ \\ \\ \\
1532  VelocityOnPlaneClip & Ellipsoid & EllipsoidOnPlaneCut \\  \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneCut} &
1533  \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneClip} &  \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneClip} \\
1534  \includegraphics[width=\thumbnailwidth]{figures/Contour} &  EllipsoidOnPlaneCut & EllipsoidOnPlaneClip \\ \\ \\ \\
 \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneCut}  \\  
 EllipsoidOnPlaneClip & Contour & ContourOnPlaneCut \\  
 \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneClip} &  
 \includegraphics[width=\thumbnailwidth]{figures/StreamLine} &  
 \includegraphics[width=\thumbnailwidth]{figures/Carpet}  \\  
 ContourOnPlaneClip & StreamLine & Carpet \\  
1535  \end{tabular}  \end{tabular}
1536  \caption{Sample output}  \caption{Sample output}
1537  \end{table}  \end{table}
1538    
1539    \begin{table}[t]
1540    \begin{tabular}{c c c}
1541    \includegraphics[width=\thumbnailwidth]{figures/Contour} &
1542    \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneCut} &
1543    \includegraphics[width=\thumbnailwidth]{figures/ContourOnPlaneClip} \\
1544    Contour & ContourOnPlaneCut & ContourOnPlaneClip\\ \\  
1545    \includegraphics[width=\thumbnailwidth]{figures/StreamLine} &
1546    \includegraphics[width=\thumbnailwidth]{figures/Carpet} &
1547    \includegraphics[width=\thumbnailwidth]{figures/Rectangle} \\
1548    Streamline & Carpet & Rectangle \\ \\ \\
1549    \includegraphics[width=\thumbnailwidth]{figures/Text} &
1550    \includegraphics[width=\thumbnailwidth]{figures/Logo} &
1551    \includegraphics[width=\thumbnailwidth]{figures/Image} \\
1552    Text & Logo & Image \\ \\
1553    \includegraphics[width=\thumbnailwidth]{figures/Legend} \\
1554    Legend \\ \\
1555    \end{tabular}
1556    \caption{Sample Output}
1557    \end{table}
1558    
1559    

Legend:
Removed from v.1154  
changed lines
  Added in v.1318

  ViewVC Help
Powered by ViewVC 1.1.26