|
|
/* File: fitacf_acf2module.c
|
|
|
* This file is auto-generated with f2py (version:2).
|
|
|
* f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
|
|
|
* written by Pearu Peterson <pearu@cens.ioc.ee>.
|
|
|
* Generation date: Wed Jan 8 13:23:37 2025
|
|
|
* Do not edit this file directly unless you know what you are doing!!!
|
|
|
*/
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
extern "C" {
|
|
|
#endif
|
|
|
|
|
|
/*********************** See f2py2e/cfuncs.py: includes ***********************/
|
|
|
#include "Python.h"
|
|
|
#include <stdarg.h>
|
|
|
#include "fortranobject.h"
|
|
|
#include <math.h>
|
|
|
|
|
|
/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/
|
|
|
static PyObject *fitacf_acf2_error;
|
|
|
static PyObject *fitacf_acf2_module;
|
|
|
|
|
|
/*********************** See f2py2e/cfuncs.py: typedefs ***********************/
|
|
|
/*need_typedefs*/
|
|
|
|
|
|
/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/
|
|
|
/*need_typedefs_generated*/
|
|
|
|
|
|
/********************** See f2py2e/cfuncs.py: cppmacros **********************/
|
|
|
#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
|
|
|
|
|
|
#define rank(var) var ## _Rank
|
|
|
#define shape(var,dim) var ## _Dims[dim]
|
|
|
#define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp)))
|
|
|
#define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim)
|
|
|
#define fshape(var,dim) shape(var,rank(var)-dim-1)
|
|
|
#define len(var) shape(var,0)
|
|
|
#define flen(var) fshape(var,0)
|
|
|
#define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp))
|
|
|
/* #define index(i) capi_i ## i */
|
|
|
#define slen(var) capi_ ## var ## _len
|
|
|
#define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1)
|
|
|
|
|
|
#define CHECKSCALAR(check,tcheck,name,show,var)\
|
|
|
if (!(check)) {\
|
|
|
char errstring[256];\
|
|
|
sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\
|
|
|
PyErr_SetString(fitacf_acf2_error,errstring);\
|
|
|
/*goto capi_fail;*/\
|
|
|
} else
|
|
|
#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_WRAPPEDFUNC(f,F) _F2PYWRAP##F
|
|
|
#else
|
|
|
#define F_WRAPPEDFUNC(f,F) _f2pywrap##f
|
|
|
#endif
|
|
|
#else
|
|
|
#if defined(UPPERCASE_FORTRAN)
|
|
|
#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_
|
|
|
#else
|
|
|
#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_
|
|
|
#endif
|
|
|
#endif
|
|
|
#else
|
|
|
#if defined(NO_APPEND_FORTRAN)
|
|
|
#if defined(UPPERCASE_FORTRAN)
|
|
|
#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F
|
|
|
#else
|
|
|
#define F_WRAPPEDFUNC(f,F) f2pywrap##f
|
|
|
#endif
|
|
|
#else
|
|
|
#if defined(UPPERCASE_FORTRAN)
|
|
|
#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_
|
|
|
#else
|
|
|
#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_
|
|
|
#endif
|
|
|
#endif
|
|
|
#endif
|
|
|
#if defined(UNDERSCORE_G77)
|
|
|
#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_)
|
|
|
#else
|
|
|
#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F)
|
|
|
#endif
|
|
|
|
|
|
|
|
|
/************************ See f2py2e/cfuncs.py: cfuncs ************************/
|
|
|
static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) {
|
|
|
PyObject* tmp = NULL;
|
|
|
if (PyFloat_Check(obj)) {
|
|
|
#ifdef __sgi
|
|
|
*v = PyFloat_AsDouble(obj);
|
|
|
#else
|
|
|
*v = PyFloat_AS_DOUBLE(obj);
|
|
|
#endif
|
|
|
return 1;
|
|
|
}
|
|
|
tmp = PyNumber_Float(obj);
|
|
|
if (tmp) {
|
|
|
#ifdef __sgi
|
|
|
*v = PyFloat_AsDouble(tmp);
|
|
|
#else
|
|
|
*v = PyFloat_AS_DOUBLE(tmp);
|
|
|
#endif
|
|
|
Py_DECREF(tmp);
|
|
|
return 1;
|
|
|
}
|
|
|
if (PyComplex_Check(obj))
|
|
|
tmp = PyObject_GetAttrString(obj,"real");
|
|
|
else if (PyString_Check(obj) || PyUnicode_Check(obj))
|
|
|
/*pass*/;
|
|
|
else if (PySequence_Check(obj))
|
|
|
tmp = PySequence_GetItem(obj,0);
|
|
|
if (tmp) {
|
|
|
PyErr_Clear();
|
|
|
if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
|
|
|
Py_DECREF(tmp);
|
|
|
}
|
|
|
{
|
|
|
PyObject* err = PyErr_Occurred();
|
|
|
if (err==NULL) err = fitacf_acf2_error;
|
|
|
PyErr_SetString(err,errmess);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static int f2py_size(PyArrayObject* var, ...)
|
|
|
{
|
|
|
npy_int sz = 0;
|
|
|
npy_int dim;
|
|
|
npy_int rank;
|
|
|
va_list argp;
|
|
|
va_start(argp, var);
|
|
|
dim = va_arg(argp, npy_int);
|
|
|
if (dim==-1)
|
|
|
{
|
|
|
sz = PyArray_SIZE(var);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rank = PyArray_NDIM(var);
|
|
|
if (dim>=1 && dim<=rank)
|
|
|
sz = PyArray_DIM(var, dim-1);
|
|
|
else
|
|
|
fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank);
|
|
|
}
|
|
|
va_end(argp);
|
|
|
return sz;
|
|
|
}
|
|
|
|
|
|
static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) {
|
|
|
double d=0.0;
|
|
|
if (double_from_pyobj(&d,obj,errmess)) {
|
|
|
*v = (float)d;
|
|
|
return 1;
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) {
|
|
|
PyObject* tmp = NULL;
|
|
|
if (PyInt_Check(obj)) {
|
|
|
*v = (int)PyInt_AS_LONG(obj);
|
|
|
return 1;
|
|
|
}
|
|
|
tmp = PyNumber_Int(obj);
|
|
|
if (tmp) {
|
|
|
*v = PyInt_AS_LONG(tmp);
|
|
|
Py_DECREF(tmp);
|
|
|
return 1;
|
|
|
}
|
|
|
if (PyComplex_Check(obj))
|
|
|
tmp = PyObject_GetAttrString(obj,"real");
|
|
|
else if (PyString_Check(obj) || PyUnicode_Check(obj))
|
|
|
/*pass*/;
|
|
|
else if (PySequence_Check(obj))
|
|
|
tmp = PySequence_GetItem(obj,0);
|
|
|
if (tmp) {
|
|
|
PyErr_Clear();
|
|
|
if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
|
|
|
Py_DECREF(tmp);
|
|
|
}
|
|
|
{
|
|
|
PyObject* err = PyErr_Occurred();
|
|
|
if (err==NULL) err = fitacf_acf2_error;
|
|
|
PyErr_SetString(err,errmess);
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
/********************* See f2py2e/cfuncs.py: userincludes *********************/
|
|
|
/*need_userincludes*/
|
|
|
|
|
|
/********************* See f2py2e/capi_rules.py: usercode *********************/
|
|
|
|
|
|
|
|
|
/* See f2py2e/rules.py */
|
|
|
extern void F_FUNC(acf2,ACF2)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*);
|
|
|
extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*);
|
|
|
extern void F_FUNC(gaussq,GAUSSQ)(float*,float*);
|
|
|
/*eof externroutines*/
|
|
|
|
|
|
/******************** See f2py2e/capi_rules.py: usercode1 ********************/
|
|
|
|
|
|
|
|
|
/******************* See f2py2e/cb_rules.py: buildcallback *******************/
|
|
|
/*need_callbacks*/
|
|
|
|
|
|
/*********************** See f2py2e/rules.py: buildapi ***********************/
|
|
|
|
|
|
/************************************ acf2 ************************************/
|
|
|
static char doc_f2py_rout_fitacf_acf2_acf2[] = "\
|
|
|
acf = acf2(wl,tau,te1,ti1,fi1,ven1,vin1,wi1,alpha1,dens1,bfld1,acf,[nion1])\n\nWrapper for ``acf2``.\
|
|
|
\n\nParameters\n----------\n"
|
|
|
"wl : input float\n"
|
|
|
"tau : input float\n"
|
|
|
"te1 : input float\n"
|
|
|
"ti1 : input rank-1 array('f') with bounds (nion1)\n"
|
|
|
"fi1 : input rank-1 array('f') with bounds (nion1)\n"
|
|
|
"ven1 : input float\n"
|
|
|
"vin1 : input rank-1 array('f') with bounds (nion1)\n"
|
|
|
"wi1 : input rank-1 array('i') with bounds (nion1)\n"
|
|
|
"alpha1 : input float\n"
|
|
|
"dens1 : input float\n"
|
|
|
"bfld1 : input float\n"
|
|
|
"acf : input float\n"
|
|
|
"\nOther Parameters\n----------------\n"
|
|
|
"nion1 : input int, optional\n Default: len(ti1)\n"
|
|
|
"\nReturns\n-------\n"
|
|
|
"acf : float";
|
|
|
/* extern void F_FUNC(acf2,ACF2)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*); */
|
|
|
static PyObject *f2py_rout_fitacf_acf2_acf2(const PyObject *capi_self,
|
|
|
PyObject *capi_args,
|
|
|
PyObject *capi_keywds,
|
|
|
void (*f2py_func)(float*,float*,float*,float*,float*,float*,float*,int*,int*,float*,float*,float*,float*)) {
|
|
|
PyObject * volatile capi_buildvalue = NULL;
|
|
|
volatile int f2py_success = 1;
|
|
|
/*decl*/
|
|
|
|
|
|
float wl = 0;
|
|
|
PyObject *wl_capi = Py_None;
|
|
|
float tau = 0;
|
|
|
PyObject *tau_capi = Py_None;
|
|
|
float te1 = 0;
|
|
|
PyObject *te1_capi = Py_None;
|
|
|
float *ti1 = NULL;
|
|
|
npy_intp ti1_Dims[1] = {-1};
|
|
|
const int ti1_Rank = 1;
|
|
|
PyArrayObject *capi_ti1_tmp = NULL;
|
|
|
int capi_ti1_intent = 0;
|
|
|
PyObject *ti1_capi = Py_None;
|
|
|
float *fi1 = NULL;
|
|
|
npy_intp fi1_Dims[1] = {-1};
|
|
|
const int fi1_Rank = 1;
|
|
|
PyArrayObject *capi_fi1_tmp = NULL;
|
|
|
int capi_fi1_intent = 0;
|
|
|
PyObject *fi1_capi = Py_None;
|
|
|
float ven1 = 0;
|
|
|
PyObject *ven1_capi = Py_None;
|
|
|
float *vin1 = NULL;
|
|
|
npy_intp vin1_Dims[1] = {-1};
|
|
|
const int vin1_Rank = 1;
|
|
|
PyArrayObject *capi_vin1_tmp = NULL;
|
|
|
int capi_vin1_intent = 0;
|
|
|
PyObject *vin1_capi = Py_None;
|
|
|
int *wi1 = NULL;
|
|
|
npy_intp wi1_Dims[1] = {-1};
|
|
|
const int wi1_Rank = 1;
|
|
|
PyArrayObject *capi_wi1_tmp = NULL;
|
|
|
int capi_wi1_intent = 0;
|
|
|
PyObject *wi1_capi = Py_None;
|
|
|
int nion1 = 0;
|
|
|
PyObject *nion1_capi = Py_None;
|
|
|
float alpha1 = 0;
|
|
|
PyObject *alpha1_capi = Py_None;
|
|
|
float dens1 = 0;
|
|
|
PyObject *dens1_capi = Py_None;
|
|
|
float bfld1 = 0;
|
|
|
PyObject *bfld1_capi = Py_None;
|
|
|
float acf = 0;
|
|
|
PyObject *acf_capi = Py_None;
|
|
|
static char *capi_kwlist[] = {"wl","tau","te1","ti1","fi1","ven1","vin1","wi1","alpha1","dens1","bfld1","acf","nion1",NULL};
|
|
|
|
|
|
/*routdebugenter*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_clock();
|
|
|
#endif
|
|
|
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
|
|
|
"OOOOOOOOOOOO|O:fitacf_acf2.acf2",\
|
|
|
capi_kwlist,&wl_capi,&tau_capi,&te1_capi,&ti1_capi,&fi1_capi,&ven1_capi,&vin1_capi,&wi1_capi,&alpha1_capi,&dens1_capi,&bfld1_capi,&acf_capi,&nion1_capi))
|
|
|
return NULL;
|
|
|
/*frompyobj*/
|
|
|
/* Processing variable wl */
|
|
|
f2py_success = float_from_pyobj(&wl,wl_capi,"fitacf_acf2.acf2() 1st argument (wl) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable tau */
|
|
|
f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_acf2.acf2() 2nd argument (tau) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable te1 */
|
|
|
f2py_success = float_from_pyobj(&te1,te1_capi,"fitacf_acf2.acf2() 3rd argument (te1) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable ti1 */
|
|
|
;
|
|
|
capi_ti1_intent |= F2PY_INTENT_IN;
|
|
|
capi_ti1_tmp = array_from_pyobj(NPY_FLOAT,ti1_Dims,ti1_Rank,capi_ti1_intent,ti1_capi);
|
|
|
if (capi_ti1_tmp == NULL) {
|
|
|
PyObject *exc, *val, *tb;
|
|
|
PyErr_Fetch(&exc, &val, &tb);
|
|
|
PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 4th argument `ti1' of fitacf_acf2.acf2 to C/Fortran array" );
|
|
|
npy_PyErr_ChainExceptionsCause(exc, val, tb);
|
|
|
} else {
|
|
|
ti1 = (float *)(PyArray_DATA(capi_ti1_tmp));
|
|
|
|
|
|
/* Processing variable ven1 */
|
|
|
f2py_success = float_from_pyobj(&ven1,ven1_capi,"fitacf_acf2.acf2() 6th argument (ven1) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable alpha1 */
|
|
|
f2py_success = float_from_pyobj(&alpha1,alpha1_capi,"fitacf_acf2.acf2() 9th argument (alpha1) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable dens1 */
|
|
|
f2py_success = float_from_pyobj(&dens1,dens1_capi,"fitacf_acf2.acf2() 10th argument (dens1) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable bfld1 */
|
|
|
f2py_success = float_from_pyobj(&bfld1,bfld1_capi,"fitacf_acf2.acf2() 11st argument (bfld1) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable acf */
|
|
|
f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_acf2.acf2() 12nd argument (acf) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable nion1 */
|
|
|
if (nion1_capi == Py_None) nion1 = len(ti1); else
|
|
|
f2py_success = int_from_pyobj(&nion1,nion1_capi,"fitacf_acf2.acf2() 1st keyword (nion1) can't be converted to int");
|
|
|
if (f2py_success) {
|
|
|
CHECKSCALAR(len(ti1)>=nion1,"len(ti1)>=nion1","1st keyword nion1","acf2:nion1=%d",nion1) {
|
|
|
/* Processing variable fi1 */
|
|
|
fi1_Dims[0]=nion1;
|
|
|
capi_fi1_intent |= F2PY_INTENT_IN;
|
|
|
capi_fi1_tmp = array_from_pyobj(NPY_FLOAT,fi1_Dims,fi1_Rank,capi_fi1_intent,fi1_capi);
|
|
|
if (capi_fi1_tmp == NULL) {
|
|
|
PyObject *exc, *val, *tb;
|
|
|
PyErr_Fetch(&exc, &val, &tb);
|
|
|
PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 5th argument `fi1' of fitacf_acf2.acf2 to C/Fortran array" );
|
|
|
npy_PyErr_ChainExceptionsCause(exc, val, tb);
|
|
|
} else {
|
|
|
fi1 = (float *)(PyArray_DATA(capi_fi1_tmp));
|
|
|
|
|
|
/* Processing variable vin1 */
|
|
|
vin1_Dims[0]=nion1;
|
|
|
capi_vin1_intent |= F2PY_INTENT_IN;
|
|
|
capi_vin1_tmp = array_from_pyobj(NPY_FLOAT,vin1_Dims,vin1_Rank,capi_vin1_intent,vin1_capi);
|
|
|
if (capi_vin1_tmp == NULL) {
|
|
|
PyObject *exc, *val, *tb;
|
|
|
PyErr_Fetch(&exc, &val, &tb);
|
|
|
PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 7th argument `vin1' of fitacf_acf2.acf2 to C/Fortran array" );
|
|
|
npy_PyErr_ChainExceptionsCause(exc, val, tb);
|
|
|
} else {
|
|
|
vin1 = (float *)(PyArray_DATA(capi_vin1_tmp));
|
|
|
|
|
|
/* Processing variable wi1 */
|
|
|
wi1_Dims[0]=nion1;
|
|
|
capi_wi1_intent |= F2PY_INTENT_IN;
|
|
|
capi_wi1_tmp = array_from_pyobj(NPY_INT,wi1_Dims,wi1_Rank,capi_wi1_intent,wi1_capi);
|
|
|
if (capi_wi1_tmp == NULL) {
|
|
|
PyObject *exc, *val, *tb;
|
|
|
PyErr_Fetch(&exc, &val, &tb);
|
|
|
PyErr_SetString(exc ? exc : fitacf_acf2_error,"failed in converting 8th argument `wi1' of fitacf_acf2.acf2 to C/Fortran array" );
|
|
|
npy_PyErr_ChainExceptionsCause(exc, val, tb);
|
|
|
} else {
|
|
|
wi1 = (int *)(PyArray_DATA(capi_wi1_tmp));
|
|
|
|
|
|
/*end of frompyobj*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_call_clock();
|
|
|
#endif
|
|
|
/*callfortranroutine*/
|
|
|
(*f2py_func)(&wl,&tau,&te1,ti1,fi1,&ven1,vin1,wi1,&nion1,&alpha1,&dens1,&bfld1,&acf);
|
|
|
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("f",acf);
|
|
|
/*closepyobjfrom*/
|
|
|
/*end of closepyobjfrom*/
|
|
|
} /*if (f2py_success) after callfortranroutine*/
|
|
|
/*cleanupfrompyobj*/
|
|
|
if((PyObject *)capi_wi1_tmp!=wi1_capi) {
|
|
|
Py_XDECREF(capi_wi1_tmp); }
|
|
|
} /*if (capi_wi1_tmp == NULL) ... else of wi1*/
|
|
|
/* End of cleaning variable wi1 */
|
|
|
if((PyObject *)capi_vin1_tmp!=vin1_capi) {
|
|
|
Py_XDECREF(capi_vin1_tmp); }
|
|
|
} /*if (capi_vin1_tmp == NULL) ... else of vin1*/
|
|
|
/* End of cleaning variable vin1 */
|
|
|
if((PyObject *)capi_fi1_tmp!=fi1_capi) {
|
|
|
Py_XDECREF(capi_fi1_tmp); }
|
|
|
} /*if (capi_fi1_tmp == NULL) ... else of fi1*/
|
|
|
/* End of cleaning variable fi1 */
|
|
|
} /*CHECKSCALAR(len(ti1)>=nion1)*/
|
|
|
} /*if (f2py_success) of nion1*/
|
|
|
/* End of cleaning variable nion1 */
|
|
|
} /*if (f2py_success) of acf*/
|
|
|
/* End of cleaning variable acf */
|
|
|
} /*if (f2py_success) of bfld1*/
|
|
|
/* End of cleaning variable bfld1 */
|
|
|
} /*if (f2py_success) of dens1*/
|
|
|
/* End of cleaning variable dens1 */
|
|
|
} /*if (f2py_success) of alpha1*/
|
|
|
/* End of cleaning variable alpha1 */
|
|
|
} /*if (f2py_success) of ven1*/
|
|
|
/* End of cleaning variable ven1 */
|
|
|
if((PyObject *)capi_ti1_tmp!=ti1_capi) {
|
|
|
Py_XDECREF(capi_ti1_tmp); }
|
|
|
} /*if (capi_ti1_tmp == NULL) ... else of ti1*/
|
|
|
/* End of cleaning variable ti1 */
|
|
|
} /*if (f2py_success) of te1*/
|
|
|
/* End of cleaning variable te1 */
|
|
|
} /*if (f2py_success) of tau*/
|
|
|
/* End of cleaning variable tau */
|
|
|
} /*if (f2py_success) of wl*/
|
|
|
/* End of cleaning variable wl */
|
|
|
/*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 acf2 ********************************/
|
|
|
|
|
|
/*********************************** spect1 ***********************************/
|
|
|
static char doc_f2py_rout_fitacf_acf2_spect1[] = "\
|
|
|
spect1 = spect1(omega)\n\nWrapper for ``spect1``.\
|
|
|
\n\nParameters\n----------\n"
|
|
|
"omega : input float\n"
|
|
|
"\nReturns\n-------\n"
|
|
|
"spect1 : float";
|
|
|
/* extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); */
|
|
|
static PyObject *f2py_rout_fitacf_acf2_spect1(const PyObject *capi_self,
|
|
|
PyObject *capi_args,
|
|
|
PyObject *capi_keywds,
|
|
|
void (*f2py_func)(float*,float*)) {
|
|
|
PyObject * volatile capi_buildvalue = NULL;
|
|
|
volatile int f2py_success = 1;
|
|
|
/*decl*/
|
|
|
|
|
|
float spect1 = 0;
|
|
|
float omega = 0;
|
|
|
PyObject *omega_capi = Py_None;
|
|
|
static char *capi_kwlist[] = {"omega",NULL};
|
|
|
|
|
|
/*routdebugenter*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_clock();
|
|
|
#endif
|
|
|
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
|
|
|
"O|:fitacf_acf2.spect1",\
|
|
|
capi_kwlist,&omega_capi))
|
|
|
return NULL;
|
|
|
/*frompyobj*/
|
|
|
/* Processing variable omega */
|
|
|
f2py_success = float_from_pyobj(&omega,omega_capi,"fitacf_acf2.spect1() 1st argument (omega) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable spect1 */
|
|
|
/*end of frompyobj*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_call_clock();
|
|
|
#endif
|
|
|
/*callfortranroutine*/
|
|
|
(*f2py_func)(&spect1,&omega);
|
|
|
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("f",spect1);
|
|
|
/*closepyobjfrom*/
|
|
|
/*end of closepyobjfrom*/
|
|
|
} /*if (f2py_success) after callfortranroutine*/
|
|
|
/*cleanupfrompyobj*/
|
|
|
/* End of cleaning variable spect1 */
|
|
|
} /*if (f2py_success) of omega*/
|
|
|
/* End of cleaning variable omega */
|
|
|
/*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 spect1 *******************************/
|
|
|
|
|
|
/*********************************** gaussq ***********************************/
|
|
|
static char doc_f2py_rout_fitacf_acf2_gaussq[] = "\
|
|
|
gaussq(tau,acf)\n\nWrapper for ``gaussq``.\
|
|
|
\n\nParameters\n----------\n"
|
|
|
"tau : input float\n"
|
|
|
"acf : input float";
|
|
|
/* extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); */
|
|
|
static PyObject *f2py_rout_fitacf_acf2_gaussq(const PyObject *capi_self,
|
|
|
PyObject *capi_args,
|
|
|
PyObject *capi_keywds,
|
|
|
void (*f2py_func)(float*,float*)) {
|
|
|
PyObject * volatile capi_buildvalue = NULL;
|
|
|
volatile int f2py_success = 1;
|
|
|
/*decl*/
|
|
|
|
|
|
float tau = 0;
|
|
|
PyObject *tau_capi = Py_None;
|
|
|
float acf = 0;
|
|
|
PyObject *acf_capi = Py_None;
|
|
|
static char *capi_kwlist[] = {"tau","acf",NULL};
|
|
|
|
|
|
/*routdebugenter*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_clock();
|
|
|
#endif
|
|
|
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
|
|
|
"OO|:fitacf_acf2.gaussq",\
|
|
|
capi_kwlist,&tau_capi,&acf_capi))
|
|
|
return NULL;
|
|
|
/*frompyobj*/
|
|
|
/* Processing variable tau */
|
|
|
f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_acf2.gaussq() 1st argument (tau) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/* Processing variable acf */
|
|
|
f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_acf2.gaussq() 2nd argument (acf) can't be converted to float");
|
|
|
if (f2py_success) {
|
|
|
/*end of frompyobj*/
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
f2py_start_call_clock();
|
|
|
#endif
|
|
|
/*callfortranroutine*/
|
|
|
(*f2py_func)(&tau,&acf);
|
|
|
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("");
|
|
|
/*closepyobjfrom*/
|
|
|
/*end of closepyobjfrom*/
|
|
|
} /*if (f2py_success) after callfortranroutine*/
|
|
|
/*cleanupfrompyobj*/
|
|
|
} /*if (f2py_success) of acf*/
|
|
|
/* End of cleaning variable acf */
|
|
|
} /*if (f2py_success) of tau*/
|
|
|
/* End of cleaning variable tau */
|
|
|
/*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 gaussq *******************************/
|
|
|
/*eof body*/
|
|
|
|
|
|
/******************* See f2py2e/f90mod_rules.py: buildhooks *******************/
|
|
|
/*need_f90modhooks*/
|
|
|
|
|
|
/************** See f2py2e/rules.py: module_rules['modulebody'] **************/
|
|
|
|
|
|
/******************* See f2py2e/common_rules.py: buildhooks *******************/
|
|
|
|
|
|
static FortranDataDef f2py_spec_def[] = {
|
|
|
{"te",0,{{-1}},NPY_FLOAT},
|
|
|
{"ti",1,{{10}},NPY_FLOAT},
|
|
|
{"fi",1,{{10}},NPY_FLOAT},
|
|
|
{"ven",0,{{-1}},NPY_FLOAT},
|
|
|
{"vin",1,{{10}},NPY_FLOAT},
|
|
|
{"alpha",0,{{-1}},NPY_FLOAT},
|
|
|
{"dens",0,{{-1}},NPY_FLOAT},
|
|
|
{"bfld",0,{{-1}},NPY_FLOAT},
|
|
|
{"nion",0,{{-1}},NPY_INT},
|
|
|
{"wi",1,{{10}},NPY_INT},
|
|
|
{"ak",0,{{-1}},NPY_FLOAT},
|
|
|
{NULL}
|
|
|
};
|
|
|
static void f2py_setup_spec(char *te,char *ti,char *fi,char *ven,char *vin,char *alpha,char *dens,char *bfld,char *nion,char *wi,char *ak) {
|
|
|
int i_f2py=0;
|
|
|
f2py_spec_def[i_f2py++].data = te;
|
|
|
f2py_spec_def[i_f2py++].data = ti;
|
|
|
f2py_spec_def[i_f2py++].data = fi;
|
|
|
f2py_spec_def[i_f2py++].data = ven;
|
|
|
f2py_spec_def[i_f2py++].data = vin;
|
|
|
f2py_spec_def[i_f2py++].data = alpha;
|
|
|
f2py_spec_def[i_f2py++].data = dens;
|
|
|
f2py_spec_def[i_f2py++].data = bfld;
|
|
|
f2py_spec_def[i_f2py++].data = nion;
|
|
|
f2py_spec_def[i_f2py++].data = wi;
|
|
|
f2py_spec_def[i_f2py++].data = ak;
|
|
|
}
|
|
|
extern void F_FUNC(f2pyinitspec,F2PYINITSPEC)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*));
|
|
|
static void f2py_init_spec(void) {
|
|
|
F_FUNC(f2pyinitspec,F2PYINITSPEC)(f2py_setup_spec);
|
|
|
}
|
|
|
|
|
|
static FortranDataDef f2py_mode_def[] = {
|
|
|
{"imode",0,{{-1}},NPY_INT},
|
|
|
{NULL}
|
|
|
};
|
|
|
static void f2py_setup_mode(char *imode) {
|
|
|
int i_f2py=0;
|
|
|
f2py_mode_def[i_f2py++].data = imode;
|
|
|
}
|
|
|
extern void F_FUNC(f2pyinitmode,F2PYINITMODE)(void(*)(char*));
|
|
|
static void f2py_init_mode(void) {
|
|
|
F_FUNC(f2pyinitmode,F2PYINITMODE)(f2py_setup_mode);
|
|
|
}
|
|
|
|
|
|
/*need_commonhooks*/
|
|
|
|
|
|
/**************************** See f2py2e/rules.py ****************************/
|
|
|
|
|
|
static FortranDataDef f2py_routine_defs[] = {
|
|
|
{"acf2",-1,{{-1}},0,(char *)F_FUNC(acf2,ACF2),(f2py_init_func)f2py_rout_fitacf_acf2_acf2,doc_f2py_rout_fitacf_acf2_acf2},
|
|
|
{"spect1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spect1,SPECT1),(f2py_init_func)f2py_rout_fitacf_acf2_spect1,doc_f2py_rout_fitacf_acf2_spect1},
|
|
|
{"gaussq",-1,{{-1}},0,(char *)F_FUNC(gaussq,GAUSSQ),(f2py_init_func)f2py_rout_fitacf_acf2_gaussq,doc_f2py_rout_fitacf_acf2_gaussq},
|
|
|
|
|
|
/*eof routine_defs*/
|
|
|
{NULL}
|
|
|
};
|
|
|
|
|
|
static PyMethodDef f2py_module_methods[] = {
|
|
|
|
|
|
{NULL,NULL}
|
|
|
};
|
|
|
|
|
|
static struct PyModuleDef moduledef = {
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
"fitacf_acf2",
|
|
|
NULL,
|
|
|
-1,
|
|
|
f2py_module_methods,
|
|
|
NULL,
|
|
|
NULL,
|
|
|
NULL,
|
|
|
NULL
|
|
|
};
|
|
|
|
|
|
PyMODINIT_FUNC PyInit_fitacf_acf2(void) {
|
|
|
int i;
|
|
|
PyObject *m,*d, *s, *tmp;
|
|
|
m = fitacf_acf2_module = PyModule_Create(&moduledef);
|
|
|
Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
|
|
|
import_array();
|
|
|
if (PyErr_Occurred())
|
|
|
{PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_acf2 (failed to import numpy)"); return m;}
|
|
|
d = PyModule_GetDict(m);
|
|
|
s = PyString_FromString("$Revision: $");
|
|
|
PyDict_SetItemString(d, "__version__", s);
|
|
|
Py_DECREF(s);
|
|
|
s = PyUnicode_FromString(
|
|
|
"This module 'fitacf_acf2' is auto-generated with f2py (version:2).\nFunctions:\n"
|
|
|
" acf = acf2(wl,tau,te1,ti1,fi1,ven1,vin1,wi1,alpha1,dens1,bfld1,acf,nion1=len(ti1))\n"
|
|
|
" spect1 = spect1(omega)\n"
|
|
|
" gaussq(tau,acf)\n"
|
|
|
"COMMON blocks:\n"" /spec/ te,ti(10),fi(10),ven,vin(10),alpha,dens,bfld,nion,wi(10),ak\n"" /mode/ imode\n"".");
|
|
|
PyDict_SetItemString(d, "__doc__", s);
|
|
|
Py_DECREF(s);
|
|
|
fitacf_acf2_error = PyErr_NewException ("fitacf_acf2.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, "_fitacf_acf2_error", fitacf_acf2_error);
|
|
|
Py_DECREF(fitacf_acf2_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);
|
|
|
}
|
|
|
|
|
|
|
|
|
{
|
|
|
extern float F_FUNC(spect1,SPECT1)(void);
|
|
|
PyObject* o = PyDict_GetItemString(d,"spect1");
|
|
|
tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spect1,SPECT1),NULL);
|
|
|
PyObject_SetAttrString(o,"_cpointer", tmp);
|
|
|
Py_DECREF(tmp);
|
|
|
s = PyUnicode_FromString("spect1");
|
|
|
PyObject_SetAttrString(o,"__name__", s);
|
|
|
Py_DECREF(s);
|
|
|
}
|
|
|
|
|
|
|
|
|
/*eof initf2pywraphooks*/
|
|
|
/*eof initf90modhooks*/
|
|
|
|
|
|
tmp = PyFortranObject_New(f2py_spec_def,f2py_init_spec);
|
|
|
F2PyDict_SetItemString(d, "spec", tmp);
|
|
|
Py_DECREF(tmp);
|
|
|
tmp = PyFortranObject_New(f2py_mode_def,f2py_init_mode);
|
|
|
F2PyDict_SetItemString(d, "mode", tmp);
|
|
|
Py_DECREF(tmp);
|
|
|
/*eof initcommonhooks*/
|
|
|
|
|
|
|
|
|
#ifdef F2PY_REPORT_ATEXIT
|
|
|
if (! PyErr_Occurred())
|
|
|
on_exit(f2py_report_on_exit,(void*)"fitacf_acf2");
|
|
|
#endif
|
|
|
return m;
|
|
|
}
|
|
|
#ifdef __cplusplus
|
|
|
}
|
|
|
#endif
|
|
|
|