// Automatically generated by make_fint.c, don't edit!

// clang-format off

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifndef CDIPIO_H_
#include "cdipio.h"
#endif

#ifdef HAVE_CF_INTERFACE

#include <limits.h>
#include <assert.h>

#ifndef __CFORTRAN_LOADED
#  if defined __clang__
#    pragma GCC diagnostic push
#    pragma GCC diagnostic ignored "-Wreserved-id-macro"
#  endif
#  include "cfortran.h"
#  if defined __clang__
#    pragma GCC diagnostic pop
#  endif
#endif
/* These functions are meant to be called from Fortran and don't
 * need an interface declaration in a C header. */
#ifdef __clang__
#  pragma GCC diagnostic push
#  pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif

#ifdef CDI_H_

static inline
int SizeType_c2f(SizeType value_SizeType)
{
  assert(value_SizeType < INT_MAX);
  return (int) value_SizeType;
}

#endif

/*  Start of fortran interface for the following routines (make_fint.c)  */


/*  parallel IO IOMode  */


/*  parallel IO routines  */

FCALLSCSUB0 (pioEndDef, PIOENDDEF, pioenddef)
FCALLSCSUB0 (pioEndTimestepping, PIOENDTIMESTEPPING, pioendtimestepping)
FCALLSCSUB0 (pioFinalize, PIOFINALIZE, piofinalize)
FCALLSCSUB0 (cdiPioNoPostCommSetup, CDIPIONOPOSTCOMMSETUP, cdipionopostcommsetup)

