How to use Agat:
To prepare a C program for animation, the programmer uses the functions in the
Agat library to send the interesting data manipulated by the program on
streams. He is free to use as many streams as he wants and to name
them as suits him (a stream is just identified by a character string).
The user then needs to link its program with the Agat library, where the
functions are defined . If can be done with a command line like:
gcc -o aleat aleat.c -lAGAT.
Remember to add a -I and/or -L if the libAGAT.h libAGAT.a is not in the directory where you are doing your compilations.
Thus leading to something like:
gcc -o aleat aleat.c -I /net/safir/Agat/Sun4/ -L /net/safir/Agat/Sun4 -lAGAT
Take a look at reference manual ;)
First you should add a C file to declare the fortan interface to Agat
functions (this file will be given in the next Agat release). For
example, name this C file: fortranInterf.c
#include <libAGAT.h>
void sndint_( char *ch, int *code){
agatSendInt(ch,*code);
}
void sndlng_( char *ch, int *code){
agatSendLong(ch,*code);
}
void sndflt_( char *ch, int *code){
agatSendFloat(ch,*code);
}
void snddbl_( char *ch, double *code){
agatSendDouble(ch,*code);
}
Now, here is a sample of a Fortan program:
program dummy
do i=0.d0,10.d0,1.d-1
f=dsqrt(x)
snddbl ("squareroot",f)
enddo
stop
end
Then to compile and link your programs together you should execute this line
to generate a .o file.
gcc -c fortranInterf.c
.
And at the end:
f77 -o dummy dummy.f fortranInterf.o -lAgat
Caution
- The stream name:
- The steam name should be a constant. If you don't use a constant in the Agat function, you should specify the '\0'. For example:
text="squareroot\0"
snddbl (texte,f)
- The corresponding C->Fortran functions:
- the C type int, double and float are integer, real and double in the
Fortran syntax. But there is non exactely corresponding type for the C type
long.
Big thanks to Eric
Hassold who done the wrappers and who is the first to integrate and use
Agat in a Fortran code.
As final step to obtain an animation, the programmer has to write a file in a
little stream processing language, the Agat language, to describe
how the streams coming from program will be altered or combined and what
exactly will be displayed and how. Take a look in directory Samples.
Finaly just run your prepared programm under control of the agat server.
agat -f test.agt myprog
You should add some defaults for agat in your X ressources. For example insert Agat.ad in your .Xdefault. Or better copy Agat.ad as Agat in your $XAPPLRESDIR directory.
A good idea is to ask your Window Manager to place new windows at random
position. (eg for ctwm: RandomPlacement)
If you don't specify this, you won't be able to use button1 function.
Have a look to the Agat.ad file to see the different default ressources.
And That's All Folks !!! Very easy, don't you think so???