/[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 1209 by jongui, Fri Jun 29 06:09:19 2007 UTC revision 1210 by jongui, Tue Jul 3 05:47:34 2007 UTC
# Line 253  Methods from \ActorThreeD and \DataSetMa Line 253  Methods from \ActorThreeD and \DataSetMa
253  A typical usage of \Map is shown below.  A typical usage of \Map is shown below.
254    
255  \begin{python}  \begin{python}
256    """
257    Author: John Ngui, john.ngui@uq.edu.au
258    """
259    
260  # Import the necessary modules.  # Import the necessary modules.
261  from esys.pyvisi import Scene, DataCollector, Map, Camera  from esys.pyvisi import Scene, DataCollector, Map, Camera
262  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 373  Methods from \ActorThreeD, \GlyphThreeD, Line 377  Methods from \ActorThreeD, \GlyphThreeD,
377  A typical usage of \VelocityOnPlaneCut is shown below.  A typical usage of \VelocityOnPlaneCut is shown below.
378    
379  \begin{python}  \begin{python}
380    """
381    Author: John Ngui, john.ngui@uq.edu.au
382    """
383    
384  # Import the necessary modules  # Import the necessary modules
385  from esys.pyvisi import Scene, DataCollector, VelocityOnPlaneCut, Camera  from esys.pyvisi import Scene, DataCollector, VelocityOnPlaneCut, Camera
386  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 388  FILE_3D = "interior_3D.xml" Line 396  FILE_3D = "interior_3D.xml"
396  IMAGE_NAME = "velocity.jpg"  IMAGE_NAME = "velocity.jpg"
397  JPG_RENDERER = Renderer.ONLINE_JPG  JPG_RENDERER = Renderer.ONLINE_JPG
398    
399  # Create a Scene with four viewports  # Create a Scene.
400  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,  s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
401          y_size = Y_SIZE)          y_size = Y_SIZE)
402    
# Line 472  Methods from \ActorThreeD, \Sphere, \Ten Line 480  Methods from \ActorThreeD, \Sphere, \Ten
480  A typical usage of \EllipsoidOnPlaneClip is shown below.  A typical usage of \EllipsoidOnPlaneClip is shown below.
481    
482  \begin{python}  \begin{python}
483    """
484    Author: John Ngui, john.ngui@uq.edu.au
485    """
486    
487  # Import the necessary modules  # Import the necessary modules
488  from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera  from esys.pyvisi import Scene, DataCollector, EllipsoidOnPlaneClip, Camera
489  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 496  dc1 = DataCollector(source = Source.XML) Line 508  dc1 = DataCollector(source = Source.XML)
508  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))
509  dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)  dc1.setActiveTensor(tensor = TENSOR_FIELD_CELL_DATA)
510    
511  # Create a EllipsoidOnPlaneClip.  # Create an EllipsoidOnPlaneClip.
512  eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,  eopc1 = EllipsoidOnPlaneClip(scene = s, data_collector = dc1,
513          viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,          viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = True,
514          outline = True)          outline = True)
# Line 504  eopc1.setPlaneToXY() Line 516  eopc1.setPlaneToXY()
516  eopc1.setScaleFactor(scale_factor = 0.2)  eopc1.setScaleFactor(scale_factor = 0.2)
517  eopc1.rotateX(angle = 10)  eopc1.rotateX(angle = 10)
518    
519  # Create a camera.  # Create a Camera.
520  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
521  c1.bottomView()  c1.bottomView()
522  c1.azimuth(angle = -90)  c1.azimuth(angle = -90)
# Line 530  Methods from \ActorThreeD, \ContourModul Line 542  Methods from \ActorThreeD, \ContourModul
542  A typical usage of \Contour is shown below.  A typical usage of \Contour is shown below.
543    
544  \begin{python}  \begin{python}
545    """
546    Author: John Ngui, john.ngui@uq.edu.au
547    """
548    
549  # Import the necessary modules  # Import the necessary modules
550  from esys.pyvisi import Scene, DataCollector, Contour, Camera  from esys.pyvisi import Scene, DataCollector, Contour, Camera
551  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 610  Methods from \ActorThreeD, \PointSource, Line 626  Methods from \ActorThreeD, \PointSource,
626  A typical usage of \StreamLine is shown below.  A typical usage of \StreamLine is shown below.
627    
628  \begin{python}  \begin{python}
629    """
630    Author: John Ngui, john.ngui@uq.edu.au
631    """
632    
633  # Import the necessary modules.  # Import the necessary modules.
634  from esys.pyvisi import Scene, DataCollector, StreamLine, Camera  from esys.pyvisi import Scene, DataCollector, StreamLine, Camera
635  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 639  sl1 = StreamLine(scene = s, data_collect Line 659  sl1 = StreamLine(scene = s, data_collect
659          lut = Lut.COLOR, cell_to_point = False, outline = True)          lut = Lut.COLOR, cell_to_point = False, outline = True)
660  sl1.setTubeRadius(radius = 0.02)  sl1.setTubeRadius(radius = 0.02)
661  sl1.setTubeNumberOfSides(3)  sl1.setTubeNumberOfSides(3)
662  sl1.setTubeRadiusToVaryByScalar()  sl1.setTubeRadiusToVaryByVector()
663    sl1.setPointSourceRadius(0.9)
664    
665  # Create a Camera.  # Create a Camera.
666  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)  c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
# Line 666  Methods from \ActorThreeD, \Warp, \Trans Line 687  Methods from \ActorThreeD, \Warp, \Trans
687  A typical usage of \Carpet is shown below.  A typical usage of \Carpet is shown below.
688    
689  \begin{python}  \begin{python}
690    """
691    Author: John Ngui, john.ngui@uq.edu.au
692    """
693    
694  # Import the necessary modules.  # Import the necessary modules.
695  from esys.pyvisi import Scene, DataCollector, Carpet, Camera  from esys.pyvisi import Scene, DataCollector, Carpet, Camera
696  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 740  Methods from \ActorThreeD, \PlaneSource Line 765  Methods from \ActorThreeD, \PlaneSource
765  A typical usage of \Image is shown below.  A typical usage of \Image is shown below.
766    
767  \begin{python}  \begin{python}
768    """
769    Author: John Ngui, john.ngui@uq.edu.au
770    """
771    
772  # Import the necessary modules.  # Import the necessary modules.
773  from esys.pyvisi import Scene, DataCollector, Map, ImageReader, Image, Camera  from esys.pyvisi import Scene, DataCollector, Map, ImageReader, Image, Camera
774  from esys.pyvisi import GlobalPosition  from esys.pyvisi import GlobalPosition
# Line 824  Generate the movie. Line 853  Generate the movie.
853  A typical usage of \Movie is shown below.  A typical usage of \Movie is shown below.
854    
855  \begin{python}  \begin{python}
856    """
857    Author: John Ngui, john.ngui@uq.edu.au
858    """
859    
860  # Import the necessary modules.  # Import the necessary modules.
861  from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend  from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend
862  from esys.pyvisi import Movie, LocalPosition  from esys.pyvisi import Movie, LocalPosition
# Line 1198  This section shows more examples. Line 1231  This section shows more examples.
1231  \textsf{Reading A Series of Files}  \textsf{Reading A Series of Files}
1232    
1233  \begin{python}  \begin{python}
1234    """
1235    Author: John Ngui, john.ngui@uq.edu.au
1236    """
1237    
1238  # Import the necessary modules.  # Import the necessary modules.
1239  from esys.pyvisi import Scene, DataCollector, Contour, Camera  from esys.pyvisi import Scene, DataCollector, Contour, Camera
1240  from esys.pyvisi.constant import *  from esys.pyvisi.constant import *
# Line 1229  mosc1 = Contour(scene = s, data_collecto Line 1266  mosc1 = Contour(scene = s, data_collecto
1266          outline = True)          outline = True)
1267  mosc1.generateContours(0)  mosc1.generateContours(0)
1268    
1269  # Create a second DataCollector reading from the same XML file.  # Create a second DataCollector reading from the same XML file
1270    # but specifying a different scalar field.
1271  dc2 = DataCollector(source = Source.XML)  dc2 = DataCollector(source = Source.XML)
1272  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)  dc2.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA_2)
1273    
# Line 1256  for i in range(99, 104): Line 1294  for i in range(99, 104):
1294  \textsf{Manipulating A Single File with A Series of Translation}  \textsf{Manipulating A Single File with A Series of Translation}
1295    
1296  \begin{python}  \begin{python}
1297    """
1298    Author: John Ngui, john.ngui@uq.edu.au
1299    """
1300    
1301    # Import the necessary modules.
1302    from esys.pyvisi import Scene, DataCollector, MapOnPlaneCut, Camera
1303    from esys.pyvisi.constant import *
1304    import os
1305    
1306    PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
1307    PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
1308    X_SIZE = 400
1309    Y_SIZE = 400
1310    
1311    SCALAR_FIELD_POINT_DATA = "temperature"
1312    FILE_3D = "interior_3D.xml"
1313    IMAGE_NAME = "seriesofcuts"
1314    JPG_RENDERER = Renderer.ONLINE_JPG
1315    
1316    # Create a Scene.
1317    s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
1318            y_size = Y_SIZE)
1319    
1320    # Create a DataCollector reading from a XML file.
1321    dc1 = DataCollector(source = Source.XML)
1322    dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, FILE_3D))
1323    dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
1324    
1325    # Create a MapOnPlaneCut.
1326    mopc1 = MapOnPlaneCut(scene = s, data_collector = dc1,
1327            viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
1328            outline = True)
1329    mopc1.setPlaneToYZ(offset = 0.1)
1330    
1331    # Create a Camera.
1332    c1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
1333    c1.isometricView()
1334    
1335    # Render the object with multiple cuts using a series of translation.
1336    for i in range(0, 5):
1337        s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME +
1338                "%02d.jpg") % i)
1339        mopc1.translate(0.6,0,0)
1340  \end{python}  \end{python}
1341    
1342  \textsf{Reading Data Directly from Escript Objects}  \textsf{Reading Data Directly from Escript Objects}
1343    
1344  \begin{python}  \begin{python}
1345    """
1346    Author: Lutz Gross, l.gross@uq.edu.au
1347    Author: John Ngui, john.ngui@uq.edu.au
1348    """
1349    
1350  # Import the necessary modules.  # Import the necessary modules.
1351  from esys.escript import *  from esys.escript import *
1352  from esys.escript.linearPDEs import LinearPDE  from esys.escript.linearPDEs import LinearPDE

Legend:
Removed from v.1209  
changed lines
  Added in v.1210

  ViewVC Help
Powered by ViewVC 1.1.26