TOC PREV NEXT INDEX

Using AVS/Express




1 AVS/Express Overview


This section introduces AVS/Express. It provides an overview of the operation of the systems and describes basic concepts that will be used throughout this manual. If you wish to start AVS/Express and skip the overview go directly to Chapter 2, Starting and Exiting AVS/Express.

This chapter discusses:

1.1 Overview

AVS/Express is an object-oriented, visual development tool that enables you to build reusable application components and sophisticated visualization applications.

In AVS/Express, the term "visual" has two meanings:

AVS/Express offers several ways to use components. You can:

AVS/Express provides full support for C and C++. Fortran support is also provided. Components can perform their processing by calling a C or C++ routine. Code template generators enable you to import user code and user data with little modification. A C++ class generator enables Developer Edition users to use the power of C++ programming to access AVS/Express components.

AVS/Express' development approach is object-oriented. AVS/Express supports many object-oriented techniques: the encapsulation of data and methods; class inheritance; templates and instances; object hierarchies; and polymorphism. Through the Network Editor, AVS/Express provides a visual interface to these techniques. In AVS/Express terminology, all application components, from lowest level to highest, are objects.

Working with AVS/Express

The AVS/Express environment has three main interfaces:

The Network Editor

The primary AVS/Express development tool is the Network Editor (NE). In the Network Editor, objects appear as rectangular icons. Using the mouse, you can assemble the objects you want for your application and draw connection lines between objects to indicate data references. Here is a portion of the Network Editor:




Note: This manual uses a white background in illustrations of the application workspace. The default background you will see when you start AVS/Express is a gray pegboard.

The top section of the Network Editor consists of libraries of objects. The bottom section is an application workspace, into which you drag and drop library objects to assemble an application or create new objects.

For more details about the Network Editor, see Chapter 3, Working with the Network Editor.

The Network Editor performs state save and restore operations using the V language, which is described in more detail in the following section.

V language

AVS/Express offers a text-based alternative to the Network Editor, called V. Like the Network Editor, V lets you view, add, delete, and edit objects.

You can use V in several ways:

Note: V is not a traditional programming language like C, BASIC, and so on. It does not define procedural programming constructs like flow of control, conditional operations, etc. In AVS/Express, if you need to write this kind of programming construct, you do it in a programming language that you already know such as C or C++. V maintains the state of objects: what objects are instanced, what connections exist, and the current values of parameters.

For more details about V and the VCP, see Chapter 7, V and the V Command Processor

The Network Editor versus Using V

When and why should you spend the effort to learn the V programming language? The Network Editor provides an interface that allows you to perform almost all of the tasks that can be performed through V. As with any visual interface, it can become cumbersome to perform repetitive operations using a point-and-click interface. In particular, when you are importing large numbers of modules that require detailed specification of attributes and parameters it may become tedious and hard to manage in the Network Editor. V is better suited to this activity. The Network Editor, however, is much better suited for constructing and editing macro objects because the visual display of the layout of modules and connections makes these relationships much easier to understand.

Application Programming Interfaces

AVS/Express allows you to integrate user code into an application. You can do this in essentially two ways:

AVS/Express has several tools to help you integrate user code. For example, AVS/Express' C++ class generator enables Developer Edition users to generate a C++ class that controls an AVS/Express object.

For more information see Chapter 9, Object Manager APIs

AVS/Express Kits

Component technology is the ability to create an application from reusable, modular pieces, or components. AVS/Express offers component technology through its wide assortment of predefined application components. AVS/Express enables you to create your own components or obtain components developed by others.

AVS/Express organizes its predefined components into collections called kits. AVS/Express offers these kits. For more information on the kits see the AVS/Express Toolkits manual.

1.2 Terms and Concepts

This section goes over the fundamental terms and concepts needed to utilize AVS/Express. Some of this will be repeated elsewhere as it is needed.

Objects

An AVS/Express application is composed of a hierarchical collection of objects. AVS/Express enables you to create AVS/Express objects and connect them to form higher level objects and applications.

Base Types

Each object is created from a base type that determines the low-level behavior of the object. Base types are grouped into six different categories based on the role that they play in defining applications:

Category
Base types
Description
parameters
byte, char, short, int, float, double, string, ptr, prim, group, enum
Maintain data usually operated on by methods. Data can be scalar, array, and hierarchical
method
omethod, cmethod, cxxmethod
Objects that interface directly to a C function or C++ method
link
link, mlink
Objects that route connections, often into or out of a macro or application object
module
module
Holds parameters and methods to implement objects that interface to C or C++ code
macro
macro, application
Holds combinations of modules, macros, and connections
library
library, flibrary
Holds collections of objects that you use to build your application

Templates

A template is a module, macro, or group object located in a library. Because it resides in a library, AVS/Express does not execute any methods contained in the object. You use template objects to build your application.