#undef ROUTINE_6
#define ROUTINE_6 (void (*)(void))
static int pioInit_fwrap(int commSuper, int nProcsIO, int IOMode, int *pioNamespace, float partInflate, void (*postCommSetupActions)(void))
{
  MPI_Comm v;
  v = pioInit(MPI_Comm_f2c(commSuper), nProcsIO, IOMode, pioNamespace, partInflate, postCommSetupActions);
  return MPI_Comm_c2f(v);
}
FCALLSCFUN6 (INT, pioInit_fwrap, PIOINIT, pioinit, INT, INT, INT, PINT, FLOAT, ROUTINE)
static int cdiPioInit_fwrap(int commSuper, int confResH, int *pioNamespace)
{
  MPI_Comm v;
  v = cdiPioInit(MPI_Comm_f2c(commSuper), confResH, pioNamespace);
  return MPI_Comm_c2f(v);
}
FCALLSCFUN3 (INT, cdiPioInit_fwrap, CDIPIOINIT, cdipioinit, INT, INT, PINT)
FCALLSCSUB0 (pioWriteTimestep, PIOWRITETIMESTEP, piowritetimestep)
FCALLSCSUB0 (cdiPioRDMAProgress, CDIPIORDMAPROGRESS, cdipiordmaprogress)
FCALLSCSUB4 (cdiPioStreamDefDecomposedVlist, CDIPIOSTREAMDEFDECOMPOSEDVLIST, cdipiostreamdefdecomposedvlist, INT, INT, PVOID, INTV)
static void streamWriteVarPart_fwrap(int streamID, int varID, double *data, int numMissVals, void *partDesc)
{
  streamWriteVarPart(streamID, varID, data, (SizeType)numMissVals, (*(Xt_idxlist *)partDesc));
}
FCALLSCSUB5 (streamWriteVarPart_fwrap, STREAMWRITEVARPART, streamwritevarpart, INT, INT, PDOUBLE, INT, PVOID)
static void streamWriteVarPartF_fwrap(int streamID, int varID, float *data, int numMissVals, void *partDesc)
{
  streamWriteVarPartF(streamID, varID, data, (SizeType)numMissVals, (*(Xt_idxlist *)partDesc));
}
FCALLSCSUB5 (streamWriteVarPartF_fwrap, STREAMWRITEVARPARTF, streamwritevarpartf, INT, INT, PFLOAT, INT, PVOID)
static void streamWriteScatteredVarPart_fwrap(int streamID, int varID, double *data, int numBlocks, const int  blocklengths[], const int  displacements[], int numMissVals, void *partDesc)
{
  streamWriteScatteredVarPart(streamID, varID, data, numBlocks, blocklengths, displacements, (SizeType)numMissVals, (*(Xt_idxlist *)partDesc));
}
FCALLSCSUB8 (streamWriteScatteredVarPart_fwrap, STREAMWRITESCATTEREDVARPART, streamwritescatteredvarpart, INT, INT, PDOUBLE, INT, INTV, INTV, INT, PVOID)
static void streamWriteScatteredVarPartF_fwrap(int streamID, int varID, float *data, int numBlocks, const int  blocklengths[], const int  displacements[], int numMissVals, void *partDesc)
{
  streamWriteScatteredVarPartF(streamID, varID, data, numBlocks, blocklengths, displacements, (SizeType)numMissVals, (*(Xt_idxlist *)partDesc));
}
FCALLSCSUB8 (streamWriteScatteredVarPartF_fwrap, STREAMWRITESCATTEREDVARPARTF, streamwritescatteredvarpartf, INT, INT, PFLOAT, INT, INTV, INTV, INT, PVOID)
static int cdiPioCSRLastN_fwrap(int commSuper, int IOMode, int nProcsIO)
{
  int v;
  v = cdiPioCSRLastN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO);
  return v;
}
FCALLSCFUN3 (INT, cdiPioCSRLastN_fwrap, CDIPIOCSRLASTN, cdipiocsrlastn, INT, INT, INT)
static int cdiPioCSRFirstN_fwrap(int commSuper, int IOMode, int nProcsIO)
{
  int v;
  v = cdiPioCSRFirstN(MPI_Comm_f2c(commSuper), IOMode, nProcsIO);
  return v;
}
FCALLSCFUN3 (INT, cdiPioCSRFirstN_fwrap, CDIPIOCSRFIRSTN, cdipiocsrfirstn, INT, INT, INT)
static int cdiPioCSRBalanced_fwrap(int commSuper, int IOMode, int nProcsIO)
{
  int v;
  v = cdiPioCSRBalanced(MPI_Comm_f2c(commSuper), IOMode, nProcsIO);
  return v;
}
FCALLSCFUN3 (INT, cdiPioCSRBalanced_fwrap, CDIPIOCSRBALANCED, cdipiocsrbalanced, INT, INT, INT)
FCALLSCFUN1 (INT, cdiPioStr2IOMode, CDIPIOSTR2IOMODE, cdipiostr2iomode, STRING)
FCALLSCFUN1 (STRING, cdiPioIOMode2Str, CDIPIOIOMODE2STR, cdipioiomode2str, INT)
FCALLSCFUN0 (INT, cdiPioConfCreate, CDIPIOCONFCREATE, cdipioconfcreate)
FCALLSCSUB1 (cdiPioConfDestroy, CDIPIOCONFDESTROY, cdipioconfdestroy, INT)
FCALLSCSUB2 (cdiPioConfSetPartInflate, CDIPIOCONFSETPARTINFLATE, cdipioconfsetpartinflate, INT, FLOAT)
FCALLSCFUN1 (FLOAT, cdiPioConfGetPartInflate, CDIPIOCONFGETPARTINFLATE, cdipioconfgetpartinflate, INT)
FCALLSCSUB2 (cdiPioConfSetIOMode, CDIPIOCONFSETIOMODE, cdipioconfsetiomode, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetIOMode, CDIPIOCONFGETIOMODE, cdipioconfgetiomode, INT)
FCALLSCSUB2 (cdiPioConfSetCSRole, CDIPIOCONFSETCSROLE, cdipioconfsetcsrole, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetCSRole, CDIPIOCONFGETCSROLE, cdipioconfgetcsrole, INT)

#undef ROUTINE_2
#define ROUTINE_2 (void (*)(void))
FCALLSCSUB2 (cdiPioConfSetPostCommSetupActions, CDIPIOCONFSETPOSTCOMMSETUPACTIONS, cdipioconfsetpostcommsetupactions, INT, ROUTINE)

#undef ROUTINE_3
#define ROUTINE_3 (void (*)(void))
FCALLSCSUB3 (cdiPioConfSetCallBackActions, CDIPIOCONFSETCALLBACKACTIONS, cdipioconfsetcallbackactions, INT, INT, ROUTINE)

/*  cdiPioConfSetLargePageAlign should block buffer be aligned to
 * large pages instead of normal pages?  */

