TOC PREV NEXT INDEX

Getting Started with AVS/Express Developer Edition


A - B - C - D - E - F - G - H - I - L - M - N - O - P - R - S - T - U - V - W


11 Creating and Compiling an Application


In this chapter, you assemble a finished application and compile it.

In this chapter you:

11.1 Introduction

In this final chapter, you create a finished Echo Sounding application and package the application into a special kind of object called an application. Once the application is packaged, you can then save the application object as a compiled, stand-alone project that can be delivered to a customer and executed.

11.2 Start AVS/Express
n If you are no longer in AVS/Express, start it now with the myproj project.
express -project myproj
bin\pc\express -project myproj

Depending on where you saved myproj, you may need to specify a pathname.

AVS/Express begins and loads your project.

n If you are still in AVS/Express from the last chapter, delete the current application workspace.
To delete the current application workspace, select File->Delete Application.
n Load the Single-Window DataViewer application
To load the new application workspace, select File->New Application and select Single-Window DataViewer from the New Application dialog.

You use the DataViewer application in order to take advantage of the viewer and the visualization editors built-in to this application.

11.3 Assemble the Application

Assemble the application
Save the application as a compiled project

In this section, you assemble the finished Echo Sounding application. The application:

Assemble the Application

You are now ready to assemble the Echo Sounding application.

1. Assemble the Echo Sounding objects in the SingleWindowApp workspace, as shown in the diagram below.
Instance EchoUI, EchoReader, Echo. Position the objects as shown so connection lines will be clear. When you instance EchoUI, the application's user interface appears.
Connect the objects as shown. When you connect EchoUI to EchoReader, the reader executes and an error message appears because you have not yet selected a data file. You can dismiss the error message. To get information about an object's ports, select the Info popup command for the object.
Figure K-1


Map the Data to a Field

As currently assembled, your application allows a user to read in a file of data and calculates a depth value for each pair of time and distance parameters.

To render the data you need to map the location data, output from EchoReader, and the depth data, output from Echo, to an AVS/Express field data format that can be passed to the viewer.

To map this data to a field, you connect AVS/Express objects that

1. Map the data to field components. To do that instance the node_scalar and point_mesh objects into the application workspace and connect them to EchoReader and Echo as shown below.
Figure K-2


Both are on the Main library page in the Field Mappers library. node_scalar is in the Data Mappers sublibrary, and point_mesh is in the Field Mappers sublibrary. Remember you can use the Object Finder to go directly to an object.
point_mesh references the location data from Echo_Reader and outputs the data in a coordinate mesh.
node_scalar references the depth data calculated by Echo and outputs data a node data.
Next you will combine the field components into a single field.
2. Instance the combine_mesh_data object and select the Info popup command.
The combine_mesh_data object is also in the Field Mappers library, but in the Combiners sublibrary.
The Info dialog displays the following information:
Figure K-3


Notice that the module takes a mesh and node data as inputs and outputs a Mesh+Node_Data field. You connect the point_mesh output to the in_mesh port and the node_scalar output to the in_nd port.
3. Position and connect combine_mesh_data as shown.
Figure K-4


As a last step you add and connect an object that converts the scattered grid represented by this field into a triangular mesh that can be rendered by the viewer.
4. Instance the scat_to_tri object and connect it as shown below. scat_to_tri is on the Main library page in the Mappers library.
Figure K-5


AVS/Express generates some error messages when you connect these objects because you have not yet selected a data file.

Your finished application should look like this.

Figure K-6


Test the Application
1. If necessary, restore the Echo and SingleWindowApp DataViewer windows.
2. In the Echo window, select the File->Open pulldown command.
A file-selection dialog appears.
3. Navigate to install_dir/getstart, select the file called echo.dat, then select the OK button.
The data appears in the viewer window.
Figure K-7


Modularize the Mapper Objects

In order to reduce the complexity of the objects that appear to the user, you modularize the mapper objects by encapsulating them in a macro object.

1. From the Standard Objects library, instance a macro object into the application workspace.
2. Rename the macro "EchoField".
3. Remove the connections to the input ports on point_mesh and node_scalar, and to the output port of scat_to_tri.
Figure K-8


4. Reparent the mapper objects into the macro by selecting point_mesh, node_scalar, combine_mesh_data, and scat_to_tri and dragging them into the macro.
Figure K-9


5. Maximize the macro and position the objects so you can see all of them. Remember you can move all the objects at once by holding down the Shift key while using the middle mouse button.
Figure K-10


6. Export the ports that were connected in the application: the input ports on point_mesh and node_scalar, and the right output port on scat_to_tri.
Figure K-11


As before, for the purposes of this illustration we have reduced the height of the application workspace. You do not need to change the size of your Network Editor window.
7. Minimize the macro and notice the ports displayed.
Figure K-12


8. Go to the Library Workspaces page and move EchoField to Workspace1.
9. Save your project.
Select Project->Save.
10. Instance EchoField back into the application workspace and connect it as shown below.
Figure K-13


Notice that the application works as before.
Create an Application Object

An application object represents a completed application. In this section, you create an application object and save the object in a library.

