GFem language documentation -- 3.9.7 Exec(), user(), how to link an external function to Gfem

Previous: 3.9.6 Precise
Up: 3.9 Other features

### 3.9.7 Exec(), user(), how to link an external function to Gfem

`exec('prog_name')` will launch the application `prog_name` . It is useful to execute an external PDE solver for instance especially under Unix. It is not implemented for Macintosh because there is no simple way to return to MacGfem after `progname` has ended. The same can be achieved manually by a suitable combination of `saveall`, `wait` and `load` and simultaneous execution under multifinder.

`user(what,f)` calls the C++ function in a j-loop:

    for (int j=0; j<nquad, j++)
    creal gfemuser( creal what, creal* f, int j)

- `creal` is a scalar (`float` ) or a complex number if `complex` has been set; `nquad=3*nt` if `precise` is set and `ns` otherwise.
- `what` is intended for users who need several such functions. Then all can be put in the super function `user` and selection is by an if statement on `what` .
- Within `gfemuser` access to all global variables are of course possible: the triangulation (`ns,nt, me, q, ng,ngt, area...` ) ... refer to the file `fem.C` for more details.

Remark: An example of such gfemuser function is in `fem.C` ; if you wish to put your own you must compile and link it. Under Unix, it is easy. Under the Macintosh system, either you use freefem, which is Gfem's kernel, or you must ask us a library version of MacGfem.