Changeset 5911


Ignore:
Timestamp:
Nov 6, 2008, 4:33:48 PM (16 years ago)
Author:
rwilson
Message:

NumPy? conversion.

Location:
anuga_core/source_numpy_conversion/anuga/mesh_engine
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source_numpy_conversion/anuga/mesh_engine/mesh_engine.py

    r4916 r5911  
    1111#import anuga.mesh_engine.list_dic as triang
    1212
    13 from Numeric import array, Float, Int32, reshape
     13import numpy
    1414
    1515from anuga.utilities.numerical_tools import ensure_numeric
     
    4646       
    4747    try:
    48         points =  ensure_numeric(points, Float)
     48        points =  ensure_numeric(points, numpy.float)
    4949    except ValueError:
    5050        msg = 'ERROR: Inconsistent points array.'
     
    6161    try:
    6262        # If Int is used, instead of Int32, it fails in Linux
    63         segments = ensure_numeric(segments, Int32)
     63        segments = ensure_numeric(segments, numpy.int32)
    6464       
    6565    except ValueError:
     
    7272       
    7373    try:
    74         holes = ensure_numeric(holes, Float)
     74        holes = ensure_numeric(holes, numpy.float)
    7575    except ValueError:
    7676        msg = 'ERROR: Inconsistent holess array.'
     
    8080    regions = add_area_tag(regions)
    8181    try:
    82         regions = ensure_numeric(regions, Float)
     82        regions = ensure_numeric(regions, numpy.float)
    8383    except  (ValueError, TypeError):
    8484        msg = 'ERROR: Inconsistent regions array.'
     
    9090   
    9191    try:
    92         pointatts = ensure_numeric(pointatts, Float)
     92        pointatts = ensure_numeric(pointatts, numpy.float)
    9393    except (ValueError, TypeError):
    9494        msg = 'ERROR: Inconsistent point attributes array.'
     
    100100        raise ANUGAError, msg
    101101    if len(pointatts.shape) == 1:
    102         pointatts = reshape(pointatts,(pointatts.shape[0],1))
    103    
    104     try:
    105         segatts = ensure_numeric(segatts, Int32)
     102        pointatts = numpy.reshape(pointatts,(pointatts.shape[0],1))
     103   
     104    try:
     105        segatts = ensure_numeric(segatts, numpy.int32)
    106106    except ValueError:
    107107        msg = 'ERROR: Inconsistent point attributes array.'
  • anuga_core/source_numpy_conversion/anuga/mesh_engine/mesh_engine_c_layer.c

    r4917 r5911  
    6464#define PY_ARRAY_UNIQUE_SYMBOL API_YEAH
    6565//#define NO_IMPORT_ARRAY
    66 #include "Numeric/arrayobject.h"
     66//#include "numpy/oldnumeric.h"
     67#include "numpy/arrayobject.h"
    6768#include <sys/types.h>
    6869
  • anuga_core/source_numpy_conversion/anuga/mesh_engine/test_generate_mesh.py

    r5875 r5911  
    55level of the code, using the -j flag in triangle.
    66"""
    7 
    8 
    9 #FIXME (Ole): Go through this file and check that array's
    10 #             aren't compared using ==. Need to use either alltrue
    11 #             (on 1D integer arrays) or allclose.
    12  
    13 
    147import sys
    158
     
    1710from anuga.mesh_engine.mesh_engine import generate_mesh
    1811
    19 from Numeric import array, Float, Int
     12import numpy
    2013
    2114from anuga.utilities.numerical_tools import ensure_numeric
     
    4538        mode = "Qzp"
    4639       
    47         points =  ensure_numeric(points, Float)
    48         seglist = test = ensure_numeric(seglist, Int)
     40        points =  ensure_numeric(points, numpy.float)
     41        seglist = test = ensure_numeric(seglist, numpy.int)
    4942        data = triang.genMesh(points,seglist,holelist,regionlist,
    5043                              pointattlist,segattlist, mode, test)
Note: See TracChangeset for help on using the changeset viewer.