/[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 889 by jongui, Tue Nov 7 23:42:31 2006 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}
4    \modulesynopsis{Python Visualization Interface}
5    
6  \declaremodule{extension}{pyvisi}  \section{Introduction}
7  \modulesynopsis{Python visualization interface}  \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
9  \pyvisi provides an easy to use interface to the \VTK visualization  an easy to use interface to the \VTK library (\VTKUrl). Pyvisi can be used to
10  tool. \pyvisi provides the following modules:  render (generate) surface maps and contours for scalar fields, arrows and
11    streamlines for vector fields, and ellipsoids for tensor fields.  
12  \begin{itemize}  There are three
13  \item \Scene: Shows a scene in which components are to be displayed.  approaches for rendering an object. (1) Online - object is rendered on-screen
14  \item \Image: Shows an image.  with interaction capability (i.e. zoom and rotate), (2) Offline - object is
15  \item \Text: Shows some 2D text.  rendered off-screen (no pop-up window) and (3) Display - object is rendered
16  \item \DataCollector: Deals with data for visualization.  on-screen but with no interaction capability (on-the-fly
17  \item \Camera: Controls the camera manipulation.  animation). All three approaches have the option to save the rendered object
18  \item \Light: Controls the light manipulation.  as an image (i.e. jpg) and subsequently converting a series of images into a
19  \item \Map: Shows a scalar field by color on the domain surface.  movie (.mpg).
20  \item \MapOnPlane: Shows a scalar field by color on a given plane.  
21  \item \MapOnClip: Shows a scalar field by color on a given clip.  The following outlines the general steps to use Pyvisi:
22  \item \MapOnScalarClip: Shows a scalar field by color on a give scalar clip.  
23  \item \Arrows: Shows a vector field by arrows.  \begin{enumerate}
24  \item \ArrowsOnPlane: Shows a vector field by arrows on a given plane.  \item Create a \Scene instance - a window in which objects are to be
25  \item \ArrowsOnClip: Shows a vector field by arrows on a given clip.  rendered on.
26  \item \IsoSurface: Shows a scalar field for a given value by  \item Create a data input instance (i.e. \DataCollector or \ImageReader) -
27  an isosurface.  reads and loads the source data for visualization.
28  \item \IsoSurfaceOnPlane: Shows a scalar field for a given value by  \item Create a data visualization instance (i.e. \Map, \Velocity, \Ellipsoid,
29  an isosurfaceon a given plane.  \Contour, \Carpet, \StreamLine or \Image) -  processes and manipulates
30  \item \IsoSurfaceOnClip: Shows a scalar field for a given vlaue by  the source data.
31  an isosurface on a given clip.  \item Create a \Camera or \Light instance - controls the viewing angle and
32  \item \Contour: Shows a scalar field by contour surfaces.  lighting effects.
33  \item \ContourOnPlane: Shows a scalar field by contour surfaces on  \item Render the object - using either the Online, Offline or Display approach.
34  a given plane.  \item Generate movie - converts a series of images into a movie.
35  \item \ContourOnClip: Shows a scalar field by contour surfaces on  \end{enumerate}
36  a given clip.  \begin{center}
37  \item \TensorC: Shows a tensor field by ellipsoids.  \begin{math}
38  \item \TensorOnPlane: Shows a tensor field by ellipsoids on  scene \rightarrow data \; input \rightarrow data \; visualization \rightarrow
39  a given plane.  camera \, / \, light \rightarrow render \rightarrow movie
40  \item \TensorOnClip: Shows a tensor field by ellipsoids on a given clip.  \end{math}
41  \item \StreamLines: Shows the path of particles in a vector field.  \end{center}
42  \item \Carpet: Shows a scalar field as plane deformated along  
43  the plane normal.  \section{\pyvisi Classes}
44  \item \Position: Defines the x,y and z coordinates rendered object.  The following subsections give a brief overview of the important classes
45  \item \Transform: Defines the orientation of rendered object.  and some of their corresponding methods. Please refer to \ReferenceGuide for
46  \item \Style: Defines the style of text.  full details.
47  \item \BlueToRed: Defines a map spectrum from blue to red.  
48  \item \RedToBlue: Defines a map spectrum from red to blue.  
49  \item \Plane: Defines the cutting/clipping of rendered objects.  %#############################################################################
50  \end{itemize}  
51    
52  \section{\Scene class}  \subsection{Scene Classes}
53  \begin{classdesc}{Scene}{renderer, x_size = 500, y_size = 500}  This subsection details the instances used to setup the viewing environment.
54  A \Scene object creates a window onto which objects are to be displayed.  
55  \end{classdesc}  \subsubsection{\Scene class}
56    
57  The following are the methods available:  \begin{classdesc}{Scene}{renderer = Renderer.ONLINE, num_viewport = 1,
58  \begin{methoddesc}[Scene]{saveImage}{image_name}  x_size = 1152, y_size = 864}
59  Save the rendered object as an image off-screen.  A scene is a window in which objects are to be rendered on. Only
60  \end{methoddesc}  one scene needs to be created. However, a scene may be divided into four
61    smaller windows called viewports (if needed). Each viewport in turn can
62  \begin{methoddesc}[Scene]{render}{}  render a different object.
 Render the object on-screen.  
 \end{methoddesc}  
   
 The following is a sample code using the \Scene class:  
 \verbatiminput{../examples/driverscene.py}  
   
 \section{\Image class}  
 \begin{classdesc}{Image}{scene, format}  
 An \Image object shows an image.  
 \end{classdesc}  
   
 The following is the method available:  
 \begin{methoddesc}[Image]{setFileName}{file_name}  
 Set the file name.  
 \end{methoddesc}  
   
 The following is a sample code using the \Image class.  
 \fig{fig:image.1} shows the corresponding output.  
 \verbatiminput{../examples/driverimage.py}  
   
 \begin{figure}[ht]  
 \begin{center}  
 \includegraphics[width=40mm]{figures/Image}  
 \end{center}  
 \caption{Image}  
 \label{fig:image.1}  
 \end{figure}  
   
 \section{\Text class}  
 \begin{classdesc}{Text}{scene}  
 A \Text object shows 2D text.  
63  \end{classdesc}  \end{classdesc}
64    
65  The following are the methods available:  The following are some of the methods available:
66  \begin{methoddesc}[Text]{setText}{text}  \begin{methoddesc}[Scene]{setBackground}{color}
67  Set the text.  Set the background color of the scene.
 \end{methoddesc}  
   
 \begin{methoddesc}[Text]{setPosition}{x_coor, y_coor}  
 Set the display position of the text.  
68  \end{methoddesc}  \end{methoddesc}
69    
70  \begin{methoddesc}[Text]{setStyle}{style}  \begin{methoddesc}[Scene]{render}{image_name = None}
71  Set the style of the text.  Render the object using either the Online, Offline or Display mode.
72  \end{methoddesc}  \end{methoddesc}
73    
74  The following is a sample code using the \Text class.  \subsubsection{\Camera class}
 \fig{fig:text.1} shows the corresponding output.  
 \verbatiminput{../examples/drivertext.py}  
75    
76  \begin{figure}[ht]  \begin{classdesc}{Camera}{scene, viewport = Viewport.SOUTH_WEST}
77  \begin{center}  A camera controls the display angle of the rendered object and one is
78  \includegraphics[width=40mm]{figures/Text}  usually created for a \Scene. However, if a \Scene has four viewports, then a
79  \end{center}  separate camera may be created for each viewport.
 \caption{2D text}  
 \label{fig:text.1}  
 \end{figure}  
   
 \section{\DataCollector class}  
 \begin{classdesc}{DataCollector}{scene, outline = True, cube_axes = False}  
 A \DataCollector object deals with the data for visualization.  
 \end{classdesc}  
   
 The following are the methods available:  
 \begin{methoddesc}[DataCollector]{setFileName}{file_name}  
 Set the file name from which data is to be read.  
 \end{methoddesc}  
   
 The following is a sample code using the \DataCollector class.  
 \fig{fig:datacollector.1} shows the corresponding output.  
 \verbatiminput{../examples/driverdatacollector.py}  
   
 \begin{figure}[ht]  
 \begin{center}  
 \includegraphics[width=40mm]{figures/DataCollector}  
 \end{center}  
 \caption{Datacollector generating an outline with cube axes.}  
 \label{fig:datacollector.1}  
 \end{figure}  
   
 \section{\Camera class}  
 \begin{classdesc}{Camera}{scene, data_collector}  
 A \Camera object controls the camera's settings.  
80  \end{classdesc}  \end{classdesc}
81    
82  The following are some of the methods available:  The following are some of the methods available:
# Line 157  Rotate the camera to the left and right. Line 93  Rotate the camera to the left and right.
93  \end{methoddesc}  \end{methoddesc}
94    
95  \begin{methoddesc}[Camera]{elevation}{angle}  \begin{methoddesc}[Camera]{elevation}{angle}
96  Rotate the camera to the top and bottom.  Rotate the camera to the top and bottom (only between -90 and 90).
 \end{methoddesc}  
   
 \begin{methoddesc}[Camera]{roll}{angle}  
 Roll the camera to the left and right.  
