/* File: pycutmckmodule.c
 * This file is auto-generated with f2py (version:2.2.4).
 * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
 * written by Pearu Peterson <pearu@cens.ioc.ee>.
 * Generation date: Thu May 22 11:15:00 2025
 * Do not edit this file directly unless you know what you are doing!!!
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */

/* Unconditionally included */
#include <Python.h>
#include <numpy/npy_os.h>

/*********************** See f2py2e/cfuncs.py: includes ***********************/
#include "fortranobject.h"
/*need_includes0*/

/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/
static PyObject *pycutmck_error;
static PyObject *pycutmck_module;

/*********************** See f2py2e/cfuncs.py: typedefs ***********************/
/*need_typedefs*/

/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/
/*need_typedefs_generated*/

/********************** See f2py2e/cfuncs.py: cppmacros **********************/

#ifdef DEBUGCFUNCS
#define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess);
#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \
    PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\
    fprintf(stderr,"\n");
#else
#define CFUNCSMESS(mess)
#define CFUNCSMESSPY(mess,obj)
#endif


#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a < b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a < b) ? (a) : (b))
#endif


#if defined(PREPEND_FORTRAN)
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F
#else
#define F_FUNC(f,F) _##f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F##_
#else
#define F_FUNC(f,F) _##f##_
#endif
#endif
#else
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif
#endif
#if defined(UNDERSCORE_G77)
#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)
#else
#define F_FUNC_US(f,F) F_FUNC(f,F)
#endif


/************************ See f2py2e/cfuncs.py: cfuncs ************************/
/*need_cfuncs*/

/********************* See f2py2e/cfuncs.py: userincludes *********************/
/*need_userincludes*/

/********************* See f2py2e/capi_rules.py: usercode *********************/


/* See f2py2e/rules.py */
/*eof externroutines*/

/******************** See f2py2e/capi_rules.py: usercode1 ********************/


/******************* See f2py2e/cb_rules.py: buildcallback *******************/
/*need_callbacks*/

/*********************** See f2py2e/rules.py: buildapi ***********************/

/********************************* run_cutmck *********************************/
static char doc_f2py_rout_pycutmck_cmk_run_cutmck[] = "\
return_value = run_cutmck()\n\nWrapper for ``run_cutmck``.\
\n\nReturns\n-------\n"
"return_value : int";
/*  */
static PyObject *f2py_rout_pycutmck_cmk_run_cutmck(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    int return_value = 0;
    static char *capi_kwlist[] = {NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "|:pycutmck.cmk.run_cutmck",\
        capi_kwlist))
        return NULL;
/*frompyobj*/
    /* Processing variable return_value */
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&return_value);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("i",return_value);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    /* End of cleaning variable return_value */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/***************************** end of run_cutmck *****************************/
/*eof body*/

/******************* See f2py2e/f90mod_rules.py: buildhooks *******************/

static FortranDataDef f2py_elemmod_def[] = {
  {"sanz",0,{{-1}},NPY_INT, 1},
  {"typanz",0,{{-1}},NPY_INT, 1},
  {"mb",0,{{-1}},NPY_INT, 1},
  {"typ",1,{{-1}},NPY_INT, 1},
  {"nelanz",1,{{-1}},NPY_INT, 1},
  {"selanz",1,{{-1}},NPY_INT, 1},
  {"snr",1,{{-1}},NPY_INT, 1},
  {"sx",1,{{-1}},NPY_DOUBLE, 1},
  {"sy",1,{{-1}},NPY_DOUBLE, 1},
  {"spx",1,{{-1}},NPY_DOUBLE, 1},
  {"spy",1,{{-1}},NPY_DOUBLE, 1},
  {"nrel",2,{{-1,-1}},NPY_INT, 1},
  {"elanz",0,{{-1}},NPY_INT, 1},
  {"relanz",0,{{-1}},NPY_INT, 1},
  {"rnr",1,{{-1}},NPY_INT, 1},
  {"smaxs",0,{{-1}},NPY_INT, 1},
  {NULL}
};

static void f2py_setup_elemmod(char *sanz,char *typanz,char *mb,void (*typ)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*nelanz)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*selanz)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*snr)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*sx)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*sy)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*spx)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*spy)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*nrel)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char *elanz,char *relanz,void (*rnr)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char *smaxs) {
  int i_f2py=0;
  f2py_elemmod_def[i_f2py++].data = sanz;
  f2py_elemmod_def[i_f2py++].data = typanz;
  f2py_elemmod_def[i_f2py++].data = mb;
  f2py_elemmod_def[i_f2py++].func = typ;
  f2py_elemmod_def[i_f2py++].func = nelanz;
  f2py_elemmod_def[i_f2py++].func = selanz;
  f2py_elemmod_def[i_f2py++].func = snr;
  f2py_elemmod_def[i_f2py++].func = sx;
  f2py_elemmod_def[i_f2py++].func = sy;
  f2py_elemmod_def[i_f2py++].func = spx;
  f2py_elemmod_def[i_f2py++].func = spy;
  f2py_elemmod_def[i_f2py++].func = nrel;
  f2py_elemmod_def[i_f2py++].data = elanz;
  f2py_elemmod_def[i_f2py++].data = relanz;
  f2py_elemmod_def[i_f2py++].func = rnr;
  f2py_elemmod_def[i_f2py++].data = smaxs;
}
extern void F_FUNC(f2pyinitelemmod,F2PYINITELEMMOD)(void (*)(char*,char*,char*,void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char*,char*,void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*),char*));
static void f2py_init_elemmod(void) {
  F_FUNC(f2pyinitelemmod,F2PYINITELEMMOD)(f2py_setup_elemmod);
}