The SingleWindowApp workspace is itself an application object. Since your network is already in an application object, you can simply rename SingleWindowApp and save it in a library. This is what you will do in this section.

SingleWindowApp is special in that it contains some hidden objects that define the DataViewer window. When you use SingleWindowApp as your application object, your application automatically includes the DataViewer editors and viewer. If you did not want the DataViewer as part of your application, you could have built the application in a different workspace, such as DefaultApplication. Or you could instance an empty application object from the Standard Objects library page, then move your application into that object.

For your application, you use the SingleWindowApp workspace.

1. Rename SingleWindowApp to EchoApp.
Figure K-14


To rename the application, move the mouse pointer to the SingleWindowApp title bar and use the Rename popup command.
2. Close EchoApp.
To close the object, either double-click on its title bar or select the Close pop-up command.
EchoApp now appears closed within a container object called Applications.
Figure K-15


3. Go to the Library Workspaces library page.
4. Drag EchoApp into Workspace 1.
Figure K-16


Notice that the application is no longer in the Applications container object, so AVS/Express no longer executes it. The user interface window, View window, and Module Stack window all disappear.
5. Save your project.
Select Project->Save.
6. Execute your application again by instancing it into Applications.
Save Your Application to a V File

You can save an application object to a V file. This enables you to execute it at AVS/Express start-up.

7. Maximize EchoApp (the one under Applications).
Move the mouse pointer to EchoApp's title bar, then either double-click on the object or select the Maximize popup command.
8. Select File->Save Application.
9. Save the file, giving it the name EchoApp.v.
AVS/Express saves the application as a V file.
10. Exit AVS/Express by selecting the File`Exit pulldown command.
11. Restart AVS/Express, specifying the name of the project and the name of the application's V file.
express -project myproj EchoApp.v
bin\pc\express -project myproj EchoApp.v
Note: AVS/Express searches for the application v file that you specify in the current directory and then in the 'v' subdirectory of your project directory. If you have saved the application to another location, you must specify the path to the application file, for example:
express -project myproj /usr/express/apps/EchoApp.v
AVS/Express loads your project, then executes the objects in the specified V file. The application appears on your screen, including the user interface for selecting a file, the Module Stack window, and the View window. The Network Editor does not appear.
12. Try out the application.
Open the data file through the user interface. To exit the application, select the File`Exit pulldown command from the Echo window.
11.4 Save the Application as a Compiled Project

Create an application
Save the application as a compiled project

One way to save an application is as a compiled project. AVS/Express creates a standalone project directory, including a standalone version of the express executable. The project contains only those objects used by your application. This makes the project smaller and more efficient. In a real-world application, this is what you would deliver to your customer.

In this section, you save EchoApp as a compiled project.

Note: To compile EchoApp as a stand-alone application, you must have a C++ compiler because you will be rebuilding the express executable. Also, the Visualization Edition of AVS/Express does not allow you to save applications as compiled projects.

You want all of the application's modules to run in the express executable. But for EchoReader, you specified that its process was "user". So you must change EchoReader's process property from "user" to "express".

1. If you exited from AVS/Express, start AVS/Express using your project.
express -project myproj
bin\pc\express -project myproj
2. Go to the Library Workspaces library page.
3. Change EchoReader's process property from "user" to "express".
Move the mouse pointer to EchoReader in the Workspace 1 library and select the Properties popup command. The Properties Editor appears:
Figure K-1


In Current Properties, select the process property so its current value appears in the Value field:
Figure K-2


Change "user" to "express". Remember to include quotes. Press Enter or the Set button to assign the new value. Current Properties should now look like this:
Figure K-3


Select the OK button to apply the new setting.
You are now ready to save a compiled project.
Note: If you now attempt to instance EchoReader in your current project, you will get an error message. AVS/Express will look for EchoReader's update function in the express executable, because that is now where the process property says it is located. But it is really in the user process.
4. Select EchoApp in Workspace 1, highlighting it in blue.
You may have to scroll down to find EchoApp.
Figure K-4


Highlighting an application object tells AVS/Express which one you want to save.
5. Select Project->Save Compiled Project.
The Save Compiled Project dialog appears. You can accept all of the default settings. You only need to supply the name of the project directory AVS/Express should build.
6. In the Directory Name field, enter the full pathname where you want to store the project directory.
You can use the Browse button to navigate. The Directory Name field must not specify a relative pathname.
The sample below indicates that you want to create a compiled project directory called EchoProj in /home/joe/. (On UNIX systems, you need to press Enter after entering the directory name.)
Figure K-5


7. Select the OK button.
AVS/Express creates a standalone project directory containing a new express executable. The executable contains only the objects required for the Echo Sounding application.
AVS/Express displays a window containing informational messages. At the end of a successful compile, you see the following message:
-------- Hit return to close
You can close the window.
You can now execute the application.
8. Exit AVS/Express by selecting File->Exit.
9. Navigate to the new project directory, for example:
cd /home/joe/EchoProj
10. Execute express in the compiled project directory.
bin/<machine_type>/express
where machine_type is the platform you specify for the MACHINE environment variable.
bin\pc\express
11. Test the application.
When you are finished, select File->Exit to exit.
11.5 For More Information

TOC PREV NEXT INDEX