97  \end{methoddesc}  \end{methoddesc}
98    
99  \begin{methoddesc}[Camera]{backView}{}  \begin{methoddesc}[Camera]{backView}{}
100  View the back of the rendered object.  Rotate the camera to view the back of the rendered object.
101  \end{methoddesc}  \end{methoddesc}
102    
103  \begin{methoddesc}[Camera]{topView}{}  \begin{methoddesc}[Camera]{topView}{}
104  View the top of the rendered object.  Rotate the camera to view the top of the rendered object.
105  \end{methoddesc}  \end{methoddesc}
106    
107  \begin{methoddesc}[Camera]{bottomView}{}  \begin{methoddesc}[Camera]{bottomView}{}
108  View the bottom of the rendered object.  Rotate the camera to view the bottom of the rendered object.
109  \end{methoddesc}  \end{methoddesc}
110    
111  \begin{methoddesc}[Camera]{leftView}{}  \begin{methoddesc}[Camera]{leftView}{}
112  View the left side of the rendered object.  Rotate the camera to view the left side of the rendered object.
113  \end{methoddesc}  \end{methoddesc}
114    
115  \begin{methoddesc}[Camera]{rightView}{}  \begin{methoddesc}[Camera]{rightView}{}
116  View the right side of the rendered object.  Rotate the camera to view the right side of the rendered object.
117  \end{methoddesc}  \end{methoddesc}
118    
119  \begin{methoddesc}[Camera]{isometricView}{}  \begin{methoddesc}[Camera]{isometricView}{}
120  View the isometric side of the rendered object.  Rotate the camera to view the isometric angle of the rendered object.
121  \end{methoddesc}  \end{methoddesc}
122    
123  The following is a sample code using the \Camera class.  \begin{methoddesc}[Camera]{dolly}{distance}
124  \fig{fig:camera.1} shows the corresponding output.  Move the camera towards (greater than 1) the rendered object. However,
125  \verbatiminput{../examples/drivercamera.py}  the camera is unable to be moved away from the rendered object.
126    \end{methoddesc}
127    
128  \begin{figure}[ht]  \subsubsection{\Light class}
 \begin{center}  
 \includegraphics[width=30mm]{figures/Camera}  
 \end{center}  
 \caption{Camera manipulation}  
 \label{fig:camera.1}  
 \end{figure}  
129    
130  \section{\Light class}  \begin{classdesc}{Light}{scene, viewport = Viewport.SOUTH_WEST}
131  \begin{classdesc}{Light}{scene, data_collector}  A light controls the lighting effect for the rendered object and works in
132  A \Light object controls the light's settings.  a similar way to \Camera.
133  \end{classdesc}  \end{classdesc}
134    
135  The following are the methods available:  The following are some of the methods available:
136  \begin{methoddesc}[Light]{setColor}{color}  \begin{methoddesc}[Light]{setColor}{color}
137  Set the color of the light.  Set the light color.
138  \end{methoddesc}  \end{methoddesc}
139    
140  \begin{methoddesc}[Light]{setFocalPoint}{position}  \begin{methoddesc}[Light]{setFocalPoint}{position}
# Line 218  Set the focal point of the light. Line 145  Set the focal point of the light.
145  Set the position of the light.  Set the position of the light.
146  \end{methoddesc}  \end{methoddesc}
147    
148  \begin{methoddesc}[Light]{setIntensity}{intesity}  \begin{methoddesc}[Light]{setAngle}{elevation = 0, azimuth = 0}
149  Set the intensity (brightness) of the light.  An alternative to set the position and focal point of the light by using the
150    elevation and azimuth.
151  \end{methoddesc}  \end{methoddesc}
152    
 The following is a sample code using the \Light class.  
 \fig{fig:light.1} shows the corresponding output.  
 \verbatiminput{../examples/driverlight.py}  
153    
154  \begin{figure}[ht]  %##############################################################################
 \begin{center}  
 \includegraphics[width=40mm]{figures/Light}  
 \end{center}  
 \caption{Light}  
 \label{fig:light.1}  
 \end{figure}  
155    
 \section{\Map class}  
 \begin{classdesc}{Map}{scene, data_collector, lut = None}  
 A \Map object shows a scalar field by color on the domain surface.  
 \end{classdesc}  
156    
157  The following is a sample code using the \Map class.  \subsection{Input Classes}
158  \fig{fig:map.1} shows the corresponding output.  \label{INPUT SEC}
159  \verbatiminput{../examples/drivermap.py}  This subsection details the instances used to read and load the source data
160    for visualization.
 \begin{figure}[ht]  
 \begin{center}  
 \includegraphics[width=40mm]{figures/Map}  
 \end{center}  
 \caption{Surface map}  
 \label{fig:map.1}  
 \end{figure}  
161    
162  \section{\MapOnPlane class}  \subsubsection{\DataCollector class}
163  \begin{classdesc}{MapOnPlane}{scene, data_collector, transform, lut = None}  \begin{classdesc}{DataCollector}{source = Source.XML}
164  A \MapOnPlane object show a scalar field by color on a given plane.  A data collector is used to read data either from a XML file (using
165    \texttt{setFileName()}) or from an escript object directly (using
166    \texttt{setData()}). Writing XML files are expensive, but this approach has
167    the advantage given that the results can be analyzed easily after the
168    simulation has completed.  
169  \end{classdesc}  \end{classdesc}
170    
171  The following is a sample code using the \MapOnPlane class.  The following are some of the methods available:
172  \fig{fig:maponplane.1} shows the corresponding output.  \begin{methoddesc}[DataCollector]{setFileName}{file_name}
173  \verbatiminput{../examples/drivermaponplane.py}  Set the XML file name to read.
174    \end{methoddesc}
175    
176  \begin{figure}[ht]  \begin{methoddesc}[DataCollector]{setData}{**args}
177  \begin{center}  Create data using the \textless name\textgreater=\textless data\textgreater
178  \includegraphics[width=40mm]{figures/MapOnPlane}  pairing. Assumption is made that the data will be given in the
179  \end{center}  appropriate format.
180  \caption{Surface map on a plane}  \end{methoddesc}
 \label{fig:maponplane.1}  
 \end{figure}  
181    
182  \section{\MapOnClip class}  \begin{methoddesc}[DataCollector]{setActiveScalar}{scalar}
183  \begin{classdesc}{MapOnClip}{scene, data_collector, transform, lut = None}  Specify the scalar field to load.
184  A \MapOnClip object show a scalar field by color on a given clip.  \end{methoddesc}
185  \end{classdesc}  
186    \begin{methoddesc}[DataCollector]{setActiveVector}{vector}
187    Specify the vector field to load.
188    \end{methoddesc}
189    
190  The following is a sample code using the \MapOnClip class.  \begin{methoddesc}[DataCollector]{setActiveTensor}{tensor}
191  \fig{fig:maponclip.1} shows the corresponding output.  Specify the tensor field to load.
192  \verbatiminput{../examples/drivermaponclip.py}  \end{methoddesc}
193    
194  \begin{figure}[ht]  \subsubsection{\ImageReader class}
 \begin{center}  
 \includegraphics[width=40mm]{figures/MapOnClip}  
 \end{center}  
 \caption{Surface map on a clip}  
 \label{fig:maponclip.1}  
 \end{figure}  
195    
196  \section{\MapOnScalarClip class}  \begin{classdesc}{ImageReader}{format}
197  \begin{classdesc}{MapOnScalarClip}{scene, data_collector, lut = None}  An image reader is used to read data from an image in a variety of formats.
 A \MapOnScalarClip object show a scalar field by color on a given scalar clip.  
198  \end{classdesc}  \end{classdesc}
199    
200  The following is a sample code using the \MapOnScalarClip class.  The following are some of the methods available:
201  \fig{fig:maponscalarclip.1} shows the corresponding output.  \begin{methoddesc}[ImageReader]{setImageName}{image_name}
202  \verbatiminput{../examples/drivermaponscalarclip.py}  Set the image name to be read.
203    \end{methoddesc}
204    
205  \begin{figure}[ht]  \subsubsection{\TextTwoD class}
 \begin{center}  
 \includegraphics[width=40mm]{figures/MapOnScalarClip}  
 \end{center}  
 \caption{Surface map on a scalar clip}  
 \label{fig:maponscalarclip.1}  
 \end{figure}  
206    
207  \section{\Arrows class}  \begin{classdesc}{Text2D}{scene, text, viewport = Viewport.SOUTH_WEST}
208  \begin{classdesc}{Arrows}{scene, data_collector, lut = None}  A two-dimensional text is used to annotate the rendered object
209  A \Arrows object shows a vector field by arrows.  (i.e. inserting titles, authors and labels).
210  \end{classdesc}  \end{classdesc}
211    
212  The following are the methods available:  The following are some of the methods available:
213  \begin{methoddesc}[Arrows]{setVectorMode}{vector_mode}  \begin{methoddesc}[Text2D]{setFontSize}{size}
214  Set the arrows vector mode.  Set the 2D text size.
215  \end{methoddesc}  \end{methoddesc}
216    
217  \begin{methoddesc}[Arrows]{setScaleMode}{scale_mode}  \begin{methoddesc}[Text2D]{boldOn}{}
218  Set the arrows scale mode.  Bold the 2D text.
219  \end{methoddesc}  \end{methoddesc}
220    
221  \begin{methoddesc}[Arrows]{setScaleFactor}{scale_factor}  \begin{methoddesc}[Text2D]{setColor}{color}
222  Set the arrows scale factor.  Set the color of the 2D text.
223  \end{methoddesc}  \end{methoddesc}
224    
225  \begin{methoddesc}[Arrows]{setColorMode}{color_mode}  Including methods from \ActorTwoD.
 Set the arrows color mode.  
 \end{methoddesc}  
