source: trunk/anuga_work/development/2010-projects/anuga_1d/sqpipe/sqpipe_python.h @ 8238

Last change on this file since 8238 was 8238, checked in by paul, 12 years ago

Bulk modulus of fluid now in use for 1d domains

File size: 1.9 KB
Line 
1struct sqpipe_domain* sqpipe_domain_python_get(struct sqpipe_domain *sD, PyObject *domain, double timestep);
2struct quantities* sqpipe_quantities_python_get(struct quantities *qs, PyObject* quantities, char *name);
3
4struct sqpipe_domain* sqpipe_domain_python_get(struct sqpipe_domain *sD, PyObject *domain, double timestep) {
5  PyObject *quantities;
6  struct domain *D = (struct domain *)sD;
7  struct sqpipe_params *sp = (struct sqpipe_params *) D->params;
8
9  // Get a generic domain
10  D = get_python_domain(D, domain, timestep);
11
12  // Get the specific quantities for square pipes
13  quantities = get_python_object(domain, "quantities");
14  D->vertex_values = sqpipe_quantities_python_get(D->vertex_values, quantities, "vertex_values");
15  D->boundary_values = sqpipe_quantities_python_get(D->boundary_values, quantities, "boundary_values");
16  D->explicit_update = sqpipe_quantities_python_get(D->explicit_update, quantities, "explicit_update");
17
18  // Get the specific parameters for square pipes
19  sp->g = get_python_double(domain,"g");
20  sp->h0 = get_python_double(domain,"h0");
21  sp->bulk_modulus = get_python_double(domain, "bulk_modulus");
22
23  return sD;
24}
25
26struct quantities* sqpipe_quantities_python_get(struct quantities *qs, PyObject* quantities, char *name) {
27  struct sqpipe_quantities *ps = (struct sqpipe_quantities *) qs;
28 
29  ps->a = get_python_array_data_from_dict(quantities, "area", name);
30  ps->d = get_python_array_data_from_dict(quantities, "discharge", name);
31  ps->w = get_python_array_data_from_dict(quantities, "stage", name);
32  ps->h = get_python_array_data_from_dict(quantities, "height", name);
33  ps->u = get_python_array_data_from_dict(quantities, "velocity", name); 
34  ps->z = get_python_array_data_from_dict(quantities, "elevation", name);
35  ps->b = get_python_array_data_from_dict(quantities, "width", name);
36  ps->t = get_python_array_data_from_dict(quantities, "top", name);
37
38  return qs;
39}
Note: See TracBrowser for help on using the repository browser.