Mathematica/AVS modules PURPOSE These modules allow communication between Mathematica and AVS. With them one can transmit geometries and fields from Mathematica to AVS and fields from AVS to Mathematica. REQUIREMENTS Mathematica: V2.1 Mathematica or later. AVS: Pre-Version 4.0 AVS will need to modify the networks. TO BUILD Each directory contains C files, makefiles, a file of Mathematica code and a txt file. There are makefiles for different systems. The main difference between these is the command which is used to start a window in which to run the Mathematica session. This is xterm for a SPARC and dxterm for a DECstation. PROBLEM To build modules for other than the DECstation there is a name conflict for string_to_argv which is defined in both the MathLink and AVS libraries. This can be simply resolved by editing the MathLink library with an editor such as emacs and changing the two instances of string_to_argv with a name of the same length such as MLring_to_argv. The MathLink library is called libML.a and can normally be found in /usr/math/Bin.*/MathLink. TO USE When the module is invoked a window is started running Mathematica with the input and output of the window directed to and from the Mathematica session main loop. Entering Mathematica commands into the window will result in the appropriate Mathematica results. The session is initialised with a package of Mathematica commands which have started a MathLink communication channel to AVS. Other initialisations are made to support the behaviour of the particular module. The module will search for the package of Mathematica code, for example AVSGeometry.m, in the following order in directory math from the environment variable AVS_PATH in the environment variable AVS_MATH_PATH in /usr/avs/math in ~ in ~/AVS in ~/AVS/math in . in ./AVS in ./AVS/math if it fails to find the package in any of these an error will result. Thus the package should be installed in one of these places. The txt file is used for the documentation. This should be placed in somewhere which is on AVS_HELP_PATH for example in /usr/avs/math/help Each txt file contains a sample network to build as well as some sample commands to enter to the Mathematica to make them operate. COPYRIGHT You are free to copy and distribute these files. Feel free to modify and enhance them. This work was done at WRI by Tom Wickham-Jones and Oleg Perelet with help from Ham Lord and Robert Mazaika at AVS. Comments can be sent to: Tom Wickham-Jones twj@wri.com Oleg Perelet perelet@wri.com NAME field3 from Math SUMMARY Name field3 from Math Type Input Inputs NONE Outputs MathField3 - field 3D 3-space 1-vector uniform float Parameters Name NONE DESCRIPTION The "field3 from Math" module allows a three-dimensional scalar field to be supplied to AVS. When the "field3 from Math" module is invoked an xterm is started running Mathematica with the input and output of the xterm directed to and from the Mathematica session main loop. Entering Mathematica commands into the window will result in the appropriate Mathematica results. The session is initialised with a package of Mathematica commands which have started a MathLink communication channel to AVS. Other initialisations are made so that the Mathematica command AVSWriteField[ data] will write a three-dimensional scalar field to AVS. INPUTS There are no inputs to this module. PARAMETERS There are no parameterss to this module. OUTPUTS MathField3 - field 3D 3-space 1-vector uniform float EXAMPLE NETWORKS generate colormap field from Math | | | ------------------------------------------- | | --------------- ___________| color range | | | | | | field legend | |---------------- | | | | _________| |---------------------------- | | | | | | | -- isosurface | | geometry viewer The Mathematica commands data = Table[ x y z, {x,-2,2,.2}, {y,-2,2,.2}, {z,-2,2,.2}]; AVSWriteField[ data] will then run this network. RELATED MODULES There is a collection of modules which serve to connect Mathematica and AVS. Examples are geom_from_Math, field3_from_Math and field2_to_Math. SEE ALSO