226    
 The following is a sample code using the \Arrows class.  
 \fig{fig:arrows.1} shows the corresponding output.  
 \verbatiminput{../examples/driverarrows.py}  
227    
228  \begin{figure}[ht]  %##############################################################################
229  \begin{center}  
230  \includegraphics[width=40mm]{figures/Arrows}  
231  \end{center}  \subsection{Data Visualization Classes}
232  \caption{Arrows}  \label{DATAVIS SEC}
233  \label{fig:arrows.1}  This subsection details the instances used to process and manipulate the source
234  \end{figure}  data. The typical usage of some of the classes are also shown.
235    
236    One point to note is that the source can either be point or cell data. If the
237    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.
239    If a conversion is needed, the 'cell_to_point' flag (see below) must
240    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}
244    
245  \section{\ArrowsOnPlane class}  \begin{classdesc}{Map}{scene, data_collector,
246  \begin{classdesc}{ArrowsOnPlane}{scene, data_collector, transform, lut = None}  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
247  A \ArrowsOnPlane object shows a vector field by arrows on a given plane.  outline = True}
248    Class that shows a scalar field on a domain surface. The domain surface
249    can either be color or gray-scale, depending on the lookup table used.
250  \end{classdesc}  \end{classdesc}
251    
252  The following is a sample code using the \ArrowsOnPlane class.  The following are some of the methods available:\\
253  \fig{fig:arrowsonplane.1} shows the corresponding output.  Methods from \ActorThreeD and \DataSetMapper.
 \verbatiminput{../examples/driverarrowsonplane.py}  
254    
255  \begin{figure}[ht]  A typical usage of \Map is shown below.
256  \begin{center}  
257  \includegraphics[width=40mm]{figures/ArrowsOnPlane}  \begin{python}
258  \end{center}  """
259  \caption{Arrows on a plane}  Author: John Ngui, john.ngui@uq.edu.au
260  \label{fig:arrowsonplane.1}  """
261  \end{figure}  
262    # Import the necessary modules.
263    from esys.pyvisi import Scene, DataCollector, Map, Camera
264    from esys.pyvisi.constant import *
265    import os
266    
267    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
268    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
269    X_SIZE = 800
270    Y_SIZE = 800
271    
272  \section{\ArrowsOnClip class}  SCALAR_FIELD_POINT_DATA = "temperature"
273  \begin{classdesc}{ArrowsOnClip}{scene, data_collector, transform, lut = None}  SCALAR_FIELD_CELL_DATA = "temperature_cell"
274  A \ArrowsOnClip object shows a vector field by arrows on a given clip.  FILE_3D = "interior_3D.xml"
275    IMAGE_NAME = "map.jpg"
276    JPG_RENDERER = Renderer.ONLINE_JPG
277    
278    # Create a Scene with four viewports.
279    s = Scene(renderer = JPG_RENDERER, num_viewport = 4, x_size = X_SIZE,
280            y_size = Y_SIZE)
281    
282    # Create a DataCollector reading from a XML file.
283    dc1 = DataCollector(source = Source.XML)
284    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
285    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
286    
287    # Create a  Map for the first viewport.
288    m1 = Map(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST,
289            lut = Lut.COLOR, cell_to_point = False, outline = True)
290    m1.setRepresentationToWireframe()
291    
292    # Create a Camera for the first viewport
293    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
294    c1.isometricView()
295    
296    # Create a second DataCollector reading from the same XML file but specifying
297    # a different scalar field.
298    dc2 = DataCollector(source = Source.XML)
299    dc2.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
300    dc2.setActiveScalar(scalar = SCALAR_FIELD_CELL_DATA)
301    
302    # Create a Map for the third viewport.
303    m2 = Map(scene = s, data_collector = dc2, viewport = Viewport.NORTH_EAST,
304            lut = Lut.COLOR, cell_to_point = True, outline = True)
305    
306    # Create a Camera for the third viewport
307    c2 = Camera(scene = s, viewport = Viewport.NORTH_EAST)
308    
309    # Render the object.
310    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
311    \end{python}
312    
313    \subsubsection{\MapOnPlaneCut class}
314    
315    \begin{classdesc}{MapOnPlaneCut}{scene, data_collector,
316    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
317    outline = True}
318    This class works in a similar way to \Map, except that it shows a scalar
319    field cut using a plane. The plane can be translated and rotated along the
320    X, Y and Z axes.
321  \end{classdesc}  \end{classdesc}
322    
323  The following is a sample code using the \ArrowsOnClip class.  The following are some of the methods available:\\
324  \fig{fig:arrowsonclip.1} shows the corresponding output.  Methods from \ActorThreeD, \Transform and \DataSetMapper.
 \verbatiminput{../examples/driverarrowsonclip.py}  
325    
326  \begin{figure}[ht]  \subsubsection{\MapOnPlaneClip class}
327  \begin{center}  
328  \includegraphics[width=40mm]{figures/ArrowsOnClip}  \begin{classdesc}{MapOnPlaneClip}{scene, data_collector,
329  \end{center}  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
330  \caption{Arrows on a clip}  outline = True}
331  \label{fig:arrowsonclip.1}  This class works in a similar way to \MapOnPlaneCut, except that it shows a
332  \end{figure}  scalar field clipped using a plane.
333    \end{classdesc}
334    
335    The following are some of the methods available:\\
336    Methods from \ActorThreeD, \Transform, \Clipper and \DataSetMapper.
337    
338    \subsubsection{\MapOnScalarClip class}
339    
340  \section{\IsoSurface class}  \begin{classdesc}{MapOnScalarClip}{scene, data_collector,
341  \begin{classdesc}{IsoSurface}{scene, data_collector, lut = None}  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
342  An \IsoSurface object shows a scalar field for a given value by an isosurface.  outline = True}
343    This class works in a similar way to \Map, except that it shows a scalar
344    field clipped using a scalar value.
345  \end{classdesc}  \end{classdesc}
346    
347  The following is the method available:  The following are some of the methods available:\\
348    Methods from \ActorThreeD, \Clipper and \DataSetMapper.
349    
350  \begin{methoddesc}[IsoSurface]{setValue}{contour_number, value}  \subsubsection{\MapOnScalarClipWithRotation class}
 Set the contour number and value.  
 \end{methoddesc}  
351    
352  The following is a sample code using the \IsoSurface class.  \begin{classdesc}{MapOnScalarClipWithRotation}{scene, data_collector,
353  \fig{fig:isosurface.1} shows the corresponding output.  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False}
354  \verbatiminput{../examples/driverisosurface.py}  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  \begin{figure}[ht]  The following are some of the methods available:\\
361  \begin{center}  Methods from \ActorThreeD, \Clipper, \Rotation and \DataSetMapper.
 \includegraphics[width=40mm]{figures/IsoSurface}  
 \end{center}  
 \caption{IsoSurface}  
 \label{fig:isosurface.1}  
 \end{figure}  
   
 \section{\IsoSurfaceOnPlane class}  
 \begin{classdesc}{IsoSurfaceOnPlane}{scene, data_collector, transform,  
 lut = None}  
 An \IsoSurfaceOnPlane object shows a scalar field for a given value  
 by an isosurface on a given plane.  
 \end{classdesc}  
   
 The following is a sample code using the \IsoSurfaceOnPlane class.  
 \fig{fig:isosurfaceonplane.1} shows the corresponding output.  
 \verbatiminput{../examples/driverisosurfaceonplane.py}  
362    
363  \begin{figure}[ht]  \subsubsection{\Velocity class}
 \begin{center}  
 \includegraphics[width=40mm]{figures/IsoSurfaceOnPlane}  
 \end{center}  
 \caption{IsoSurface on a plane}  
 \label{fig:isosurfaceonplane.1}  
 \end{figure}  
   
 \section{\IsoSurfaceOnClip class}  
 \begin{classdesc}{IsoSurfaceOnClip}{scene, data_collector, transform,  
 lut = None}  
 An \IsoSurfaceOnClip object shows a scalar field for a given value  
 by an isosurface on a given clip.  
 \end{classdesc}  
   
 The following is a sample code using the \IsoSurfaceOnClip class.  
 \fig{fig:isosurfaceonclip.1} shows the corresponding output.  
 \verbatiminput{../examples/driverisosurfaceonclip.py}  
