My Project
|
This project declares the C-API to the IFS trans-library.
For documentation of all available functions, see trans.h .
This library gives access to spectral transforms on the sphere. The library is capable to take advantage of a MPI-distributed-memory environment, and can use OpenMP-shared-memory parallelism internally.
First ectrans needs to be initialized with a function trans_init(). This needs to be done only once in the program. It sets up some global structures independent of any resolution.
A number of resolutions can now be setup using trans_setup() for each resolution. Every call to trans_setup() involves allocating and computing the transformation coefficients, and should be done only once for every intended resolution as it can be very expensive and requires to store a lot of memory. The resolution can be referred to with a trans "handle" of the Trans_t type.
Using this handle, one can now transform fields. Either many fields can be transformed simultaneously, or the transform functions can be called multiple times to transform any number of fields separately.
The function to do a transform from gridpoints to spectral is called trans_dirtrans(). The function to do a transform from spectral to gridpoints is called trans_invtrans(). The function to do the adjoint of the spectral to gridpoints transform is called trans_invtrans_adj(). It also transforms the data from gridpoints to spectral.
In case of distrubuted parallelism (MPI), the functions trans_dirtrans(), trans_invtrans(), and trans_invtrans_adj() work on distributed fields. In order to convert to and from a global view of the field (e.g. for reading / writing), one can use the functions trans_distspec(), trans_gathspec(), trans_distgrid(), trans_gathgrid().
Every handle needs to be cleaned up when no longer required, to release the memory and coefficients stored internally. This can be done with the function trans_delete().
Lastly, transi needs to be finalized with trans_finalize(), which will clean up any remaining internal global structures