AVS/Express offers many predefined templates, such as those for building your application's user interface. You can create your own templates and place them, too, in a library. All objects in a library are templates.

Instances

An instance is an active copy of a template. AVS/Express executes the methods of any objects that you place in the active application (that is, open in the NE application workspace), such as SingleWindowApp. You can create any number of instances from a single template.

Object-Oriented Paradigm

AVS/Express is an object-oriented system that uses the prototype model. In the prototype model, you define types of objects in the same way that you define active objects themselves. The copy operation implements both the subclass operation and the construct operation. You also use the same syntax and methodology to edit active objects as you to do edit categories of objects. In the same way that a subclass inherits information from its superclass, an instance inherits information from its class.

To highlight the difference between these two models, AVS/Express uses the term template to describe what other object-oriented systems call class. This term more accurately describes the way that templates are used to "stamp out" new objects and reduces the confusion caused by existing meanings associated with the term class that conflict with how these concepts are implemented in AVS/Express.

Object-Oriented Techniques in AVS/Express

AVS/Express supports many object-oriented techniques: the encapsulation of data and methods; class inheritance; templates and instances; object hierarchies; and polymorphism. Through the Network Editor, AVS/Express provides a visual interface to these techniques.

Note: The extent to which you can dig down into an object hierarchy by opening objects is dependent on whether you are using the Developer Edition (which provides unlimited access to an object's hierarchy) or the Visualization Edition (which provides only limited access to an object's hierarchy).In the Visualization Edition, when you reach the limit of your ability to dig down within an object, only exported parameters will be visible in the NE (in Display List mode).
For example, isosurface, an object in the Data Visualization Kit, produces an isosurface of a set of field data. (An isosurface is a surface of constant value, similar to 3D contour lines.) isosurface includes a user interface for selecting the isosurface level. Here is what isosurface looks like in the Network Editor:
Figure A-1


By double-clicking on isosurface, you can maximize it to view its constituent objects:
Note: The following image is of a isosurface opened inside of a ModuleStack object.
Figure A-2


As you can see, isosurface is actually a collection of other objects, named IsoParam, IsoUI, Iso, and so forth. Many of these objects are themselves collections of objects. IsoUI, for example, contains objects from the User Interface Kit, assembled to define isosurface's user interface. If you wanted to change isosurface's user interface-for example, by replacing a slider with an entry field-you could open IsoUI and make the appropriate changes.
1.3 AVS/Express Object Hierarchy

There are five different types of AVS/Express objects: macro, module, parameter, method, and library. Each of these objects is a subclass of a common object type called simply object. These objects are all stored in a single tree structure called the object hierarchy.

In the object hierarchy, each object may have a list of subobjects and a single parent object. The subobjects of a module are parameters and methods. The subobjects of a library are macros, modules, and other libraries. The subobjects of a macro are modules and other macros. Methods have no subobjects. If a parameter has subobjects, they are also considered parameters.

These objects are joined together to form a single object hierarchy with the Root object containing Templates and Applications subobjects.



The figure below illustrates a sample portion of the object hierarchy. Assume for this example that the current application is SingleWindowApp and that you have instanced two objects in it, UIfield and int1.



Here is how the objects appear in the Network Editor:

Terminology

You use the following terms to refer to an object's position in the object hierarchy. (The table's examples refer to the previous figures.)

Table A-1
Term
Description and examples
Parent
The object immediately above an object.
Example:  x's parent is UIfield. UIfield's parent is SingleWindowApp. SingleWindowApp's parent is Applications. Applications' parent is Root.
Ancestor
Any object above an object.
Example:  x's ancestors are UIfield, SingleWindowApp, Applications, and Root.
Immediate subobject
(or child)
Any object immediately below an object.
Example:  SingleWindowApp's immediate subobjects are UIfield and int1. UIfield's immediate subobjects include x, y, and others.
Subobject
Any object below an object, at any level.
Example:  SingleWindowApp's subobjects are UIfield, int1, x, y, and the other subobjects of UIfield.
Sibling
(or peer)
Any object with the same parent as an object.
Example:  UIfield and int1 are siblings. x, y, and the other immediate subobjects of UIfield are siblings.

Projects and Your Development Environment

The object hierarchy includes other branches besides Libraries and Applications. Together, they define your development and execution environment. This environment is called your project. Each time you work with AVS/Express, you are working on a project. You can modify your environment by modifying the object hierarchy.

For details about working with projects, see Chapter 3, Projects and Processes.

1.4 Object Characteristics

You can think of an object as having a number of characteristics: name, derivation hierarchy, attributes, properties, and sub-objects. This section summarizes these characteristics.

Name

Each object has an identifying name.

