preCICE is written in C++. Thus, the native API language of preCICE is C++ as well. If you are new to the preCICE API, we recommended that you first follow the step-by-step guide. If you are using an older version, see the porting guides to port an adapter between major version of preCICE.
Next to the native C++ API, bindings for further languages are also available. In this page, we provide an overview of all supported languages, including location, installation, and minimal reference implementations.
The reference implementations are the so called solver dummies, which can be a great source to copy from. The community also maintains MPI-parallel versions of some of these solver dummies.
C++
This is the native API of preCICE.
- Location:
precice/precice/src/precice/Participant.hpp - Installation: Automatically included
- Usage:
#include "precice/precice.hpp" - Reference implementation:
precice/precice/examples/solverdummies/cpp - C++ API documentation: latest release, development version
See also the source code documentation (Doxygen pages) for the latest release, or the development version.
C
C bindings are included in the main repository.
- Location:
precice/precice/extras/bindings/c - Installation: native bindings
- Usage:
#include "precice/preciceC.h" - Reference implementation:
precice/precice/examples/solverdummies/c - C API documentation: latest release, development version
Fortran
Fortran bindings are included in the main repository.
- Location:
precice/precice/extras/bindings/fortran - Installation: native bindings
- Reference implementation:
precice/precice/examples/solverdummies/fortran - Fortran API documentation: latest release, development version
Fortran module
- Location:
precice/fortran-module - Installation:
make - Usage:
use precice - Reference implementation:
precice/fortran-module/examples/solverdummy
Python
- Location:
precice/python-bindings - Installation:
pip3 install pyprecice - Usage:
import precice - Reference implementation:
precice/python-bindings/examples/solverdummy
Matlab
- Location:
precice/matlab-bindings - Installation: installation script
- Reference implementation:
precice/matlab-bindings/examples/solverdummy
Julia
- Location:
precice/PreCICE.jl - Installation:
add PreCICE - Usage:
using PreCICE - Reference implementation:
precice/PreCICE.jl/solverdummy
Rust
- Location:
precice/rust-bindings - Installation:
cargo add precice - Reference implementation:
precice/rust-bindings/examples/solverdummy
Architectural overview of bindings
All the language bindings are calling the C++ API of preCICE and some of them are interdependent. Here is an overview of what uses what:
