Skip to content
Snippets Groups Projects
wrapper.c 1.20 KiB
#include "units_wrapper.h"
#include "part_wrapper.h"
#include "parser_wrapper.h"
#include "cooling_wrapper.h"
#include "pyswiftsim_tools.h"


#include <Python.h>
#include <math.h>
#include <numpy/arrayobject.h>


/* definition of the method table */      
      
static PyMethodDef wrapper_methods[] = {

  {"partTestStruct", pypart_test_struct, METH_VARARGS,
   "Construct a part object and return it."},

  {"unitSystemTestStruct", pyunit_system_test_struct, METH_VARARGS,
   "Construct a unit_system object and return it."},

  {"parserReadFile", pyparser_read_file, METH_VARARGS,
   "Read a swift params file."},

  {"unitSystemInit", pyunit_system_init, METH_VARARGS,
   "Construct a unit_system object and return it."},

  {"coolingInit", pycooling_init, METH_VARARGS,
   "Initialize cooling."},

  {NULL, NULL, 0, NULL}        /* Sentinel */
};      
      
      

static struct PyModuleDef wrapper_cmodule = {
  PyModuleDef_HEAD_INIT,
  "wrapper",
  "Wrapper around the SPH cosmological simulation code SWIFT",
  -1,
  wrapper_methods
};


PyMODINIT_FUNC PyInit_wrapper(void)
{
  PyObject *m;

  Py_Initialize();
  import_array();
  m = PyModule_Create(&wrapper_cmodule);

  if (m == NULL)
    return NULL;

  return m;
}