A name can consist of letters, numbers, and the special characters '#' and '_'. In the Network Editor, the character '_' appears as a space. A name cannot be comprised only of numbers. Names are case sensitive.

Derivation Hierarchy

A group, module, or macro object can be derived from one or more template objects. This object inherits the subobjects and behavior of the templates from which it is created and then has the opportunity to modify this behavior. Since each template may itself be derived from other objects, the list of all objects that contribute to the definition of a particular object forms a tree. This tree is called the derivation hierarchy.

For example, say that you instance a UIfield object. The new object's derivation hierarchy originates with the template object UIfield. UIfield is derived from the object UIvaluator which is derived from UIprimitive which is derived from UIgeom and UIwindow. The object directly inherits the characteristics of UIfield, but indirectly inherits all of the characteristics of all objects in its derivation hierarchy.

In non-prototyping object-oriented systems, this is called the class hierarchy of an object.

See Inheritance and the Derivation Hierarchy on page 5-29.

Properties and Attributes

Properties and attributes both determine characteristics of the object on which they are set. You can set, examine, and change the values of both properties and attributes using either the Network Editor Properties Editor or directly through V.

Properties

A property is name-value association placed on an object. Properties names are usually defined by the system and relate to a specific aspect of object behavior. In V code, properties appear after the object name delimited by < and > characters.

Many properties control an object's appearance in the Network Editor, like the NEportLevels property which determines how ports are displayed for an object. Other system properties supply information for use with interfacing code to the system, or set the dimensions of arrays.

You cannot define properties as connections to other objects; they must be independent values.

Attributes

An attribute is a boolean characteristic that you can apply to an object to modify its behavior. A fixed set of these characteristics are defined by AVS/Express.

For a complete listing of AVS/Express properties and attributes, see Chapter 14, Properties, Attributes, Primitives, and Functions

Subobjects

Objects like groups, modules, macros, and libraries can have subobjects. A group, module, or library's subobjects are displayed in a list form. A macro's subobjects appear as a network of connected objects.

For more information on subobjects, see AVS/Express Object Hierarchy on page 1-10

1.5 Values and Connections

An object can have either an explicit value or may have a value that is defined in terms of a connection to another object.

The way assignments and connections work differs between primitive data objects and groups, modules, and macros:

Connections and Object Execution

An AVS/Express object can reference the data created by another object. This is called a connection. In the Network Editor, a connection typically appears as a line between two objects.

For example, here is a simple data-visualization application:

Figure A-1


Read Geom reads a data file and creates an AVS/Express field. Viewer3D provides a full-featured data viewer. The connection line specifies that Viewer3D should display the data created by Read Geom. Viewer3D does not copy Read Geom's data; rather, it references it, as seen in the figure below:

Figure A-2


In AVS/Express, connections not only define how an object gets its data, they also drive the execution of the application. When data changes, objects that reference the data are notified of the change. Typically, this causes the object to execute.

For example, consider the data visualization application consisting of Read Geom connected to Viewer3D. Say you or your end user decides to read a new data file. This causes Read Geom's data to change. Viewer3D, through its connection, is notified of the change. The notification causes Viewer3D to execute and render the new data:

Figure A-3


Order of execution is determined not by a set of procedural instructions or message-passing schemes that you would otherwise need to code, but rather by the connections you make among the application's objects.

When necessary, you can explicitly control execution. For example, you can indicate object dependencies, in cases where order of execution is important but ambiguous. Through a C or C++ routine, you can explicitly set notifications on objects to force their execution.

1.6 Object Manager

At the heart of AVS/Express is a powerful runtime engine called the Object Manager. You do not see it, but the Object Manager manages the definition and execution of your application.

The Object Manager:

The Object Manager underlies all the workings of AVS/Express. For more information on the Object Manager see:

1.7 Project Mechanism

AVS/Express has a sophisticated project mechanism. An AVS/Express project specified the collection of objects available for use during a session and thus defines your development and execution environment, including:

Working wIth Projects

AVS/Express operates on a single project at a time. When you first use AVS/Express, you access the install area's project, with its full complement of template objects from licensed AVS/Express kits. You do not modify the install project, but rather create your own project. The new project defines itself as being like the install project, with any additions and changes you make.

Project Chaining

You can define chains of projects, whereby a project is a derivative of some other project, which in turn is a derivative of yet another project. This allows developers to share objects, and to work on specific objects that are unique to their own development tasks.

Templates and Instances

AVS/Express implements object-oriented programming using a prototype style. In this style, objects in a library are not active (their methods are not called) but instead serve as templates for the construction of objects that are part of the application. Objects that are actively part of the application are called instances.

To create an instance from a template, copy an object from a library into an application. Using the Network Editor, this is done by dragging an icon from the Libraries area and dropping it into the Applications area. Templates and instances are defined and edited using the same basic mechanisms. A template similar to a class in a class/instance object-oriented system.