364    
365  \begin{figure}[ht]  \begin{classdesc}{Velocity}{scene, data_collector, arrow = Arrow.TWO_D,
366  \begin{center}  color_mode = ColorMode.VECTOR, viewport = Viewport.SOUTH_WEST,  
367  \includegraphics[width=40mm]{figures/IsoSurfaceOnClip}  lut = Lut.COLOR, cell_to_point = False, outline = True}
368  \end{center}  Class that shows a vector field using arrows. The arrows can either be
369  \caption{IsoSurface on a clip}  color or gray-scale, depending on the lookup table used. If the arrows
370  \label{fig:isosurfaceonclip.1}  are colored, there are two possible coloring modes, either using vector data or
371  \end{figure}  scalar data. Similarly, there are two possible types of arrows, either
372    using two-dimensional or three-dimensional.
 \section{\Contour class}  
 \begin{classdesc}{Contour}{scene, data_collector, lut = None}  
 A \Contour object shows a scalar field contour surfaces.  
373  \end{classdesc}  \end{classdesc}
374    
375  The following is the method available:  The following are some of the methods available:\\
376  \begin{methoddesc}[Contour]{generateValues}{number_contours, min_range,  Methods from \ActorThreeD, \GlyphThreeD, \MaskPoints and \DataSetMapper.
 max_range}  
 Generate the specified number of contours within the specified range.  
 \end{methoddesc}  
377    
378  The following is a sample code using the \Contour class.  \subsubsection{\VelocityOnPlaneCut class}
 \fig{fig:contour.1} shows the corresponding output.  
 \verbatiminput{../examples/drivercontour.py}  
379    
380  \begin{figure}[ht]  \begin{classdesc}{VelocityOnPlaneCut}{scene, data_collector,
381  \begin{center}  arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
382  \includegraphics[width=40mm]{figures/Contour}  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR,
383  \end{center}  cell_to_point = False, outline = True}
384  \caption{Contour}  This class works in a similar way to \MapOnPlaneCut, except that
385  \label{fig:contour.1}  it shows a vector field using arrows cut using a plane.
386  \end{figure}  \end{classdesc}
387    
388    The following are some of the methods available:\\
389    Methods from \ActorThreeD, \GlyphThreeD, \Transform, \MaskPoints and
390    \DataSetMapper.
391    
392    A typical usage of \VelocityOnPlaneCut is shown below.
393    
394    \begin{python}
395    """
396    Author: John Ngui, john.ngui@uq.edu.au
397    """
398    
399  \section{\ContourOnPlane class}  # Import the necessary modules
400  \begin{classdesc}{ContourOnPlane}{scene, data_collector, transform, lut = None}  from esys.pyvisi import Scene, DataCollector, VelocityOnPlaneCut, Camera
401  A \ContourOnPlane object shows a scalar field contour surfaces on a given plane.  from esys.pyvisi.constant import *
402    import os
403    
404    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
405    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
406    X_SIZE = 400
407    Y_SIZE = 400
408    
409    VECTOR_FIELD_CELL_DATA = "velocity"
410    FILE_3D = "interior_3D.xml"
411    IMAGE_NAME = "velocity.jpg"
412    JPG_RENDERER = Renderer.ONLINE_JPG
413    
414    # Create a Scene.
415    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
416            y_size = Y_SIZE)
417    
418    # Create a DataCollector reading from a XML file.
419    dc1 = DataCollector(source = Source.XML)
420    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
421    dc1.setActiveVector(vector = VECTOR_FIELD_CELL_DATA)
422    
423    # Create VelocityOnPlaneCut.
424    vopc1 = VelocityOnPlaneCut(scene = s, data_collector = dc1,
425            viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.VECTOR,
426            arrow = Arrow.THREE_D, lut = Lut.COLOR, cell_to_point = False,
427            outline = True)
428    vopc1.setScaleFactor(scale_factor = 0.5)
429    vopc1.setPlaneToXY(offset = 0.5)
430    vopc1.setRatio(2)
431    vopc1.randomOn()
432    
433    # Create a Camera.
434    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
435    c1.isometricView()
436    c1.elevation(angle = -20)
437    
438    # Render the object.
439    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
440    \end{python}
441    
442    \subsubsection{\VelocityOnPlaneClip class}
443    
444    \begin{classdesc}{VelocityOnPlaneClip}{scene, data_collector,
445    arrow = Arrow.TWO_D, color_mode = ColorMode.VECTOR,
446    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR,
447    cell_to_point = False, online = True}
448    This class works in a similar way to \MapOnPlaneClip, except that it shows a
449    vector field using arrows clipped using a plane.
450  \end{classdesc}  \end{classdesc}
451    
452  The following is a sample code using the \ContourOnPlane class.  The following are some of the methods available:\\
453  \fig{fig:contouronplane.1} shows the corresponding output.  Methods from \ActorThreeD, \GlyphThreeD, \Transform, \Clipper,
454  \verbatiminput{../examples/drivercontouronplane.py}  \MaskPoints and \DataSetMapper.
455    
456  \begin{figure}[ht]  \subsubsection{\Ellipsoid class}
 \begin{center}  
 \includegraphics[width=40mm]{figures/ContourOnPlane}  
 \end{center}  
 \caption{Contour on a plane}  
 \label{fig:contouronplane.1}  
 \end{figure}  
457    
458  \section{\ContourOnClip class}  \begin{classdesc}{Ellipsoid}{scene, data_collector,
459  \begin{classdesc}{ContourOnClip}{scene, data_collector, transform, lut = None}  viewport = Viewport = SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
460  A \ContourOnClip object shows a scalar field contour surfaces on a given clip.  outline = True}
461    Class that shows a tensor field using ellipsoids. The ellipsoids can either be
462    color or gray-scale, depending on the lookup table used.
463  \end{classdesc}  \end{classdesc}
464    
465  The following is a sample code using the \ContourOnClip class.  The following are some of the methods available:\\
466  \fig{fig:contouronclip.1} shows the corresponding output.  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \MaskPoints and
467  \verbatiminput{../examples/drivercontouronclip.py}  \DataSetMapper.
468    
469  \begin{figure}[ht]  \subsubsection{\EllipsoidOnPlaneCut class}
 \begin{center}  
 \includegraphics[width=40mm]{figures/ContourOnClip}  
 \end{center}  
 \caption{Contour on a clip}  
 \label{fig:contouronclip.1}  
 \end{figure}  
