Skip to content
Thomas Nipen edited this page Jun 18, 2020 · 44 revisions

The gridpp library contains functions for the core algorithms in gridpp. As the command-line version of gridpp was built first, we are gradually collecting all the funtionality into a library. The library is written in C++, but automatic wrappers for python are created using SWIG. Bindings for other languages (like R) will be added in the future. All examples using the library in this wiki use the python interface.

The documentation for the library is found here. The header file with the available functions can be found in include/gridpp.h.

The library consists mostly of functions that take scalars (float, int) and vectors (1D, 2D, 3D std::vector) as inputs.

Parallelization

Many gridpp functions are configured to run on multiple processors. To enable this, either set the OMP_NUM_THREADS= environment variable to the number of parallel threads to use, or call the following function, before calling any other functions:

gridpp::set_omp_threads(4);

If OMP_NUM_THREADS= is not set and gridpp::set_omp_threads is never called, a default of 1 thread will be used. This applies also to any of the language bindings.

Exceptions

Functions will throw std::invalid_argument exceptions when input arguments are invalid (e.g. dimension mismatch between arguments) and std::runtime_error for other errors.

Clone this wiki locally