To create a subclass of a template object, make a copy of it. The subclass starts out as an identical copy but usually some additions or modifications are then made to differentiate it from the superclass. Creating a subclass is the same operation as creating an instance. The only difference is that for a subclass the destination is another library; for an instance the destination is an application.

Both subclasses and instances keep track of the template from which they were created so that future changes to the template will be propagated to the new object. This is necessary for inheritance to work properly.

For more information on Projects see Chapter 3, Projects and Processes

1.8 Application Components

In most object-oriented systems, the interface to an object consists of a set of methods (also called "messages") that the object supports. You call these methods to access the functionality of the object.

In AVS/Express, you need not directly be aware of the existence of any methods on an object. Instead the interface to an AVS/Express object is a list of named parameters. These parameters can be simple primitive values such as an array of three numbers specifying a color or an integer specifying the height of a widget. They can also be aggregate objects themselves such as an image that might contain width, height, and data.

Parameters can be connected to other parameters. A connection provides a conduit for the sharing of information between two objects. In many cases, a connection represents a lasting relationship of equality between two parameters. For example, by connecting a width parameter to a height parameter, you are guaranteed that width will always equal height.

As with most object-oriented systems, an AVS/Express object has methods which implement the behavior of the object but these methods are not exposed to you. The system executes them in response to events that occur on the parameters of the object. Objects can send messages back and forth across connections to other objects without your needing to manage this communication explicitly. Thus you do not have to know of the existence of the methods and do not need to manage the execution of the object. This is called execution encapsulation. In AVS/Express objects that have parameters and methods and have their execution encapsulated are called modules.

A module may have some parameters that are designed to be connected to other objects. The programmer gives these parameters ports. A parameter can have an input port, output port, or both at the same time. Ports are colored based on the data type of the object. Multi-colored ports can be used to indicate polymorphic objects (objects that can be used for more than one purpose).



Once you have several modules connected together, you can encapsulate this group to create a macro. A macro can export parameters of its modules so that they become parameters to the macro. They become the interface to the macro. Parameters that are not exported are considered part of the implementation of the macro.



A macro can contain other macros as well as modules so applications can be constructed out of progressively higher-level building blocks. Groups of objects and their connections are called networks and are edited visually using the Network Editor.

Since each object manages its own execution, the programming process is simplified. You instance and delete objects, and change parameter values either by making/breaking connections or by changing parameter values directly. You traverse the structure of the application visually and edit it using direct manipulation techniques. By making good use of macros, you can subdivide an application into manageable units of complexity.

1.9 Building Applications and Application Components

You can use AVS/Express to build a complete application. An application in AVS/Express is just a special kind of macro object that is not contained within other macros. The application object is usually created by AVS/Express when the process is started and is not destroyed until you exit the application.

One of the advantages of creating complete applications using AVS/Express is that your users can customize the application for a particular purpose using the Network Editor (of course, only if you provide them with this capability).

Building Application Components with AVS/Express

You can dynamically create and destroy an AVS/Express macro or module using traditional C, C++, or FORTRAN programming techniques. In this way, AVS/Express is useful as an environment for building libraries of component objects that are then used in traditional programming environments. Because the execution of the objects is still encapsulated, the programmatic interface to AVS/Express objects is just as easy from C, C++, or FORTRAN code as it is from the Network Editor. A program can create objects, make connections, and change parameter values. The execution of the underlying methods that are triggered by parameter changes are controlled by bracketing these changes with begin/end calls named OMpush_ctx and OMpop_ctx. The OMpush_ctx call puts execution of these methods on hold. When the OMpop_ctx call returns, the methods have all been executed.

For C++ programmers, AVS/Express will generate C++ wrappers for specified AVS/Express objects that provide simple and natural bindings for these objects.

For C programmers, the objects can be created, destroyed, and modified using the Object Manager programming library. This library provides a set of routines that provide complete flexibility over AVS/Express objects.

See The C and C++ APIs: Overview on page 9-4 for more information.

For FORTRAN programmers, the objects can be created, destroyed, and modified using the Object Manager FORTRAN programming library. This library provides a set of routines that provide comprehensive flexibility over AVS/Express objects.

See The FORTRAN API: Overview on page 9-73 for more information.

Adding Modules to AVS/Express

AVS/Express provides support for you to add your own modules to the system. When you add modules to the system, you define the list of parameters and methods for a particular module, then specify which events should cause which methods to execute. A module's methods can execute when the object is instanced, destroyed, or when one or more parameters are changed. When a method is executed, it can determine which parameters have changed since the last invocation and can change one or more other parameters.

By adding a collection of modules, you can use AVS/Express to provide a visual programming interface to an existing library of code.

See Adding New Modules on page 8-2


TOC PREV NEXT INDEX