source: trunk/anuga_work/development/2010-projects/anuga_1d/sqpipe/sqpipe_pressurised_fixed_width_a_d_comp_flux.c @ 8239

Last change on this file since 8239 was 8239, checked in by steve, 13 years ago

Testing Paul's 1d code

File size: 1.5 KB
Line 
1#include "Python.h"
2#include "numpy/arrayobject.h"
3#include "math.h"
4#include <stdio.h>
5
6const double pi = 3.14159265358979;
7
8// Shared code snippets
9#include "util_ext.h"
10#include "solver.h"
11#include "python_solver.h"
12#include "sqpipe_pressurised_fixed_width_a_d.h"
13#include "sqpipe_python.h"
14
15//=========================================================================
16// Python Glue
17//=========================================================================
18
19PyObject *compute_fluxes_ext(PyObject *self, PyObject *args) {
20  struct domain *D = (struct domain *) sqpipe_pressurised_fixed_width_a_d_domain_new();
21  double timestep;
22  PyObject *domain;
23
24  // Convert Python arguments to C
25  if (!PyArg_ParseTuple(args, "dO", &timestep, &domain)) {
26    PyErr_SetString(PyExc_RuntimeError, "comp_flux_ext.c: compute_fluxes_ext could not parse input");
27    return NULL;
28  }
29
30  D = (struct domain *) sqpipe_domain_python_get((struct sqpipe_domain *)D, domain, timestep);
31
32  timestep = domain_compute_fluxes(D);
33  domain_destroy(D);
34 
35  return Py_BuildValue("d", timestep);
36}
37
38//-------------------------------
39// Method table for python module
40//-------------------------------
41
42static struct PyMethodDef MethodTable[] = {
43  {"compute_fluxes_ext", compute_fluxes_ext, METH_VARARGS, "Print out"},
44  {NULL, NULL}
45};
46
47// Module initialisation
48void initsqpipe_pressurised_fixed_width_a_d_comp_flux(void){
49  Py_InitModule("sqpipe_pressurised_fixed_width_a_d_comp_flux", MethodTable);
50  import_array();
51}
Note: See TracBrowser for help on using the repository browser.