FlexELA
Loading...
Searching...
No Matches
fortran.h
1#ifndef FORTRAN_H
2#define FORTRAN_H
3#include <ELA.h>
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9// mangling determined by cmake
10#include <FC.h>
11
12#define F90_NAME(name, NAME) F90_GLOBAL_(name, NAME) // all functions have underscores
13
14// interface arguments and types
15// inspired by hypre https://github.com/hypre-space/hypre
16// clang-format off
17
18#ifdef ELA_USE_MPI
19typedef MPI_Fint* F90_Comm;
20#define F90_PassComm(arg) (MPI_Comm_f2c((MPI_Fint) *arg))
21#endif
22
23typedef int* F90_Int;
24typedef int* F90_IntArray;
25#define F90_PassInt(arg) ((int) *arg)
26#define F90_PassIntArray(arg) ((int*) arg)
27
28typedef double* F90_Real;
29typedef double* F90_RealArray;
30#define F90_PassReal(arg) ((double) *arg)
31#define F90_PassRealArray(arg) ((double*) arg)
32
33typedef char* F90_CharArray;
34#define F90_PassCharArray(arg) ((char*) arg)
35
36// clang-format on
37
38#ifdef __cplusplus
39}
40#endif
41
42#endif
Provides functions to setup ELA.