Surface Evolver Documentation

Surface Evolver Aquisition and Installation

The Surface Evolver is available free of charge. There are versions for several systems: For all versions:

Documentation

The complete manual in PostScript form is available in manual.ps. There is a TeX dvi version in manual.dvi. The archives ev-html-tar.Z or ev-html.zip contain this browsable documentation, which includes most of the printed manual (except for highly mathematical parts). You should get the HTML files even if you don't have a Web browser, since the Evolver's on-line help command takes extracts from the HTML files.

Unix version


EVOLVERPATH environment variable

Evolver needs to find the initial data file and sometimes other files (e.g. command files for the "read" command). If the named file is not in the current directory, then an environment variable called EVOLVERPATH will be consulted for a directory search list. The datafile directory and the directory with these HTML files should definitely be included. The format is the same as the usual PATH variable.

Set it up as usual in your system, in .profile or .login or .cshrc or wherever:

Unix C shell:

             setenv EVOLVERPATH /usr/you/evolver/fe:/usr/you/evolver/doc
Bourne shell:
             EVOLVERPATH=/usr/you/evolver/fe:/usr/you/evolver/doc
             export EVOLVERPATH
DOS and Windows in autoexec.bat:
             set EVOLVERPATH=c:\evolver\fe;c:\evolver\doc
Windows NT users can use the Control Panel System window.

Unix compilation

Change to the src subdirectory of your Evolver directory. First, you need to modify Makefile for your system. Makefile begins with sets of macro definitions for various systems. If your system is listed, remove the comment symbols '#' from start of your definitions. If your system is not there, use the GENERIC defines, or set up your own. If you do define your own, be sure to put a corresponding section in include.h. Edit CFLAGS to have the proper options (optimization, floating point option, etc.). GRAPH should be the name of a screen graphics interface file. GRAPHLIB should be the appropriate graphics library plus any other libraries needed. Check all paths and change if necessary for your system.

If you want Evolver to be able to use geomview, include -DOOGL in CFLAGS.

If you want Evolver to operate in a higher space dimension n than the default maximum of 4, include -DMAXCOORD=n in CFLAGS. This sets the upper limit of dimensionality, and is used for allocating space in data structures. You can use -DMAXCOORD=3 to save a little memory.

If your system supports the long double data type, you can compute in higher precision by compiling with -DLONGDOUBLE in CFLAGS.

You can let the compiler optimize better if you hard-wire the space dimension into the code with the compiler option -DSDIM=n, where n is the desired dimension of space. But such an Evolver can handle only the given space dimension, nothing higher or lower.

Silicon Graphics systems with multiple processors may compile a version that will use all processors for some calculations by including -DSGI_MULTI in CFLAGS. This version will run fine with one processor, also. Currently, the only calculations done in parallel are the "named quantities". The number of processes actually done in parallel can be controlled with the -pn command line option.

The file include.h lists the include files for various systems. If your system isn't listed, you will have to put in a list of your own. Try copying the generic list (or one of the others) and compiling. Your compiler will no doubt be very friendly and helpful in pointing out unfound header files. include.h also has various other system-specific defines. See the GENERIC section of it for comments on these, and include the appropriate ones for your system.

Now try compiling. Hopefully, you will only have to change the system-specific parts of Makefile and include.h to get things to work. If significant changes to other files are needed, let me know.

Test by running on the cube sample file as described in the Tutorial.

Screen graphics interfaces

The Surface Evolver has simple built-in screen graphics (besides geomview). One of the following files should be included in the compilation:
xgraph.c X-Windows graphics interface
iriszgraph.c Silicon Graphics GL graphics (not OpenGL yet)
irisstereo.c does GL stereo displays on Silicon Graphics so equipped
hpzgraph.c HP 98731 graphics
gnugraph.c graphics for DOS DJGPP version
nulgraph.c no screen graphics

Installing geomview

For viewing graphics, if you have a Silicon Graphics machine or X-windows, you should get the geomview package from The Geometry Center. There are pre-compiled binaries for many unix systems here. Follow geomview's installation directions, and make sure that geomview is accessible through your PATH. NOTE: The X windows versions of geomview seem to require some event to occur in the geomview display window before it will redraw after loading a new datafile. So if geomview seems hung, just run the mouse over the window to give it an event to wake it up.

MS-Windows 95/98, Windows NT

Download the relevant files.

Set the environment variable EVOLVERPATH to contain all directories that you want the Evolver to search when looking for files (the current directory is always searched first).

This is my first Windows program, so it is a bare bones port. No bells and whistles like pull-down menus or icons. For both versions, you have to start the graphics window with the 's' command. In the graphics window, you can use the mouse to move the surface. Simply press the left mouse button and drag the object as if it were a trackball. When you release, the object will redraw. There is also an OpenGL version for Windows 95/98/NT that has screen graphics much like geomview. Get this version if you can run it!! Hit the 'h' key with the mouse focus on the graphics window to get a summary of the commands.

