Wiki
Clone wikiphist / User_Guide / 070 Interfaces in various Programming Languages
Interfaces in various Programming Languages
The basic C interface to phist is inspired by MPI: it is very simple and portable independent of the complexities of the underlying implementation. Very similar interfaces for C++ and Python are generated when you build and install phist. The Fortran 2003 bindings are not included in the phist repository due to a licensing issue. After installing phist you need to build and instll a separate package called phist_fort.
C++ bindings
The C++ interface is organized into a few headers, each including a class with all static member functions that are have the same interface as the corresponding C function. for instance, the C function
phist_Dmvec_create(phist_Dmvec_ptr *V, phist_const_map_ptr map, int* iflag);
You can now use
phist::kernels<double>::mvec_create(phist::types<double>::mvec_ptr *V, phist_const_map_ptr map, int* iflag);
In addition to returning error codes via *iflag these functions will throw a phist::Exception if *iflag<0 on exit.
Python bindings
The Python bindings are also extremely simple and not very 'Pythonic'. They are indeed a collection of C-like functions that rely on the phist kernel library used when building phist, and not Python packages like NumPy. There is no 'Python backend' for phist.
Fortran 2003 bindings
see the phist_fort extension package for details and examples on the Fortran bindings.
Updated