470    
471  \section{\TensorC class}  \begin{classdesc}{EllipsoidOnPlaneCut}{scene, data_collector,
472  \begin{classdesc}{Tensor}{scene, data_collector, lut = None}  viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
473  A \TensorC object shows a tensor field by ellipsoids.  outline = True}
474    This class works in a similar way to \MapOnPlaneCut, except that it shows
475    a tensor field using ellipsoids cut using a plane.
476  \end{classdesc}  \end{classdesc}
477    
478  The following are the methods available:  The following are some of the methods available:\\
479  \begin{methoddesc}[Tensor]{setThetaResolution}{resolution}  Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform,
480  Set the number of points in the longitude direction.  \MaskPoints and \DataSetMapper.
481  \end{methoddesc}  
482    \subsubsection{\EllipsoidOnPlaneClip class}
483    
484    \begin{classdesc}{EllipsoidOnPlaneClip}{scene, data_collector,
485    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
486    outline = True}
487    This class works in a similar way to \MapOnPlaneClip, except that it shows a
488    tensor field using ellipsoids clipped using a plane.
489    \end{classdesc}
490            
491    The following are some of the methods available:\\
492    Methods from \ActorThreeD, \Sphere, \TensorGlyph, \Transform, \Clipper,
493    \MaskPoints and \DataSetMapper.
494    
495    A typical usage of \EllipsoidOnPlaneClip is shown below.
496    
497    \begin{python}
498    """
499    Author: John Ngui, john.ngui@uq.edu.au
500    """
501    
502    # Import the necessary modules
503    from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera
504    from esys.pyvisi.constant import *
505    import os
506    
507    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
508    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
509    X_SIZE = 400
510    Y_SIZE = 400
511    
512    TENSOR_FIELD_CELL_DATA = "stress_cell"
513    FILE_3D = "interior_3D.xml"
514    IMAGE_NAME = "ellipsoid.jpg"
515    JPG_RENDERER = Renderer.ONLINE_JPG
516    
517    # Create a Scene.
518    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
519            y_size = Y_SIZE)
520    
521    # Create a DataCollector reading from a XML file.
522    dc1 = DataCollector(source = Source.XML)
523    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
524    dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)
525    
526    # Create an EllipsoidOnPlaneClip.
527    eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,
528            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,
529            outline = True)
530    eopc1.setPlaneToXY()
531    eopc1.setScaleFactor(scale_factor = 0.2)
532    eopc1.rotateX(angle = 10)
533    
534    # Create a Camera.
535    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
536    c1.bottomView()
537    c1.azimuth(angle = -90)
538    c1.elevation(angle = 10)
539    
540    # Render the object.
541    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
542    \end{python}
543    
544    \subsubsection{\Contour class}
545    
546    \begin{classdesc}{Contour}{scene, data_collector,
547    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
548    outline = True}
549    Class that shows a scalar field using contour surfaces. The contour surfaces can
550    either be color or gray-scale, depending on the lookup table used. This
551    class can also be used to generate iso surfaces.
552    \end{classdesc}
553    
554    The following are some of the methods available:\\
555    Methods from \ActorThreeD, \ContourModule and \DataSetMapper.
556    
557    A typical usage of \Contour is shown below.
558    
559    \begin{python}
560    """
561    Author: John Ngui, john.ngui@uq.edu.au
562    """
563    
564    # Import the necessary modules
565    from esys.pyvisi import Scene, DataCollector, Contour, Camera
566    from esys.pyvisi.constant import *
567    import os
568    
569    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
570    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
571    X_SIZE = 400
572    Y_SIZE = 400
573    
574    SCALAR_FIELD_POINT_DATA = "temperature"
575    FILE_3D = "interior_3D.xml"
576    IMAGE_NAME = "contour.jpg"
577    JPG_RENDERER = Renderer.ONLINE_JPG
578    
579    # Create a Scene.
580    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
581            y_size = Y_SIZE)
582    
583    # Create a DataCollector reading a XML file.
584    dc1 = DataCollector(source = Source.XML)
585    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
586    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
587    
588    # Create a Contour.
589    ctr1 = Contour(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST,
590            lut = Lut.COLOR, cell_to_point = False, outline = True)
591    ctr1.generateContours(contours = 3)
592    
593    # Create a Camera.
594    cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
595    cam1.elevation(angle = -40)
596    
597    # Render the object.
598    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
599    \end{python}
600    
601    \subsubsection{\ContourOnPlaneCut class}
602    
603    \begin{classdesc}{ContourOnPlaneCut}{scene, data_collector,
604    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
605    outline = True}
606    This class works in a similar way to \MapOnPlaneCut, except that it shows a
607    scalar field using contour surfaces cut using a plane.
608    \end{classdesc}
609    
610    The following are some of the methods available:\\
611    Methods from \ActorThreeD, \ContourModule, \Transform and \DataSetMapper.
612    
613    \subsubsection{\ContourOnPlaneClip class}
614    
615    \begin{classdesc}{ContourOnPlaneClip}{scene, data_collector,
616    viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
617    outline = True}
618    This class works in a similar way to \MapOnPlaneClip, except that it shows a
619    scalar field using contour surfaces clipped using a plane.
620    \end{classdesc}
621    
622    The following are some of the methods available:\\
623    Methods from \ActorThreeD, \ContourModule, \Transform, \Clipper and
624    \DataSetMapper.
625    
626    \subsubsection{\StreamLine class}
627    
628    \begin{classdesc}{StreamLine}{scene, data_collector,
629    viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.VECTOR, lut = Lut.COLOR,
630    cell_to_point = False, outline = True}
631    Class that shows the direction of particles of a vector field using streamlines.
632    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
634    modes, either using vector data or scalar data.
635    \end{classdesc}
636    
637    The following are some of the methods available:\\
638    Methods from \ActorThreeD, \PointSource, \StreamLineModule, \Tube and
639    \DataSetMapper.
640    
641    A typical usage of \StreamLine is shown below.
642    
643    \begin{python}
644    """
645    Author: John Ngui, john.ngui@uq.edu.au
646    """
647    
648    # Import the necessary modules.
649    from esys.pyvisi import Scene, DataCollector, StreamLine, Camera
650    from esys.pyvisi.constant import *
651    import os
652    
653    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
654    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
655    X_SIZE = 400
656    Y_SIZE = 400
657    
658    VECTOR_FIELD_CELL_DATA = "temperature"
659    FILE_3D = "interior_3D.xml"
660    IMAGE_NAME = "streamline.jpg"
661    JPG_RENDERER = Renderer.ONLINE_JPG
662    
663    # Create a Scene.
664    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
665            y_size = Y_SIZE)
666    
667    # Create a DataCollector reading from a XML file.
668    dc1 = DataCollector(source = Source.XML)
669    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
670    
671    # Create a Streamline.
672    sl1 = StreamLine(scene = s, data_collector = dc1,
673            viewport = Viewport.SOUTH_WEST, color_mode = ColorMode.SCALAR,
674            lut = Lut.COLOR, cell_to_point = False, outline = True)
675    sl1.setTubeRadius(radius = 0.02)
676    sl1.setTubeNumberOfSides(3)
677    sl1.setTubeRadiusToVaryByVector()
678    sl1.setPointSourceRadius(0.9)
679    
680    # Create a Camera.
681    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
682    c1.isometricView()
683    
684    # Render the object.
685    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
686    \end{python}
687    
688    \subsubsection{\Carpet class}
689    
690    \begin{classdesc}{Carpet}{scene, data_collector,
691    viewport = Viewport.Viewport.SOUTH_WEST, warp_mode = WarpMode.SCALAR,
692    lut = Lut.COLOR, cell_to_point = False, outline = True}
693    This class works in a similar way to \MapOnPlaneCut, except that it shows a
694    scalar field cut on a plane and deformed (warped) along the normal. The
695    plane can either be color or gray-scale, depending on the lookup table used.
696    Similarly, the plane can be deformed either using scalar data or vector data.
697    \end{classdesc}
698    
699    The following are some of the methods available:\\
700    Methods from \ActorThreeD, \Warp, \Transform and \DataSetMapper.
701    
702    A typical usage of \Carpet is shown below.
703    
704    \begin{python}
705    """
706    Author: John Ngui, john.ngui@uq.edu.au
707    """
708    
709    # Import the necessary modules.
710    from esys.pyvisi import Scene, DataCollector, Carpet, Camera
711    from esys.pyvisi.constant import *
712    import os
713    
714  \begin{methoddesc}[Tensor]{setPhiResolution}{resolution}  PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
715  Set the number of points in the latitude direction.  PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
716    X_SIZE = 400
717    Y_SIZE = 400
718    
719    SCALAR_FIELD_CELL_DATA = "temperature_cell"
720    FILE_3D = "interior_3D.xml"
721    IMAGE_NAME = "carpet.jpg"
722    JPG_RENDERER = Renderer.ONLINE_JPG
723    
724    # Create a Scene.
725    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
726            y_size = Y_SIZE)
727    
728    # Create a DataCollector reading from a XML file.
729    dc1 = DataCollector(source = Source.XML)
730    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
731    dc1.setActiveScalar(scalar = SCALAR_FIELD_CELL_DATA)
732    
733    # Create a Carpet.
734    cpt1 = Carpet(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST,
735            warp_mode = WarpMode.SCALAR, lut = Lut.COLOR, cell_to_point = True,
736            outline = True)
737    cpt1.setPlaneToXY(0.2)
738    cpt1.setScaleFactor(1.9)
739    
740    # Create a Camera.
741    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
742    c1.isometricView()
743    
744    # Render the object.
745    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
746    \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}
769    
770    \begin{classdesc}{Image}{scene, image_reader, viewport = Viewport.SOUTH_WEST}
771    Class that displays an image which can be scaled (upwards and downwards) and
772    has interaction capability. The image can also be translated and rotated along
773    the X, Y and Z axes. One of the most common use of this feature is pasting an
774    image on a surface map.
775    \end{classdesc}
776    
777    The following are some of the methods available:\\
778    Methods from \ActorThreeD, \PlaneSource and \Transform.
779    
780    A typical usage of \Image is shown below.
781    
782    \begin{python}
783    """
784    Author: John Ngui, john.ngui@uq.edu.au
785    """
786    
787    # Import the necessary modules.
788    from esys.pyvisi import Scene, DataCollector, Map, ImageReader, Image, Camera
789    from esys.pyvisi import GlobalPosition
790    from esys.pyvisi.constant import *
791    import os
792    
793    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
794    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
795    X_SIZE = 400
796    Y_SIZE = 400
797    
798    SCALAR_FIELD_POINT_DATA = "temperature"
799    FILE_3D = "interior_3D.xml"
800    LOAD_IMAGE_NAME = "flinders.jpg"
801    SAVE_IMAGE_NAME = "image.jpg"
802    JPG_RENDERER = Renderer.ONLINE_JPG
803    
804    # Create a Scene.
805    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
806            y_size = Y_SIZE)
807    
808    # Create a DataCollector reading from a XML file.
809    dc1 = DataCollector(source = Source.XML)
810    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
811    
812    # Create a Map.
813    m1 = Map(scene = s, data_collector = dc1, viewport = Viewport.SOUTH_WEST,
814            lut = Lut.COLOR, cell_to_point = False, outline = True)
815    m1.setOpacity(0.3)
816    
817    # Create an ImageReader (in place of DataCollector).
818    ir = ImageReader(ImageFormat.JPG)
819    ir.setImageName(image_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
820            LOAD_IMAGE_NAME))
821    
822    # Create an Image.
823    i = Image(scene = s, image_reader = ir, viewport = Viewport.SOUTH_WEST)
824    i.setOpacity(opacity = 0.9)
825    i.translate(0,0,-1)
826    i.setPoint1(GlobalPosition(2,0,0))
827    i.setPoint2(GlobalPosition(0,2,0))
828    
829    # Create a Camera.
830    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
831    
832    # Render the image.
833    s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, SAVE_IMAGE_NAME))
834    \end{python}
835    
836    \subsubsection{\Logo class}
837    
838    \begin{classdesc}{Logo}{scene, image_reader, viewport = Viewport.SOUTH_WEST}
839    Class that displays a static image, in particular a logo
840    (i.e. company symbol) and has NO interaction capability. The position and size
841    of the logo can be specified.
842    \end{classdesc}
843    
844    The following are some of the methods available:\\
845    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}  \end{methoddesc}
859    
860  \begin{methoddesc}[Tensor]{setScaleFactor}{scale_factor}  \begin{methoddesc}[Movie]{imageList}{input_directory, image_list}
861  Set the tensor scale factor.  The image list from which the movie is to be generated from.
862  \end{methoddesc}  \end{methoddesc}
863    
864  \begin{methoddesc}[Tensor]{setMaxScaleFactor}{max_scale_factor}  \begin{methoddesc}[Movie]{makeMovie}{movie}
865  Set the maximum allowable scale factor.  Generate the movie.
866  \end{methoddesc}  \end{methoddesc}
867    
868  The following is a sample code using the \TensorC class.  A typical usage of \Movie is shown below.
 \fig{fig:tensor.1} shows the corresponding output.  
 \verbatiminput{../examples/drivertensor.py}  
869    
870  \begin{figure}[ht]  \begin{python}
871  \begin{center}  """
872  \includegraphics[width=40mm]{figures/Tensor}  Author: John Ngui, john.ngui@uq.edu.au
873  \end{center}  """
 \caption{Tensor}  
 \label{fig:tensor.1}  
 \end{figure}  
874    
875  \section{\TensorOnPlane class}  # Import the necessary modules.
876  \begin{classdesc}{TensorOnPlane}{scene, data_collector, transform, lut = None}  from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend
877  A \TensorOnPlane object shows a tensor field by ellipsoids on a given plane.  from esys.pyvisi import Movie, LocalPosition
878  \end{classdesc}  from esys.pyvisi.constant import *
879    import os
880    
881  The following is a sample code using the \TensorOnPlane class.  PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
882  \fig{fig:tensoronplane.1} shows the corresponding output.  PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
883  \verbatiminput{../examples/drivertensoronplane.py}  X_SIZE = 800
884    Y_SIZE = 800
885    
886  \begin{figure}[ht]  SCALAR_FIELD_POINT_DATA = "temp"
887  \begin{center}  FILE_2D = "tempvel-"
888  \includegraphics[width=40mm]{figures/TensorOnPlane}  IMAGE_NAME = "movie"
889  \end{center}  JPG_RENDERER = Renderer.ONLINE_JPG
 \caption{Tensor on a plane}  
 \label{fig:tensoronplane.1}  
 \end{figure}  
890    
891  \section{\TensorOnClip class}  # Create a Scene.
892  \begin{classdesc}{TensorOnClip}{scene, data_collector, transform, lut = None}  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
893  A \TensorOnClip object shows a tensor field by ellipsoids on a given clip.          y_size = Y_SIZE)
 \end{classdesc}  
894    
895  The following is a sample code using the \TensorOnClip class.  # Create a DataCollector reading from a XML file.
896  \fig{fig:tensoronclip.1} shows the corresponding output.  dc1 = DataCollector(source = Source.XML)
897  \verbatiminput{../examples/drivertensoronclip.py}  dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
898    
899  \begin{figure}[ht]  # Create a Map.
900  \begin{center}  m1 = Map(scene = s, data_collector = dc1,
901  \includegraphics[width=40mm]{figures/TensorOnClip}          viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
902  \end{center}          outline = True)
903  \caption{Tensor on a clip}  
904  \label{fig:tensoronclip.1}  # Create a Camera.
905  \end{figure}  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    
936    
937    \subsection{Coordinate Classes}
938    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}
943    Class that defines the local positioning (X and Y) coordinate system (2D).
944    \end{classdesc}
945    
946    \subsubsection{\GlobalPosition class}
947    
948  \section{\StreamLines class}  \begin{classdesc}{GlobalPosition}{x_coor, y_coor, z_coor}
949  \begin{classdesc}{StreamLines}{scene, data_collector, lut = None}  Class that defines the global positioning (X, Y and Z) coordinate system (3D).
 A \StreamLines object show the path of particles (within a specified cloud  
 of points) in a vector field.  
950  \end{classdesc}  \end{classdesc}
951    
952  The following are the methods available:  
953  \begin{methoddesc}[StreamLines]{setCloudRadius}{radius}  %##############################################################################
954  Set the radius for the cloud of points.  
955    
956    \subsection{Supporting Classes}
957    This subsection details the supporting classes and their corresponding methods
958    inherited by the input (see Section \ref{INPUT SEC}) and data
959    visualization classes (see Section \ref{DATAVIS SEC}).
960    
961    \subsubsection{\ActorThreeD class}
962    Class that defines a 3D actor. \\
963    
964    The following are some of the methods available:
965    
966    \begin{methoddesc}[Actor3D]{setOpacity}{opacity}
967    Set the opacity (transparency) of the 3D actor.
968  \end{methoddesc}  \end{methoddesc}
969    
970  \begin{methoddesc}[StreamLines]{setCenter}{position}  \begin{methoddesc}[Actor3D]{setColor}{color}
971  Set the center for the cloud of points.  Set the color of the 3D actor.
972  \end{methoddesc}  \end{methoddesc}
973    
974  \begin{methoddesc}[StreamLines]{setNumberOfPoints}{points}  \begin{methoddesc}[Actor3D]{setRepresentationToWireframe}{}
975  Set the number of points to generate for the cloud of points.  Set the representation of the 3D actor to wireframe.
976  \end{methoddesc}  \end{methoddesc}
977    
978  \begin{methoddesc}[StreamLines]{setMaximumPropagationTime}{time}  \subsubsection{\ActorTwoD class}
979  Set the maximum length for the streamlines in unit of time.  Class that defines a 2D actor. \\
980    
981    The following are some of the methods available:
982    
983    \begin{methoddesc}[Actor2D]{setPosition}{position}
984    Set the position (XY) of the 2D actor. Default position is the lower left hand
985    corner of the window / viewport.
986  \end{methoddesc}  \end{methoddesc}
987    
988  \begin{methoddesc}[StreamLines]{setStreamLinesSize}{stream_lines_size}  \subsubsection{\Clipper class}
989  Set the size of the steamlines.  Class that defines a clipper. \\
990    
991    The following are some of the methods available:
992    
993    \begin{methoddesc}[Clipper]{setInsideOutOn}{}
994    Clips one side of the rendered object.
995  \end{methoddesc}  \end{methoddesc}
996    
997  \begin{methoddesc}[StreamLines]{setAccuracy}{accuracy}  \begin{methoddesc}[Clipper]{setInsideOutOff}{}
998  Set the accuracy for the streamlines.  Clips the other side of the rendered object.
999  \end{methoddesc}  \end{methoddesc}
1000    
1001  \begin{methoddesc}[StreamLines]{setIntegrationToBothDirections}{}  \begin{methoddesc}[Clipper]{setClipValue}{value}
1002  Set the integration to occur in both directions.  Set the scalar clip value (instead of using a plane) for the clipper.
1003  \end{methoddesc}  \end{methoddesc}
1004    
1005  \begin{methoddesc}[StreamLines]{setTubeRadius}{radius}  \subsubsection{\ContourModule class}
1006  Set the minimum radius of the tube.  Class that defines the contour module. \\
1007    
1008    The following are some of the methods available:
1009    
1010    \begin{methoddesc}[ContourModule]{generateContours}{contours = None,
1011    lower_range = None, upper_range = None}
1012    Generate the specified number of contours within the specified range.
1013    In order to generate an iso surface, the 'lower_range' and 'upper_range'
1014    must be equal.
1015  \end{methoddesc}  \end{methoddesc}
1016    
1017  \begin{methoddesc}[StreamLines]{setNumberOfSides}{sides}  \subsubsection{\GlyphThreeD class}
1018  Set the number of sides for the tube.  Class that defines 3D glyphs. \\
1019    
1020    The following are some of the methods available:
1021    
1022    \begin{methoddesc}[Glyph3D]{setScaleModeByVector}{}
1023    Set the 3D glyph to scale according to the vector data.
1024  \end{methoddesc}  \end{methoddesc}
1025    
1026  \begin{methoddesc}[StreamLines]{setVaryRadiusByVector}{}  \begin{methoddesc}[Glyph3D]{setScaleModeByScalar}{}
1027  Set the variation of the tube radius with vector data.  Set the 3D glyph to scale according to the scalar data.
1028  \end{methoddesc}  \end{methoddesc}
1029    
1030  The following is a sample code using the \StreamLines class.  \begin{methoddesc}[Glyph3D]{setScaleFactor}{scale_factor}
1031  \fig{fig:streamlines.1} shows the corresponding output.  Set the 3D glyph scale factor.
1032  \verbatiminput{../examples/driverstreamlines.py}  \end{methoddesc}
1033    
1034  \begin{figure}[ht]  \subsubsection{\TensorGlyph class}
1035  \begin{center}  Class that defines tensor glyphs. \\
 \includegraphics[width=40mm]{figures/StreamLines}  
 \end{center}  
 \caption{StreamLines}  
 \label{fig:streamlines.1}  
 \end{figure}  
1036    
1037  \section{\Carpet class}  The following are some of the methods available:
 \begin{classdesc}{Carpet}{scene, data_collector, transform, lut = None,  
 deform = None}  
 A \Carpet object shows a scalar/vector field as a plane deformated along  
 the plane normal.  
 \end{classdesc}  