One major difference between the Windows and unix versions is that in the Evolver command language in Windows piping is to files, not commands. So do

    list vertices | "vlist.txt"
rather than the unix version
    list vertices | "cat >vlist.txt"

MS-DOS version

There is an old version of the Surface Evolver that runs under MS-DOS. This version of the Surface Evolver runs in 32-bit mode. It was compiled with the DJGPP DOS Extender version of the GNU C compiler from the Free Software Foundation. It does not run under Windows. There are separate Windows versions.

To install, download the relevant files. Set the environment variable EVOLVERPATH to contain all directories that you want the Evolver to search when looking for files (the current directory is always searched first).

Evolver requires go32.exe to be available on your path. This is the DOS extender interface, and is included in this archive. You need at least a 386 with math coprocessor. Since it uses extended or expanded memory, there may be conflicts with your memory manager. Try it with your regular setup, and if it bombs, boot vanilla DOS and try.

The command line is the normal

c:> evolver filename 
If you use a path for the filename, use front slashes, as GNU is unix-like:
c:> evolver e:/data/cube.fe

VGA graphics are included (see Video section below). If you have a mouse, then in graphics mode you can use the mouse to move the object. Simply press the left mouse button and drag the object as if it were a trackball. When you release, the object will redraw. Hitting any key exits graphics mode to the "graphics command" prompt, from which "q" will return to the main prompt.

One major difference between the Windows and unix versions is that in the Evolver command language piping is to files, not commands, in the DOS version. So do

     list vertices | "vlist.txt"
rather than the unix version
     list vertices | "cat >vlist.txt"
Also the 'system' command will run a program, but does not return to the Evolver when that program exits, so it is not very useful.

Beware of leftover swap files building up in your tmp directory due to crashes.

From the DJGPP README file, about video drivers:

The GO32 environment variable:

This variable controls the options available in go32 or debug32.  The
syntax of this variable is:

  SET GO32=[parm [value]] [parm [value]] . . .

