Changeset 8813


Ignore:
Timestamp:
Apr 5, 2013, 5:35:50 PM (12 years ago)
Author:
steve
Message:

Just excluding damage_modelling from unit test because they use scientific python for interpolation, should change to scipy.

Location:
trunk/anuga_core/source/anuga
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r8810 r8813  
    10341034        assert self.conserved_quantities[2] == 'ymomentum', msg
    10351035
     1036       
     1037    #@profile
    10361038    def extrapolate_second_order_sw(self):
    10371039        """Fast version of extrapolation from centroids to edges"""
     
    10401042        extrapol2(self)
    10411043
    1042 
     1044    #@profile
    10431045    def compute_fluxes(self):
    10441046        """Compute fluxes and timestep suitable for all volumes in domain.
     
    10821084            # Use standard flux calculation, but calc gravity
    10831085            # as -g h grad(w) - sum midpoint edge pressure terms
     1086            import objgraph
     1087            #print 50*"="
     1088            #objgraph.show_most_common_types()
     1089            #print objgraph.typestats(objgraph.get_leaking_objects())
     1090            #objgraph.show_growth()
     1091
    10841092            from shallow_water_ext import compute_fluxes_ext_central_structure
    10851093            from shallow_water_ext import gravity_wb as gravity_wb_c
    10861094
    10871095            self.flux_timestep = compute_fluxes_ext_central_structure(self)
     1096
     1097            #print 50*"-"
     1098            #objgraph.show_most_common_types()
    10881099            gravity_wb_c(self)
     1100
     1101            #print 50*"-"
     1102            #objgraph.show_most_common_types()
    10891103
    10901104        elif self.compute_fluxes_method == 'wb_3':
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_ext.c

    r8810 r8813  
    19261926        D.ymom_explicit_update[k] += -g * zy*avg_h;
    19271927    }
     1928
    19281929
    19291930    return Py_BuildValue("");
     
    27702771    beta_vh_dry            = D->beta_vh_dry;
    27712772    optimise_dry_cells     = D->optimise_dry_cells;
     2773
    27722774    extrapolate_velocity_second_order = D->extrapolate_velocity_second_order;
    27732775
     
    54825484    timestep = _compute_fluxes_central_structure(&D);
    54835485
    5484 
     5486   
    54855487    return Py_BuildValue("d", timestep);
    54865488}
     
    55335535    // the explicit update arrays
    55345536    timestep = _compute_fluxes_central_wb(&D);
     5537
    55355538
    55365539
  • trunk/anuga_core/source/anuga/shallow_water/sw_domain.h

    r8457 r8813  
    253253    D->ymom_explicit_update  = get_python_array_data_from_dict(quantities, "ymomentum", "explicit_update");
    254254
     255
     256    Py_DECREF(quantities);
     257
     258    Py_DECREF(neighbours);
     259    Py_DECREF(surrogate_neighbours);
     260    Py_DECREF(neighbour_edges);
     261    Py_DECREF(normals);
     262    Py_DECREF(edgelengths);
     263    Py_DECREF(radii);
     264    Py_DECREF(areas);
     265    Py_DECREF(tri_full_flag);
     266    Py_DECREF(already_computed_flux);
     267    Py_DECREF(vertex_coordinates);
     268    Py_DECREF(edge_coordinates);
     269    Py_DECREF(centroid_coordinates);
     270    Py_DECREF(max_speed);
     271    Py_DECREF(number_of_boundaries);
    255272
    256273    return D;
  • trunk/anuga_core/source/anuga/test_all.py

    r8779 r8813  
    3333
    3434# Directories that should not be searched for test files.
    35 exclude_dirs = ['shallow_water_balanced' , # Special requirements
     35exclude_dirs = ['shallow_water_balanced' , 'damage_modelling', # Special requirements
    3636                '.svn',          # subversion
    3737                'props', 'wcprops', 'prop-base', 'text-base', 'tmp']
  • trunk/anuga_core/source/anuga/utilities/util_ext.h

    r8377 r8813  
    293293  */
    294294   
    295   B = (PyArrayObject*) PyObject_GetAttrString(O, name);
     295  B = (PyArrayObject*) PyObject_GetAttrString(O, name);  // New Reference
    296296
    297297  //printf("B = %p\n",(void*)B);
     
    306306  //Convert to consecutive array
    307307  A = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*) B,
    308                                                     B -> descr -> type, 0, 0);
     308                                                    B -> descr -> type, 0, 0);   // New Reference
    309309 
    310310  Py_DECREF(B); //FIXME: Is this really needed??
     
    330330
    331331  //Get double from attribute
    332   TObject = PyObject_GetAttrString(O, name);
     332  TObject = PyObject_GetAttrString(O, name); //New Reference
    333333  if (!TObject) {
    334334        snprintf(buf, BUFFER_SIZE, "util_ext.h: get_python_double could not obtain double %s.\n", name);
     
    377377  PyObject *Oout;
    378378
    379   Oout = PyObject_GetAttrString(O, name);
     379  Oout = PyObject_GetAttrString(O, name); // New Reference
    380380  if (!Oout) {
    381381    PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_object could not obtain object");
     
    391391  PyObject *A;
    392392  PyArrayObject *B;
    393 
    394   A = PyDict_GetItemString(O, name);
    395   B = get_consecutive_array(A, array);
    396 
    397   return (double *) B->data;
     393  double *data;
     394
     395  A = PyDict_GetItemString(O, name); // Borrowed Reference
     396  if (!A) {
     397    PyErr_SetString(PyExc_RuntimeError, "util_ext.h: get_python_array_from_object could not obtain object");
     398    return NULL;
     399  }
     400  B = get_consecutive_array(A, array); // New Reference
     401
     402
     403  data = (double *) B->data;
     404
     405  Py_DECREF(B);
     406
     407  return data;
    398408}
    399409
Note: See TracChangeset for help on using the changeset viewer.