Mario Valle Web

An introduction to AVS/Express user

This is a really quick introduction to the AVS/Express visualization environment. It is not a complete course, but I hope at least it makes you curious and let you start experimenting with the tool.

Here are some buzz-phrases related to AVS/Express. Besides the marketing flavor, they accurately describe the tool main characteristics:

  1. AVS/Express is a development environment. It is not an end-user, point-and-click visualization tool. That means more power, but also more complexity
  2. 3D visualization. Charting and 2D are supported, but not at the same level.
  3. Object oriented. What you see are really a bunch of classes. You derive, instantiate, call methods and so on.
  4. The programming is mainly done visually, combining and connecting modules in a LEGO-like fashion.

To know more about AVS/Express and the projects that use it take a look at the AVS/Express links list.

In three hours we can scratch only the surface of AVS/Express, but today the goal is mainly to gain confidence, see what could be done and learn where to go to find more information.

This exercise is not as simple as it appears.

Ask help to finish the installation of the software and the activation of the license on your machine.

Then go to the next slide to see how to launch it.

Here are the run methods on various platforms and a two seconds tutorial.

What you see when AVS/Express starts?

When you start AVS/Express a dialog let you choose the type of application you want to start with or let you open a previously saved application. For now choose the default (Single-window DataViewer and 3D).The two windows that open are:

The Network Editor – with the module library and the working area.

The Data Viewer – whose parts are explained in the next slide

The Data Viewer is made by four parts:

The Viewer itself

A Toolbar to access commonly used functions like setting the mouse interaction behavior or the "magic" button RNC (Reset/Normalize/Center) that puts again the scene content inside the viewer limits.

An area in which the module user interface panels appear. In the same area open the various Editors

A status panel with the interrupt button (bottom left)

The example image is the result of the LEA (Lagrangian-Eulerian-Advection) module for the visualization of time dependent 2D vector fields. This module is available in the International AVS Centre (IAC) repository.

The editors menus is the entry point for various viewer-related control functions. For example here you can change the background color of the viewer or its dimensions.

The interfaces to various AVS/Express functions are called editors.

Some of the editors operate on the selected graphical object. So remember to select the one you want to modify with Editors -> Object.

The most important libraries of modules are:

Start for the beginners

Main common visualization techniques

Standard objects primitive data types

User Interface user interface widgets

Annotation Graphing charting 2D

Examples visualization techniques usage examples

Library Workspaces parking place for user developed modules

Data importing is the first step of every visualization jobs.

Here are the available options in decreasing easiness order:

  • Use a built-in AVS/Express reader
  • Import an ASCII table
  • Create a .fld file that describes the data
  • Add File Import Module
  • Use another publicly available reader for various formats
  • Write a custom reader

AVS/Express provides not only visualization (output) modules, but also modules that interact with the visualized data.

Always remember that the visualization goal is to understand the data as a whole, its global patterns and trends. Instead those tools made possible the access to a precise single value.

Often the final goal of visualization is to present something at a congress or to support a paper. AVS/Express can export images and animations. Here are some chemistry examples.

The most interesting feature of AVS/Express is the manner in which execution of the various modules is managed.

It is called data-flow architecture.

In this architecture you do not manage execution. You simply describe the data passing architecture between processing modules.

Each module starts executing as soon as all its input data are valid or are changing.

At the beginning everything is quiescent.

Then you enter a filename for the Read Field module.

The Read Field module starts executing and outputs valid data on its output port.

Then the Surf Plot module has all its input ports connected to valid data so it starts execution.

The Surf Plot module then produces valid data on its output port.

Instead the Texture Mesh module, that has two input ports, remains idle because only one of its input ports has valid data.

Then you enter a valid filename on the Read Image GUI.

Read Image executes and produces data on its output port.

Then the Texture Mesh module senses valid data on all its input ports, so it starts executing.

The Texture Mesh red output port carries valid data when the module finishes execution, so the viewer module can start execution and shows the resulting visualization on screen.

And here is the final result. Funny, isn't it?

The whole idea of the data-flow architecture is to simplify the programmer job letting him (and better, her) concentrates on the data manipulation tasks and not on program structure issues.

The data-flow networks are built in the working area called the Network Editor.

Drag needed modules from the libraries to the working area (Network Editor: NE). The modules are connected "drawing" the connection. Drawing the connection again disconnects the modules. To access the interior structure of a module, double click on it. The contextual menu has various functions:

On modules "Help" and "Info" are useful.

On NE: "Arrange Icons".

On a connection: "Insert Link" helps "see" what pass on the connection.

On the NE: Shift-M2 (on PC Shift-ButtonLeft) Pan; Ctrl-M2 (on PC Ctrl-ButtonLeft) Zoom.

If you are not very imaginative try: Examples -> Visualization -> Orthoslice

Open the module and disconnect the red link (by redrawing the connection). What happens?

Here are the important components of your first network.

The reader is in the Main library. The fading background module is in Main -> Geometries.

The Object Manager manages the module execution order, the data movement between modules, etc. It is the heart of AVS/Express.

The Object Manager has three interfaces:

The Network Editor graphical one

An API for C, C++ and Fortran

The V language

An example of V language is in the ex1.v file created in the previous exercise. Today we do not cover the V language, but remember that is the V language that makes AVS/Express so powerful.

V language statements and Object Manager commands can be entered at the VCP prompt, the one appearing in the window where AVS/Express has been run that looks like: OM(Root) ->

To modify a graphical object properties:

  1. Select the object with the "Select Object…" button or with Ctrl-Click on the object in the viewer.
  2. Select the Object editor. Then modify Modes (rendering mode of the various graphical primitives) or Properties and then Type: Surface, for example, to change object opacity.

Top, in the graphical object list opened with the "Select Object…" button, represents the root of all the graphical objects appearing in the scene.

With the mouse you can move the object, the camera or the lights (the mode is selected with the first three buttons on the Toolbar) in the viewer.

Lights have their own editor. The second button from right on the Toolbar changes them to bidirectional.

To speedup the manipulation of graphical objects, they can be substituted by an Alternate Object during manipulation (sixth button from right).

Camera orthographic projection (default) made possible measurements in the viewer, but it is not so "good looking" like the perspective projection. This can be selected with the 3rd button from right.

The light editor toggle "Show Lights" visualize a small arrow to show light direction.

An example of scatter grid: conc.dat

What changes a bunch of points into a surface or a volume is connectivity.

Connectivity specifies how each point is connected to other points to form cells.

For example if I connect the points three by three I obtain a surface composed by triangles. Similarly I obtain a volume connecting points four by four to obtain tetrahedra.

We will use the unstructured grid example2.inp and any of the AVS/Express UCD examples.

We will use also the uniform grid splash.fld or any image as examples of 2D uniform grids.

An example of 3D uniform grid is brain128.fld, a brain NMR

An example of structured grid is the AVS/Express example file bluntfin.fld (top left).

A quick recap of the various geometries possible for scientific data.

One thing that changes between them is quantity of information needed to describe the geometry.

Scatter only point coordinates

Unstructured point coordinates plus connectivity

Structured is a deformed regular grid; besides points coordinates only row and column (and planes) numbers are needed

Rectilinear besides row and column (and planes) numbers, only coordinates along the axis are needed

Uniform besides row and column (and planes) numbers, only coordinates of two points are needed

AVS/Express supports this set of cell types.

AVS/Express defines a data type to describe all those configurations. It is called Field.

Beware! AVS/Express uses the word field for three distinct concepts:

  1. The data type itself
  2. The file format that can describe a uniform, rectilinear or unstructured geometry
  3. One of the User Interface widgets used to enter numerical information

If you are curious to see as a field looks like, instantiate the module Main -> Visualization -> Field Schema -> Field and open it.

The grid is simply composed by the points coordinates.

Data associated to the points are under node_data.

Everything related to the connectivity lives in the Mesh. Various groups of cells can be contained in the same field. For example every kind of cell forms a group. The groups are called Cell Set.

This structure can be described as a Structured mesh with 2 columns and 5 rows or like an Unstructured mesh with 1 cell set of type Quad.

One or more data can be associated to a cell.

There are less modules operating on cell data respect to the ones operating on node data. Often it is better to convert cell data to node data with the cell_to_node module.

Unstructured fields offer the maximum possible data description flexibility but with an increased complexity. To simplify unstructured fields creation use the modules under Main -> Field Mappers -> Mesh Mappers.

Going from more complex to simple: Structured mesh has implicit connectivity, so it is not necessary for the user to provide it.

Rectilinear meshes needs only coordinates along the axis, not every point coordinates.

Uniform meshes compute node coordinates starting from only two points.

By default also those coordinates are not needed. The mesh assumes a unit spacing between row, column and planes.

We do not cover time dependent fields. The AVS/Express example "Time Data" shows how they behave (to run it: set Loop Cycle Options to Bounce and push Run).

Now we import a field (.fld) format file that describes a uniform Field.

Beware! The .fld file (splash.fld) does not contain the data. It only describes it and points to the data file splash.asc . Both file should be present on your machine for the next exercise.

Use the conc.dat file.

Have you downloaded the files?