static FortranDataDef f2py_electrmod_def[] = {
  {"eanz",0,{{-1}},NPY_INT, 1},
  {"enr",1,{{-1}},NPY_INT, 1},
  {NULL}
};

static void f2py_setup_electrmod(char *eanz,void (*enr)(int*,npy_intp*,void(*)(char*,npy_intp*),int*)) {
  int i_f2py=0;
  f2py_electrmod_def[i_f2py++].data = eanz;
  f2py_electrmod_def[i_f2py++].func = enr;
}
extern void F_FUNC(f2pyinitelectrmod,F2PYINITELECTRMOD)(void (*)(char*,void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),int*)));
static void f2py_init_electrmod(void) {
  F_FUNC(f2pyinitelectrmod,F2PYINITELECTRMOD)(f2py_setup_electrmod);
}


static FortranDataDef f2py_errmod_def[] = {
  {"errnr",0,{{-1}},NPY_INT, 1},
  {"errflag",0,{{-1}},NPY_INT, 1},
  {"fetxt",0,{{-1}},NPY_STRING, 80},
  {NULL}
};

static void f2py_setup_errmod(char *errnr,char *errflag,char *fetxt) {
  int i_f2py=0;
  f2py_errmod_def[i_f2py++].data = errnr;
  f2py_errmod_def[i_f2py++].data = errflag;
  f2py_errmod_def[i_f2py++].data = fetxt;
}
extern void F_FUNC(f2pyiniterrmod,F2PYINITERRMOD)(void (*)(char*,char*,char*));
static void f2py_init_errmod(void) {
  F_FUNC(f2pyiniterrmod,F2PYINITERRMOD)(f2py_setup_errmod);
}


static FortranDataDef f2py_cmk_def[] = {
  {"run_cutmck",-1,{{-1}},0,0,NULL,(void *)f2py_rout_pycutmck_cmk_run_cutmck,doc_f2py_rout_pycutmck_cmk_run_cutmck},
  {NULL}
};

static void f2py_setup_cmk(char *run_cutmck) {
  int i_f2py=0;
  f2py_cmk_def[i_f2py++].data = run_cutmck;
}
extern void F_FUNC(f2pyinitcmk,F2PYINITCMK)(void (*)(char *));
static void f2py_init_cmk(void) {
  F_FUNC(f2pyinitcmk,F2PYINITCMK)(f2py_setup_cmk);
}

/*need_f90modhooks*/

/************** See f2py2e/rules.py: module_rules['modulebody'] **************/

/******************* See f2py2e/common_rules.py: buildhooks *******************/

/*need_commonhooks*/

/**************************** See f2py2e/rules.py ****************************/

static FortranDataDef f2py_routine_defs[] = {

/*eof routine_defs*/
    {NULL}
};

static PyMethodDef f2py_module_methods[] = {

    {NULL,NULL}
};

static struct PyModuleDef moduledef = {
    PyModuleDef_HEAD_INIT,
    "pycutmck",
    NULL,
    -1,
    f2py_module_methods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC PyInit_pycutmck(void) {
    int i;
    PyObject *m,*d, *s, *tmp;
    m = pycutmck_module = PyModule_Create(&moduledef);
    Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
    import_array();
    if (PyErr_Occurred())
        {PyErr_SetString(PyExc_ImportError, "can't initialize module pycutmck (failed to import numpy)"); return m;}
    d = PyModule_GetDict(m);
    s = PyUnicode_FromString("2.2.4");
    PyDict_SetItemString(d, "__version__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString(
        "This module 'pycutmck' is auto-generated with f2py (version:2.2.4).\nFunctions:\n"
"Fortran 90/95 modules:\n""  elemmod --- sanz,typanz,mb,typ,nelanz,selanz,snr,sx,sy,spx,spy,nrel,elanz,relanz,rnr,smaxs""  electrmod --- eanz,enr""  errmod --- errnr,errflag,fetxt""  cmk --- run_cutmck()"".");
    PyDict_SetItemString(d, "__doc__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString("2.2.4");
    PyDict_SetItemString(d, "__f2py_numpy_version__", s);
    Py_DECREF(s);
    pycutmck_error = PyErr_NewException ("pycutmck.error", NULL, NULL);
    /*
     * Store the error object inside the dict, so that it could get deallocated.
     * (in practice, this is a module, so it likely will not and cannot.)
     */
    PyDict_SetItemString(d, "_pycutmck_error", pycutmck_error);
    Py_DECREF(pycutmck_error);
    for(i=0;f2py_routine_defs[i].name!=NULL;i++) {
        tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]);
        PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp);
        Py_DECREF(tmp);
    }

/*eof initf2pywraphooks*/
  PyDict_SetItemString(d, "cmk", PyFortranObject_New(f2py_cmk_def,f2py_init_cmk));
  PyDict_SetItemString(d, "errmod", PyFortranObject_New(f2py_errmod_def,f2py_init_errmod));
  PyDict_SetItemString(d, "electrmod", PyFortranObject_New(f2py_electrmod_def,f2py_init_electrmod));
  PyDict_SetItemString(d, "elemmod", PyFortranObject_New(f2py_elemmod_def,f2py_init_elemmod));
/*eof initf90modhooks*/

/*eof initcommonhooks*/


#if Py_GIL_DISABLED
    // signal whether this module supports running with the GIL disabled
    PyUnstable_Module_SetGIL(m , Py_MOD_GIL_USED);
#endif

#ifdef F2PY_REPORT_ATEXIT
    if (! PyErr_Occurred())
        on_exit(f2py_report_on_exit,(void*)"pycutmck");
#endif

    if (PyType_Ready(&PyFortran_Type) < 0) {
        return NULL;
    }

    return m;
}
#ifdef __cplusplus
}
#endif