1038    
1039  The following is the method available:  \begin{methoddesc}[TensorGlyph]{setScaleFactor}{scale_factor}
1040  \begin{methoddesc}[Carpet]{setScaleFactor}{scale_factor}  Set the scale factor for the tensor glyph.
 Set the displancement scale factor.  
1041  \end{methoddesc}  \end{methoddesc}
1042    
1043  The following is a sample code using the \Carpet class.  \begin{methoddesc}[TensorGlyph]{setMaxScaleFactor}{max_scale_factor}
1044  \fig{fig:carpet.1} shows the corresponding output.  Set the maximum allowable scale factor for the tensor glyph.
1045  \verbatiminput{../examples/drivercarpet.py}  \end{methoddesc}
1046    
1047  \begin{figure}[ht]  \subsubsection{\PlaneSource class}
1048  \begin{center}  Class that defines a plane source.  A plane source is defined by an origin
1049  \includegraphics[width=50mm]{figures/Carpet}  and two other points, which form the axes (X and Y). \\
 \end{center}  
 \caption{Carpet}  
 \label{fig:carpet.1}  
 \end{figure}  
1050    
1051    The following are some of the methods available:
1052    
1053  \section{\Position class}  \begin{methoddesc}[PlaneSource]{setPoint1}{position}
1054  \begin{classdesc}{Position}{x_coor, y_coor, z_coor}  Set the first point from the origin of the plane source.
1055  A \Position object defines the x, y and z coordinates of rendered object.  \end{methoddesc}
 \end{classdesc}  
1056    
1057  \section{\Transform class}  \begin{methoddesc}[PlaneSource]{setPoint2}{position}
1058  \begin{classdesc}{Transform}{}  Set the second point from the origin of the plane source.
1059  A \Transform object defines the orientation of rendered object.  \end{methoddesc}
1060  \end{classdesc}  
1061    \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    
1067    \begin{methoddesc}[PointSource]{setPointSourceRadius}{radius}
1068    Set the radius of the sphere.
1069    \end{methoddesc}
1070    
1071    \begin{methoddesc}[PointSource]{setPointSourceCenter}{center}
1072    Set the center of the sphere.
1073    \end{methoddesc}
1074    
1075    \begin{methoddesc}[PointSource]{setPointSourceNumberOfPoints}{points}
1076    Set the number of points to generate within the sphere (the larger the
1077    number of points, the more streamlines are generated).
1078    \end{methoddesc}
1079    
1080    \subsubsection{\Sphere class}
1081    Class that defines a sphere. \\
1082    
1083    The following are some of the methods available:
1084    
1085    \begin{methoddesc}[Sphere]{setThetaResolution}{resolution}
1086    Set the theta resolution of the sphere.
1087    \end{methoddesc}
1088    
1089    \begin{methoddesc}[Sphere]{setPhiResolution}{resolution}
1090    Set the phi resolution of the sphere.
1091    \end{methoddesc}
1092    
1093    \subsubsection{\StreamLineModule class}
1094    Class that defines the streamline module. \\
1095    
1096    The following are some of the methods available:
1097    
1098    \begin{methoddesc}[StreamLineModule]{setMaximumPropagationTime}{time}
1099    Set the maximum length of the streamline expressed in elapsed time.
1100    \end{methoddesc}
1101    
1102    \begin{methoddesc}[StreamLineModule]{setIntegrationToBothDirections}{}
1103    Set the integration to occur both sides: forward (where the streamline
1104    goes) and backward (where the streamline came from).
1105    \end{methoddesc}
1106    
1107    \subsubsection{\Transform class}
1108    Class that defines the orientation of planes. \\
1109    
1110    The following are some of the methods available:
1111    
1112  \begin{methoddesc}[Transform]{translate}{x_offset, y_offset, z_offset}  \begin{methoddesc}[Transform]{translate}{x_offset, y_offset, z_offset}
1113  Translate the rendered object along the x, y and z-axes.  Translate the rendered object along the x, y and z-axes.
1114  \end{methoddesc}  \end{methoddesc}
1115    
1116  \begin{methoddesc}[Transform]{rotateX}{angle}  \begin{methoddesc}[Transform]{rotateX}{angle}
1117  Rotate the rendered object along the x-axis.  Rotate the plane along the x-axis.
1118  \end{methoddesc}  \end{methoddesc}
1119    
1120  \begin{methoddesc}[Transform]{rotateY}{angle}  \begin{methoddesc}[Transform]{rotateY}{angle}
1121  Rotate the rendered object along the y-axis.  Rotate the plane along the y-axis.
1122  \end{methoddesc}  \end{methoddesc}
1123    
1124  \begin{methoddesc}[Transform]{rotateZ}{angle}  \begin{methoddesc}[Transform]{rotateZ}{angle}
1125  Rotate the rendered object along the z-axis.  Rotate the plane along the z-axis.
1126  \end{methoddesc}  \end{methoddesc}
1127    
1128  \begin{methoddesc}[Transform]{xyPlane}{offset = 0}  \begin{methoddesc}[Transform]{setPlaneToXY}{offset = 0}
1129  Set the plane orthogonal to the z-axis.  Set the plane orthogonal to the z-axis.
1130  \end{methoddesc}  \end{methoddesc}
1131    
1132  \begin{methoddesc}[Transform]{yzPlane}{offset = 0}  \begin{methoddesc}[Transform]{setPlaneToYZ}{offset = 0}
1133  Set the plane orthogonal to the x-axis.  Set the plane orthogonal to the x-axis.
1134  \end{methoddesc}  \end{methoddesc}
1135    
1136  \begin{methoddesc}[Transform]{xzPlane}{offset = 0}  \begin{methoddesc}[Transform]{setPlaneToXZ}{offset = 0}
1137  Set the plane orthogonal to the y-axis.  Set the plane orthogonal to the y-axis.
1138  \end{methoddesc}  \end{methoddesc}
1139    
1140  \section{\Style class}  \subsubsection{\Tube class}
1141  \begin{classdesc}{Style}{}  Class that defines the tube wrapped around the streamlines. \\
1142  A \Style object defines the style of text.  
1143  \end{classdesc}  The following are some of the methods available:
1144    
1145  The following are the methods available:  \begin{methoddesc}[Tube]{setTubeRadius}{radius}
1146  \begin{methoddesc}[Style]{setFontFamily}{family}  Set the radius of the tube.
 Set the font family (i.e. Times)  
1147  \end{methoddesc}  \end{methoddesc}
1148    
1149  \begin{methoddesc}[Style]{boldOn}{}  \begin{methoddesc}[Tube]{setTubeRadiusToVaryByVector}{}
1150  Bold the text.  Set the radius of the tube to vary by vector data.
1151  \end{methoddesc}  \end{methoddesc}
1152    
1153  \begin{methoddesc}[Style]{italicOn}{}  \begin{methoddesc}[Tube]{setTubeRadiusToVaryByScalar}{}
1154  Italize the text.  Set the radius of the tube to vary by scalar data.
1155  \end{methoddesc}  \end{methoddesc}
1156    
1157  \begin{methoddesc}[Style]{shadowOn}{}  \subsubsection{\Warp class}
1158  Apply shadows on the text.  Class that defines the deformation of a scalar field. \\
1159    
1160    The following are some of the methods available:
1161    
1162    \begin{methoddesc}[Warp]{setScaleFactor}{scale_factor}
1163    Set the displacement scale factor.
1164    \end{methoddesc}
1165    
1166    \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:
1172    
1173    \begin{methoddesc}[MaskPoints]{setRatio}{ratio}
1174    Mask every n'th point.
1175  \end{methoddesc}  \end{methoddesc}
1176    
1177  \begin{methoddesc}[Style]{setColor}{}  \begin{methoddesc}[MaskPoints]{randomOn}{}
1178  Set the text color.  Enables the randomization of the points selected for masking.
1179  \end{methoddesc}  \end{methoddesc}
1180    
1181  \section{\BlueToRed class}  \subsubsection{\ScalarBar class}
1182  \begin{classdesc}{BlueToRed}{}  Class that defines a scalar bar. \\
 A \BlueToRed object defines a map spectrum from blue to red.  
 \end{classdesc}  
1183    
1184  \section{\RedToBlue class}  The following are some of the methods available:
 \begin{classdesc}{RedToBlue}{}  
 A \RedToBlue object defines a map spectrum from red to blue.  
 \end{classdesc}  
1185    
1186  \section{\Plane class}  \begin{methoddesc}[ScalarBar]{setTitle}{title}
1187  The following are the methods available:  Set the title of the scalar bar.
 \begin{methoddesc}[Plane]{setPlaneOrigin}{position}  
 Set the plane origin  