FLD Wizard is a small utility that helps writing the .fld file that describes your data. It is a little rough, but works.

Download the AVS UCD (Unstructured Cell Data) format file example2.inp

A funny and simple texture example.

Another realistic example is an aerial photograph put on top of a digital terrain model (DEM). Beware! Set the "Flip Image" toggle in Read Image. Otherwise you will find the sea on top of the mountains!

Other parameters you can set:

Vertical scale: 0.2

Editors -> Object -> Texture -> Interpolation: Bilinear.

What changes?

The Image Capture module creates a movie with the view images captured every time the view content changes. A second step converts the captured frames into a MPEG or AVI formatted movie file. (Don't try to use AVI Compressed under Linux: the codec used is not commonly available).

Use the animator module to automate movie creation. You define some Key Frames and then the module interpolate between them.

Beware! Before using the movie for a congress presentation verify that it can be read on the presenter machine! Remember that the standards are nice because there are a lot of them…

The loop is closed by the Complete button. It is after the + and - ones.

There are various methods to customize AVS/Express. Before developing anything, verify that the functionality you need is not already provided by AVS/Express.

Macro is a container and is found under Standard Objects library.

Once you create a module, save it in the Library Workspaces: simply drag it there. From now on you can use it as any other AVS/Express module.

Beware! If you exit the application now, you lose all the customizations made (i.e. all your developed modules). Always save the project if any customization has been made.

The mechanism employed to save customizations is called project.

To create new projects do the following: Project → Save As… and enter the name of an empty or non-existent directory.

The slide shows what is contained in the project directory (here called prj). The two most important things are the file avsenv (AVS/Express uses it to find all its pieces) and the file v/templ.v that contains all the changes made to the libraries (an important change is the code for the modules added to the Library Workspaces).

To reload a saved project start AVS/Express from the project directory.

If you need to move the project directory or the AVS/Express installation directory remember to update the avsenv file.

The current project name is written to the console during AVS/Express start and in the window title bar of the Network Editor.

The project structure can be described as a stack of semi-transparent planes. What is found in the project directory is not searched in the AVS/Express installation directory that is found behind.

Be careful when you name files in a project directory (try to create a file called app.v in the project directory and then run AVS/Express… After the deadly end delete app.v and v/app.vo to restore normality).

This project structure enable various developer to work on the same application without interfere each other and with the guarantee that are using only certified modules.

Beware! Saving the application does not save AVS/Express customizations!

Save Application: Menu File -> Save Application. A .v file is created

Save Project: Menu Project -> Save. Update the v/templ.v file under the project directory.

Here is an example of customization of an existing AVS/Express module.

User interface creation follows the same paradigm as any other AVS/Express network. The only difference is that the green connection (parent) does not show a data connection, instead it a container / contained relationship.

UIapp creates an independent window. Otherwise UImod_panel creates a window that automatically appears in the Data Viewer module GUI area.

The Layout Editor is enabled from the menu (UI Builder -> Layout Editor). On PC select a widget with a double click and then dragging it with left button. On Linux selection and drag are done with the middle mouse button. At the end remember to disable the Layout Editor from the menu.

Now we see how to quickly add user code to AVS/Express.

A Wizard creates a set of supporting files plus a skeleton in the programming language chosen. In this skeleton the user code should be added. Then this code is incorporated inside AVS/Express in a new executable created under the current project. This will be the executable to run, not the one under the AVS/Express installation.

The first wizard step (run from the menu Object -> Add Module) defines some general properties of the module.

After that the various methods (routines) are defined.

All the parameters are defined in both the data characteristics and behaviors. A parameter behavior defines which method should be fired when the parameter changes. This is the foundation on which the network relies for execution and not on a description of the activation procedure for the modules.

The last wizard step defines some compilation parameters. The build files are generated by AVS/Express itself using the parameters defined in the wizard. Any non-necessary manual editing is overwritten each time.

The interface between your code and AVS/Express is composed by two layers: the V module definition and the C (C++ or Fortran) routine skeleton. Initially this skeleton only contains Object Manager API routines to pass module parameters to and from the user code.

C++ is the natural language to write AVS/Express modules: the interface complexity is hidden.

The fact that a module definition has a V language part should remind you to save the project after defining a new module.

Hope you have enjoyed the course…

Contact me if you need help at: [my e-mail]

AVS homepage

AVS forum

International AVS Center (IAC)

IAC training material

Patches, documentation and examples

AVS/Express built-in examples

AVS/Express Visualization techniques manual

Customer projects

Links to training materials, projects developed with AVS products

AVS/Express readers list

AVS/Express Performance Optimization Tips and Tricks

Other AVS/Express links