Parameters:

  ansi           Use ANSI commands to control the color in debug32
  mono           Use the Monochrome monitor for debugging - useful when
                   debugging graphics applications
  1rm            Redirect stdout (file #1) to the monochrome monitor
  2rm            Redirect stderr (file #2) to the monochrome monitor
  1r2            Redirect stdout (file #1) to stderr (file #2)
  2r1            Redirect stderr (file #2) to stdout (file #1)

  glob           enable globbing (default)
  noglob         disable globbing

  emu [path]     Use the specified file as the 80387 emulator

  driver [path]  Use the specified file as the graphics driver
  gw [width]     Default graphics width
  gh [height]    Default graphics height
  tw [width]     Default text width
  th [height]    Default text height
  nc [colors]    Number of colors (for new-style drivers only - see cbgrx*.zip)

These parameters may occur in any order.

Note that "1rm" and "2rm" are done before "1r2" and "2r1", so "1rm 2r1" sends
stdout to the mono monitor and stderr to any redirection used.

Examples:

  C:\> set GO32=mono driver c:\djgpp\drivers\tseng4k.grd gw 1024 gh 768 tw 132 th 43 nc 256
  C:\> set GO32=ansi
  C:\> set GO32=driver c:\djgpp\drivers\tseng4k.grd ansi
  C:\> set GO32=mono 1rm 2rm

End DJGPP README excerpt.
The new-style VGA driver stdvga.grn is included in this archive. Also the driver et4000.grn, which works on my machine for higher resolution. The environment variable I use is
set GO32=driver c:/djgpp/drivers/stdvga.grn gw 640 gh 480 nc 16
or
set GO32=driver c:/djgpp/drivers/et4000.grn gw 1024 gh 768 nc 256
Video: Standard VGA can do 320x200 with 256 colors or 640x480 with 16 colors. The mode is set with the GO32 environment variable just described. In 256 color mode, 16 colors in 16 shades are available. In 16 color mode, you may have either 16 colors or 16 shades of gray. The 16 colors is the default. To switch back and forth, do
   facet_colors off
   shading on
or
   shading off
   facet_colors on
Evolver detects how many colors are available, so you may be able to get higher resolution with the 256 colors depending on your hardware and what driver you use.

This is my first use of this DOS extender, so please let me know of any problems.


Macintosh version

For those with Macintoshes, there is a Mac PowerPC version available as EvolverPPC.sea.Hqx. This is a Stuffit Lite self-extracting archive treated with BinHex. It includes a README file with Mac specific information and datafiles in Mac format.

The archive file contains:

For the instruction manual in PostScript form, get manual.ps. If you really feel the need to have the Mac Think C project files, ask brakke@susqu.edu.

Installation: All you need to do is unpack in a directory somewhere. The datafiles can go in a different directory, but then you will have to supply path names when using them.

Mac version idiosyncracies: This is a bare-bones port, so there are few Mac bells and whistles like menus. There are two windows: a text window and a graphics window. The text window provides a command-line interface to Evolver. Commands are typed in and text output appears here. All text input will go to the text window when either the text or graphics window is in front, so you can keep the graphics window in front while typing commands. Dragging the mouse in the graphics window will cause the object to rotate in 3D around an axis perpendicular to the mouse drag and with an angle proportional to the length of the drag. The redraw occurs after the mouse is released, not during the drag. Redrawing occurs in the background, so there may be some delay until the picture appears.

At start-up, you will be asked to enter the name of a datafile in the text window. If the file is not in the same directory, you will have to give the path also.

Redirecting output: The Mac doesn't have piping to other programs, so piped output of commands goes to a file. Example:

     list vertices | "outfile" 
Interrupting a repeating command: Hit command-period. Will complete current command and return to command prompt.

Memory partition: The default partition size is 8 Meg. Evolver will run in 2 Meg, but your surfaces won't be able to be very complex. I suggest making the partition as large as you can. You can change the partition size with Finder GetInfo.

This is my second Mac program ever (after "Hello world"), so please excuse anything not compatible with Mac culture such as lack of menus and icons.


Dynamic load libraries.

Many Evolver features, such as level set constraints, parametric boundaries, named method integrands, and Riemannian metrics require user-defined functions of a set of arguments. The expressions for these functions are ordinarily stored as a parse tree and interpreted each time needed, which can be much slower that evaluating compiled expressions. There is a way to use a set of compiled functions specific to a datafile through a mechanism known as dynamic loading. Here a library of functions for a datafile is separately compiled, and then loaded at runtime when a the datafile is loaded. Currently, the Evolver only implements a dynamic loading mechanism found on many unix systems, whose presence can be tested by looking for the existence of the file /usr/include/dlfcn.h. If it exists, you can enable dynamic loading by including -DENABLE_DLL in the CFLAGS line in the Makefile. On some systems, you may need to include -ldl on the GRAPHLIB line also, to link Evolver with functions such as dlopen(). To create the library for a datafile, write a source file containing C code for the desired functions, compile it, and link it into a shared library. The function should be able to compute the value and the partial derivatives of the function, and its second partials if you are going to use any Hessian features. A sample source file for a 2-dimensional datafile:

#define FUNC_VALUE  1
#define FUNC_DERIV  2
#define FUNC_SECOND 3
#define MAXCOORD 4   /* must be same as in Evolver!! */
#define REAL double  /* long double if Evolver compiled with -DLONGDOUBLE */ 
struct dstack { REAL value; 
		REAL deriv[2*MAXCOORD];
                REAL second[2*MAXCOORD][2*MAXCOORD]; };


void func1 ( mode, x, s )
int mode; /* FUNC_VALUE, FUNC_DERIV, FUNC_SECOND */
REAL *x;  /* pointer to list of arguments */
struct dstack *s;  /* for return values */
{ REAL value;

  s->value = x[0] + x[1]*x[1];

  if ( mode == FUNC_VALUE ) return;

  /* first partials */
  s->deriv[0] = 1.0;
  s->deriv[1] = 2*x[1];

  if ( mode == FUNC_DERIV ) return;

  /* second partials */
  s->second[0][0] = 0.0;
  s->second[0][1] = 0.0;
  s->second[1][0] = 0.0;
  s->second[1][1] = 2.0;
   
  return;
}
Supposing the sourcefile name to be foo.c, compile and link on SGI systems (IRIX 5.0.1 or above) with
cc -c foo.c
ld -shared foo.o -o foo.so
Sun systems are the same, but with -s in place of -shared. For other systems, consult the ld documentation for the option to make a shared library or dynamic load library.

To use the functions in a datafile, include a line at the top of the datafile before any of the functions are used:

load_library "foo.so"
The current directory and the EVOLVERPATH will be searched for the library. Up to 10 libraries may be loaded. Afterwards, any of the functions may be invoked just by using their name, without an explicit argument list because the argument list is always implicit where these functions are legal. Examples, supposing func2 is also defined with one argument:
constraint 1
formula: func1

boundary 1 parameters 2
x1: func2
x2: 3*func2 + sin(p1)
It is up to you to make sure the number of arguments your function expects is the same as the number implicit in the use of the function. You do not need to explicitly declare your functions in the datafile. Any undefined identifier is checked to see if it is a dynamically loaded function.

NOTE: This implementation of dynamic loading is experimental, and the interface described here may change in the future.


Back to top of Surface Evolver documentation.