1188  \end{methoddesc}  \end{methoddesc}
1189    
1190  \begin{methoddesc}[Plane]{setPlaneNormal}{position}  \begin{methoddesc}[ScalarBar]{setPosition}{position}
1191  Set the plane normal  Set the local position of the scalar bar.
1192  \end{methoddesc}  \end{methoddesc}
1193    
1194  \begin{methoddesc}[Plane]{setValue}{clipping_value}  \begin{methoddesc}[ScalarBar]{setOrientationToHorizontal}{}
1195  Set the clipping value  Set the orientation of the scalar bar to horizontal.
1196  \end{methoddesc}  \end{methoddesc}
1197    
1198  \begin{methoddesc}[Plane]{setInsideOutOn}{}  \begin{methoddesc}[ScalarBar]{setOrientationToVertical}{}
1199  Set the clipping to inside out  Set the orientation of the scalar bar to vertical.
1200  \end{methoddesc}  \end{methoddesc}
1201    
1202  \begin{methoddesc}[Plane]{setInsideOutOff}{}  \begin{methoddesc}[ScalarBar]{setHeight}{height}
1203  Disable the inside out clipping  Set the height of the scalar bar.
1204  \end{methoddesc}  \end{methoddesc}
1205    
1206  \section{Additional Notes}  \begin{methoddesc}[ScalarBar]{setWidth}{width}
1207  The following is a sample code rendering multiple planes.  Set the width of the scalar bar.
1208  \fig{fig:multipleplanes.1} shows the corresponding output.  \end{methoddesc}
 \verbatiminput{../examples/drivermultipleplanes.py}  
1209    
1210  \begin{figure}[ht]  \begin{methoddesc}[ScalarBar]{setLabelColor}{color}
1211  \begin{center}  Set the color of the scalar bar's label.
1212  \includegraphics[width=60mm]{figures/MultiplePlanes}  \end{methoddesc}
1213  \end{center}  
1214  \caption{Multiple planes}  \begin{methoddesc}[ScalarBar]{setTitleColor}{color}
1215  \label{fig:multipleplanes.1}  Set the color of the scalar bar's title.
1216  \end{figure}  \end{methoddesc}
1217    
1218    \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:
1223    
1224  The following is a sample code rendering multiple cuts.  \begin{methoddesc}[ImageReslice]{setSize}{size}
1225  \verbatiminput{../examples/drivermultiplecuts.py}  Set the size of the image (logo in particular), between 0 and 2. Size 1 (one)
1226    displays the image in its original size (which is the default).
1227    \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    
1282    
1283    \section{More Examples}
1284    This section shows more examples.
1285    
1286    \textsf{Reading A Series of Files}
1287    
1288    \begin{python}
1289    """
1290    Author: John Ngui, john.ngui@uq.edu.au
1291    """
1292    
1293    # Import the necessary modules.
1294    from esys.pyvisi import Scene, DataCollector, Contour, Camera
1295    from esys.pyvisi.constant import *
1296    import os
1297    
1298    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
1299    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
1300    X_SIZE = 400
1301    Y_SIZE = 300
1302    
1303    SCALAR_FIELD_POINT_DATA_1 = "lava"
1304    SCALAR_FIELD_POINT_DATA_2 = "talus"
1305    FILE_2D = "phi_talus_lava."
1306    
1307    IMAGE_NAME = "seriesofreads"
1308    JPG_RENDERER = Renderer.ONLINE_JPG
1309    
1310    # Create a Scene.
1311    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1312            y_size = Y_SIZE)
1313    
1314    # Create a DataCollector reading from a XML file.
1315    dc1 = DataCollector(source = Source.XML)
1316    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_1)
1317    
1318    # Create a Contour.
1319    mosc1 = Contour(scene = s, data_collector = dc1,
1320            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1321            outline = True)
1322    mosc1.generateContours(0)
1323    
1324    # Create a second DataCollector reading from the same XML file
1325    # but specifying a different scalar field.
1326    dc2 = DataCollector(source = Source.XML)
1327    dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
1328    
1329    # Create a second Contour.
1330    mosc2 = Contour(scene = s, data_collector = dc2,
1331            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1332            outline = True)
1333    mosc2.generateContours(0)
1334    
1335    # Create a Camera.
1336    cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
1337    
1338    # Read in one file one after another and render the object.
1339    for i in range(99, 104):
1340        dc1.setFileName(file_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
1341                FILE_2D + "%04d.vtu") % i)
1342        dc2.setFileName(file_name =  os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
1343                FILE_2D + "%04d.vtu") % i)
1344    
1345        s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
1346                IMAGE_NAME + "%04d.jpg") % i)
1347    \end{python}
1348    
1349    \textsf{Manipulating A Single File with A Series of Translation}
1350    
1351    \begin{python}
1352    """
1353    Author: John Ngui, john.ngui@uq.edu.au
1354    """
1355    
1356    # Import the necessary modules.
1357    from esys.pyvisi import Scene, DataCollector, MapOnPlaneCut, Camera
1358    from esys.pyvisi.constant import *
1359    import os
1360    
1361    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
1362    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
1363    X_SIZE = 400
1364    Y_SIZE = 400
1365    
1366    SCALAR_FIELD_POINT_DATA = "temperature"
1367    FILE_3D = "interior_3D.xml"
1368    IMAGE_NAME = "seriesofcuts"
1369    JPG_RENDERER = Renderer.ONLINE_JPG
1370    
1371    # Create a Scene.
1372    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1373            y_size = Y_SIZE)
1374    
1375    # Create a DataCollector reading from a XML file.
1376    dc1 = DataCollector(source = Source.XML)
1377    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
1378    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
1379    
1380    # Create a MapOnPlaneCut.
1381    mopc1 = MapOnPlaneCut(scene = s, data_collector = dc1,
1382            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1383            outline = True)
1384    mopc1.setPlaneToYZ(offset = 0.1)
1385    
1386    # Create a Camera.
1387    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
1388    c1.isometricView()
1389    
1390    # Render the object with multiple cuts using a series of translation.
1391    for i in range(0, 5):
1392        s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME +
1393                "%02d.jpg") % i)
1394        mopc1.translate(0.6,0,0)
1395    \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}
1475    This section shows some of the useful keys when interacting with the rendered
1476    object (in the Online approach).
1477    
1478    \begin{table}[ht]
1479    \begin{center}
1480    \begin{tabular}{| c | p{13cm} |}
1481    \hline
1482    \textbf{Key} & \textbf{Description} \\ \hline
1483    Keypress 'c' / 'a' & Toggle between the camera ('c') and object ('a')  mode. In
1484    camera mode, mouse events affect the camera position and focal point. In
1485    object mode, mouse events affect the rendered object's element (i.e.
1486    cut surface map, clipped velocity field, streamline, etc) that is under the
1487    mouse pointer.\\ \hline
1488    Mouse button 1 & Rotate the camera around its focal point (if in camera mode)
1489    or rotate the rendered object's element (if in object mode).\\ \hline
1490    Mourse button 2 & Pan the camera (if in camera mode) or translate the rendered
1491    object's element (if in object mode). \\ \hline
1492    Mouse button 3 & Zoom the camera (if in camera mode) or scale the rendered
1493    object's element (if in object mode). \\ \hline
1494    Keypress 3 & Toggle the render window in and out of stereo mode. By default,
1495    red-blue stereo pairs are created. \\ \hline
1496    Keypress 'e' / 'q' & Exit the application if only one file is to be read, or
1497    read and display the next file if multiple files are to be read. \\ \hline
1498    Keypress 's' & Modify the representation of the rendered object to surfaces.
1499    \\ \hline
1500    Keypress 'w' & Modify the representation of the rendered object to wireframe.
1501    \\ \hline
1502    Keypress 'r' & Reset the position of the rendered object to the center.
1503    \\ \hline
1504    \end{tabular}
1505    \caption{Useful keys}
1506    \end{center}
1507    \end{table}
1508    
1509    
1510    % ############################################################################
1511    
1512    
1513    \newpage
1514    
1515    \section{Sample Output}
1516    This section displays some of the sample output by Pyvisi.  
1517    
1518    \begin{table}[ht]
1519    \begin{tabular}{c c c}
1520    \includegraphics[width=\thumbnailwidth]{figures/Map} &
1521    \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneCut} &
1522    \includegraphics[width=\thumbnailwidth]{figures/MapOnPlaneClip} \\
1523    Map & MapOnPlaneCut & MapOnPlaneClip \\
1524    \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClip} &
1525    \includegraphics[width=\thumbnailwidth]{figures/MapOnScalarClipWithRotation} &
1526    \includegraphics[width=\thumbnailwidth]{figures/Velocity} \\
1527    MapOnScalarClip & MapOnScalarClipWithRotation & Velocity \\ \\ \\ \\
1528    \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneCut} &
1529    \includegraphics[width=\thumbnailwidth]{figures/VelocityOnPlaneClip} &
1530    \includegraphics[width=\thumbnailwidth]{figures/Ellipsoid} \\
1531    VelocityOnPlaneCut & VelocityOnPlaneClip & Ellipsoid \\ \\ \\ \\
1532    \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneCut} &
1533    \includegraphics[width=\thumbnailwidth]{figures/EllipsoidOnPlaneClip} \\
1534    EllipsoidOnPlaneCut & EllipsoidOnPlaneClip \\ \\ \\ \\
1535    \end{tabular}
1536    \caption{Sample output}
1537    \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    
 The following is a sample code rendering multiple reads from multiple files.  
 \verbatiminput{../examples/drivermultiplereads.py}  
1559    

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

  ViewVC Help
Powered by ViewVC 1.1.26