<< Usage and conventions Usage and conventions Data types >>

celestlab >> - Introduction - > Usage and conventions > Functions

Functions

Functions

Functions names

CelestLab functions have names that begin with the prefix "CL_". Most names have an additional prefix (2 or 3 letters) that indicates the purpose of the function. Some examples are:

Calling sequences (order of arguments)

There are rules that apply most of the time that are intended to make things easier:

Calling sequences (optional arguments)

A calling sequence is described like this in the help files:

Arguments between "[" and "]" are optional and should not be named in function calls. The order of arguments is fixed. If argument n is given, arguments 1..n-1 should be given as well.

Arguments between "[[" and "]]" are optional and can be named in function calls.

The following calling sequences are valid:

But the following calling sequences either generate an error or the results might be unexpected:

Note that naming arguments should be done carefully as no error is detected if arguments are wrongly named.

Optional arguments default values

The default values for some optional arguments are given by variables whose names begin with "%CL_" (e.g. %CL_mu, %CL_eqRad...).

If an (optional) argument is omitted and the corresponding variable does not exist, the default value is retrieved internally. If the default value has to be changed, there are two possibilities:

Example:

// omitting optional argument:

kep = CL_oe_car2kep(pos,vel);

// changing default value - method 1:

kep = CL_oe_car2kep(pos,vel,3.98600E+14); // or: kep = CL_oe_car2kep(pos,vel,mu=3.98600E+14);

// changing default value - method 2:

%CL_mu = 3.98600E+14;

kep = CL_oe_car2kep(pos,vel);

Exception handling

All CelestLab functions should respect the following rules:

Note:

These are only guidelines. All functions may not follow them (yet). And there can be exceptions anyway.


Report an issue
<< Usage and conventions Usage and conventions Data types >>