// Filename: epimethues.h
#ifndef __EPIMETHUES_H__
#define __EPIMETHUES_H__

/* Definitions of Fortran routines */
#ifdef HAVE_FORTRAN_CAPS
#define prom_create_ PROM_CREATE
#define prom_destroy_ PROM_DESTROY
#define prom_init_global_ PROM_INIT_GLOBAL
#define prom_init_local_ PROM_INIT_LOCAL
#define prom_new_level_ PROM_NEW_LEVEL
#define prom_finalize_ PROM_FINALIZE
#define prom_pre_solv_ PROM_PRE_SOLV
#define prom_solv_ PROM_SOLV
#define prom_get_b_ PROM_GET_B
#define prom_get_x_ PROM_GET_X
#define prom_get_a_ PROM_GET_A
#define prom_zero_a_ PROM_ZERO_A
#elif !defined(HAVE_FORTRAN_UNDERSCORE)
#define prom_create_ prom_create
#define prom_destroy_ prom_destroy
#define prom_init_global_ prom_init_global
#define prom_init_local_ prom_init_local
#define prom_new_level_ prom_new_level
#define prom_pre_solv_  prom_pre_solv
#define prom_finalize_ prom_finalize
#define prom_solv_ prom_solv
#define prom_get_b_ prom_get_b
#define prom_get_x_ prom_get_x
#define prom_get_a_ prom_get_a
#define prom_zero_a_ prom_zero_a
#endif

// FORTRAN - interface routines
extern "C"
{
void prom_create_( PROMETHEUS **pepimetheus, &ierr );
void prom_destroy_( PROMETHEUS **pepimetheus, &ierr );
void prom_init_local_( PROMETHEUS **pepimetheus, const double *coord, const int *edges,
        const int *numnd, const int *numel, const int *nena, const int *nen1a, const int *minc,
        const int *eq_id, const int *nndf, int *ierr );
void prom_init_global_( PROMETHEUS **pepimetheus, const int *npLoc, const int *npGst,
        const int *pnode_fnode, int *proc_gnode, const int *ghost_gnode, const int *ghost_proc, int *ierr);
void prom_new_level_( PROMETHEUS **pepimetheus, int *nnodes, int *ierr );
void prom_finalize_( PROMETHEUS **pepimetheus, int *ierr );
void prom_pre_solv_( PROMETHEUS **pepimetheus, int *nstep, int *niter, int *ierr );
void prom_solv_( PROMETHEUS **pepimetheus, const int *niter, double *energy, int *ierr );
void prom_get_b_( PROMETHEUS **pepimetheus, Vec *ret, int *ierr );
void prom_get_x_( PROMETHEUS **pepimetheus, Vec *ret, int *ierr );
void prom_get_a_( PROMETHEUS **pepimetheus, Mat *aa, int *ierr );
void prom_zero_a_( PROMETHEUS **pepimetheus, int *ierr );

/* C */
int promCreate( void **pc );
int promDestroy( void *pc );
int promInitLocal( void *pc,
     const double *coord, const int *edges, const int numnd,
     const int numel, const int nena, const int nen1a,
     const int *eq_id, const int nndf,
     const int eoff, const int minc );
int promInitGlobal( void *pc, const int npLoc,
      const int npGst, const int *pnode_fnode,
      int *proc_gnode, const int *ghost_gnode,
      const int *ghost_proc);
int promNewLevel( void *pc, int *nnodes );
int promFinalize( void *pc );
int promBuildGrids( void *pprometheus, int n );
int promPreSolv( void *pc, int nstep, int niter );
int promSolv( void *pc, const int niter, double *energy );
int promGetB( void *pc, Vec *ret );
int promGetX( void *pc, Vec *ret );
int promGetA( void *pc, Mat *aa );
int promZeroA( void *pc );

}
#endif // __EPIMETHUES_H__