FCALLSCSUB2 (cdiPioConfSetLargePageAlign, CDIPIOCONFSETLARGEPAGEALIGN, cdipioconfsetlargepagealign, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetLargePageAlign, CDIPIOCONFGETLARGEPAGEALIGN, cdipioconfgetlargepagealign, INT)
FCALLSCSUB2 (cdiPioConfSetRecordAggBufLim, CDIPIOCONFSETRECORDAGGBUFLIM, cdipioconfsetrecordaggbuflim, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetRecordAggBufLim, CDIPIOCONFGETRECORDAGGBUFLIM, cdipioconfgetrecordaggbuflim, INT)
FCALLSCSUB2 (cdiPioConfSetWriteAggBufLim, CDIPIOCONFSETWRITEAGGBUFLIM, cdipioconfsetwriteaggbuflim, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetWriteAggBufLim, CDIPIOCONFGETWRITEAGGBUFLIM, cdipioconfgetwriteaggbuflim, INT)
FCALLSCSUB2 (cdiPioConfSetAioQueueDepth, CDIPIOCONFSETAIOQUEUEDEPTH, cdipioconfsetaioqueuedepth, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetAioQueueDepth, CDIPIOCONFGETAIOQUEUEDEPTH, cdipioconfgetaioqueuedepth, INT)
FCALLSCSUB2 (cdiPioConfSetMaxPathLen, CDIPIOCONFSETMAXPATHLEN, cdipioconfsetmaxpathlen, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetMaxPathLen, CDIPIOCONFGETMAXPATHLEN, cdipioconfgetmaxpathlen, INT)
FCALLSCSUB2 (cdiPioConfSetRedistCache, CDIPIOCONFSETREDISTCACHE, cdipioconfsetredistcache, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetRedistCache, CDIPIOCONFGETREDISTCACHE, cdipioconfgetredistcache, INT)
FCALLSCSUB2 (cdiPioConfSetXmapCache, CDIPIOCONFSETXMAPCACHE, cdipioconfsetxmapcache, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetXmapCache, CDIPIOCONFGETXMAPCACHE, cdipioconfgetxmapcache, INT)
FCALLSCSUB2 (cdiPioConfSetStripeConversion, CDIPIOCONFSETSTRIPECONVERSION, cdipioconfsetstripeconversion, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetStripeConversion, CDIPIOCONFGETSTRIPECONVERSION, cdipioconfgetstripeconversion, INT)
FCALLSCSUB2 (cdiPioConfSetBatchedRMA, CDIPIOCONFSETBATCHEDRMA, cdipioconfsetbatchedrma, INT, INT)
FCALLSCFUN1 (INT, cdiPioConfGetBatchedRMA, CDIPIOCONFGETBATCHEDRMA, cdipioconfgetbatchedrma, INT)
static int cdiPioDistGridCreate_fwrap(int gridtype, int size, int xsize, int ysize, int nvertex, const int xy_decomposition_optional[][2], void *partDesc2D, void *partDescX, void *partDescY)
{
  int v;
  v = cdiPioDistGridCreate(gridtype, size, xsize, ysize, nvertex, xy_decomposition_optional, (*(Xt_idxlist *)partDesc2D), (*(Xt_idxlist *)partDescX), (*(Xt_idxlist *)partDescY));
  return v;
}
FCALLSCFUN9 (INT, cdiPioDistGridCreate_fwrap, CDIPIODISTGRIDCREATE, cdipiodistgridcreate, INT, INT, INT, INT, INT, INTVV, PVOID, PVOID, PVOID)
FCALLSCSUB1 (cdiPioDistGridEnableIndividualQueries, CDIPIODISTGRIDENABLEINDIVIDUALQUERIES, cdipiodistgridenableindividualqueries, INT)
FCALLSCSUB1 (cdiPioDistGridDisableIndividualQueries, CDIPIODISTGRIDDISABLEINDIVIDUALQUERIES, cdipiodistgriddisableindividualqueries, INT)
FCALLSCFUN1 (LOGICAL, cdiPioDistGridIndividualQueriesEnabled, CDIPIODISTGRIDINDIVIDUALQUERIESENABLED, cdipiodistgridindividualqueriesenabled, INT)
static int cdiPioInqInterComm_fwrap()
{
  MPI_Comm v;
  v = cdiPioInqInterComm();
  return MPI_Comm_c2f(v);
}
FCALLSCFUN0 (INT, cdiPioInqInterComm_fwrap, CDIPIOINQINTERCOMM, cdipioinqintercomm)

/*  End of fortran interface  */


#if defined __clang__
#  pragma GCC diagnostic pop
#endif

// clang-format on

#endif
