Keywords: class-filler

Next: Compiling your program Up: IRAM Memo 2014-1 CLASS Previous: The Sic API Contents

# The Fortran API

Using the CLASS program is convenient in a development phase for testing, or for small projects, but in a production phase it may be better to use a program linked to the CLASS library with the dedicated Fortran API. The main advantages of this API is 1) that it does not use the SIC interpreted language (compiled code is faster) and 2) that it does not start the whole CLASS program mechanisms (e.g. command logging, graphic support, etc).

A demonstration program is presented in the Appendix . This program does the same as the `demo-telwrite.class` procedure. Note that all subroutines using the Fortran API must use the module `class_api`. It provides CLASS types, parameters, and procedure interfaces. Here is a summary of the subroutines provided by the API:

- `class_write_init`: initialize the libclass for writing process,
- `class_write_clean`: clean the libclass after writing process,
- `class_fileout_open`: initialize/reopen a Class output file,
- `class_fileout_close`: close the Class output file,
- `class_obs_init`: initialize an `observation` variable,
- `class_obs_reset`: zero-ify and resize an observation,
- `class_obs_write`: write an observation to the output file,
- `class_obs_clean`: clean/free an `observation` variable.

The detailed API is available in the appendix . It is the responsiblity of the calling program to instantiate a `type(observation)` variable and to pass them to the related subroutines. There is no global buffers or variables involved here, on purpose.

Subsections

- Compiling your program

Next: Compiling your program Up: IRAM Memo 2014-1 CLASS Previous: The Sic API Contents