Next: 6.5 Maple to Scilab
Up: 6.4 The routines/default directory
Previous: 6.4 The routines/default directory
Some built-in nonlinear solvers, such as ode or optim, require a
specific function as argument. For instance in the Scilab command
ode(x0,t0,t,fydot), fydot is the specific argument function
for the ode primitive.
This function can be a either Scilab function or an external
function written in C or Fortran.
In both cases, the argument function must obey a specific
syntax. In the following we will consider, as running example, using
the ode primitive with a rhs function written in Fortran. The
same steps should be followed for all primitives which require
a function as argument.
If the argument function is written in C or Fortran, there
are two ways to call it:
- -Use dynamic link
-->link('myfydot.o','myfydot') //or -->link('myfydot.o','myfydot','C')
-->ode(x0,t0,t,'myfydot')
- -Use the Ex-ode.f interface in the routines/default
directory (and make all in Scilab directory).
The call to the ode function is as above:
-->ode(x0,t0,t,'myfydot')
In this latter case, to add a new function, two files should be updated:
- The Flist file: Flist is list of entry points. Just add the
name of your function at in the appropriate list of functions.
ode_list= ... myfydot
- The Ex-ode.f (or Ex-ode-more.f) file: this file contains the
source code for argument functions. Add your function here.
Many exemples are provided in the default directory.
More complex examples are also given. For instance it is shown
how to use Scilab variables as optional parameters of fydot.
Next: 6.5 Maple to Scilab
Up: 6.4 The routines/default directory
Previous: 6.4 The routines/default directory
Scilab Group