Commits

Matthew Turk committed 514041f

Added much grid exposure. Getting baryon fields segfaults for me as of right
now; not sure why, working on that still. Changed enzo to always define the
numpy types and to have different types for baryons and particles. Added in a
routine for exposure to c numpy routines, written by Travis Oliphant.

  • Participants
  • Parent commits 3fcd2ba
  • Branches shared-library

Comments (0)

Files changed (11)

File src/enzo/ExposeGridHierarchy.C

 
   //fprintf(stderr, "counter: %d\n", counter++); // 3
   flat_dimensions[1] = 3;
-  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_FLOAT);
+  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_PFLOAT);
   PyDict_SetItemString(hierarchy_information, "GridLeftEdge", (PyObject *) temp_array);
   Py_DECREF(temp_array);
 
   //fprintf(stderr, "counter: %d\n", counter++); // 4
   flat_dimensions[1] = 3;
-  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_FLOAT);
+  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_PFLOAT);
   PyDict_SetItemString(hierarchy_information, "GridRightEdge", (PyObject *) temp_array);
   Py_DECREF(temp_array);
 
 
   //fprintf(stderr, "counter: %d\n", counter++); // 6
   flat_dimensions[1] = 1;
-  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_FLOAT);
+  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_PFLOAT);
   PyDict_SetItemString(hierarchy_information, "GridTimes", (PyObject *) temp_array);
   Py_DECREF(temp_array);
 
   //fprintf(stderr, "counter: %d\n", counter++); // 7
   flat_dimensions[1] = 1;
-  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_FLOAT);
+  temp_array = (PyArrayObject *) PyArray_SimpleNew(2, flat_dimensions, ENPY_PFLOAT);
   PyDict_SetItemString(hierarchy_information, "GridOldTimes", (PyObject *) temp_array);
   Py_DECREF(temp_array);
 

File src/enzo/Grid_ConvertToNumpy.C

             /* This gives back a new reference 
                So we need to decref it after we add it to the dict */
             dataset = (PyArrayObject *) PyArray_SimpleNewFromData(
-                    3, dims, ENPY_FLOAT, BaryonField[field]);
+                    3, dims, ENPY_BFLOAT, BaryonField[field]);
             dataset->flags &= ~NPY_OWNDATA;
             PyDict_SetItemString(grid_data, DataLabel[field], (PyObject*) dataset);
             Py_DECREF(dataset);
 
 			/* Now the old grid data */
             dataset = (PyArrayObject *) PyArray_SimpleNewFromData(
-                    3, dims, ENPY_FLOAT, OldBaryonField[field]);
+                    3, dims, ENPY_BFLOAT, OldBaryonField[field]);
             dataset->flags &= ~NPY_OWNDATA;
             PyDict_SetItemString(old_grid_data, DataLabel[field], (PyObject*) dataset);
             Py_DECREF(dataset);

File src/enzo/macros_and_parameters.h

 #endif
 #endif
 
+#ifdef SHARED_LIBRARY
+#define private public
+#endif
+
 #include "message.h"
 
 #ifdef CONFIG_THROW_ABORT
 #define HDF5_REAL HDF5_R4
 #define HDF5_FILE_REAL HDF5_FILE_R8
 #endif
-#ifdef USE_PYTHON
-#define ENPY_FLOAT NPY_FLOAT
-#endif
+#define ENPY_BFLOAT NPY_FLOAT
 #endif
 
 #ifdef CONFIG_BFLOAT_8
 #define HDF5_REAL HDF5_R8
 #define HDF5_FILE_REAL HDF5_FILE_R8
 #endif
-#ifdef USE_PYTHON
-#define ENPY_FLOAT NPY_DOUBLE
-#endif
+#define ENPY_BFLOAT NPY_DOUBLE
 #endif
 
 #ifdef CONFIG_PFLOAT_4
 #define FLOATDataType MPI_FLOAT
 #define HDF5_PREC HDF5_R4
 #define HDF5_FILE_PREC HDF5_FILE_R4
+#define ENPY_PFLOAT NPY_FLOAT
 #endif
 
 #ifdef CONFIG_PFLOAT_8
 #define FLOATDataType MPI_DOUBLE
 #define HDF5_PREC HDF5_R8
 #define HDF5_FILE_PREC HDF5_FILE_R8
-#ifdef USE_PYTHON
-#define ENPY_FLOAT NPY_DOUBLE
-#endif
+#define ENPY_PFLOAT NPY_DOUBLE
 #endif
 
 #ifdef CONFIG_PFLOAT_16
 #define FLOATDataType MPI_LONG_DOUBLE
 #define HDF5_PREC HDF5_R16
 #define HDF5_FILE_PREC HDF5_FILE_R16
-#ifdef USE_PYTHON
-#define ENPY_FLOAT NPY_LONGDOUBLE
-#endif
+#define ENPY_PFLOAT NPY_LONGDOUBLE
 #endif
 
 

File src/libenzo/enzo_wrap/c_numpy.pxd

+# :Author:    Travis Oliphant
+
+cdef extern from "numpy/arrayobject.h":
+
+    cdef enum NPY_TYPES:
+        NPY_BOOL
+        NPY_BYTE
+        NPY_UBYTE
+        NPY_SHORT
+        NPY_USHORT 
+        NPY_INT
+        NPY_UINT 
+        NPY_LONG
+        NPY_ULONG
+        NPY_LONGLONG
+        NPY_ULONGLONG
+        NPY_FLOAT
+        NPY_DOUBLE 
+        NPY_LONGDOUBLE
+        NPY_CFLOAT
+        NPY_CDOUBLE
+        NPY_CLONGDOUBLE
+        NPY_OBJECT
+        NPY_STRING
+        NPY_UNICODE
+        NPY_VOID
+        NPY_NTYPES
+        NPY_NOTYPE
+
+    cdef enum requirements:
+        NPY_CONTIGUOUS
+        NPY_FORTRAN
+        NPY_OWNDATA
+        NPY_FORCECAST
+        NPY_ENSURECOPY
+        NPY_ENSUREARRAY
+        NPY_ELEMENTSTRIDES
+        NPY_ALIGNED
+        NPY_NOTSWAPPED
+        NPY_WRITEABLE
+        NPY_UPDATEIFCOPY
+        NPY_ARR_HAS_DESCR
+
+        NPY_BEHAVED
+        NPY_BEHAVED_NS
+        NPY_CARRAY
+        NPY_CARRAY_RO
+        NPY_FARRAY
+        NPY_FARRAY_RO
+        NPY_DEFAULT
+
+        NPY_IN_ARRAY
+        NPY_OUT_ARRAY
+        NPY_INOUT_ARRAY
+        NPY_IN_FARRAY
+        NPY_OUT_FARRAY
+        NPY_INOUT_FARRAY
+
+        NPY_UPDATE_ALL 
+
+    cdef enum defines:
+        # Note: as of Pyrex 0.9.5, enums are type-checked more strictly, so this
+        # can't be used as an integer.
+        NPY_MAXDIMS
+
+    ctypedef struct npy_cdouble:
+        double real
+        double imag
+
+    ctypedef struct npy_cfloat:
+        double real
+        double imag
+
+    ctypedef int npy_intp 
+
+    ctypedef extern class numpy.dtype [object PyArray_Descr]:
+        cdef int type_num, elsize, alignment
+        cdef char type, kind, byteorder, hasobject
+        cdef object fields, typeobj
+
+    ctypedef extern class numpy.ndarray [object PyArrayObject]:
+        cdef char *data
+        cdef int nd
+        cdef npy_intp *dimensions
+        cdef npy_intp *strides
+        cdef object base
+        cdef dtype descr
+        cdef int flags
+
+    ctypedef extern class numpy.flatiter [object PyArrayIterObject]:
+        cdef int  nd_m1
+        cdef npy_intp index, size
+        cdef ndarray ao
+        cdef char *dataptr
+        
+    ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]:
+        cdef int numiter
+        cdef npy_intp size, index
+        cdef int nd
+        # These next two should be arrays of [NPY_MAXITER], but that is
+        # difficult to cleanly specify in Pyrex. Fortunately, it doesn't matter.
+        cdef npy_intp *dimensions
+        cdef void **iters
+
+    object PyArray_ZEROS(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+    object PyArray_EMPTY(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+    dtype PyArray_DescrFromTypeNum(NPY_TYPES type_num)
+    object PyArray_SimpleNew(int ndims, npy_intp* dims, NPY_TYPES type_num)
+    object PyArray_SimpleNewFromData(int ndims, npy_intp* dims,
+                                     NPY_TYPES type_num, void *data)
+    int PyArray_Check(object obj)
+    object PyArray_ContiguousFromAny(object obj, NPY_TYPES type, 
+        int mindim, int maxdim)
+    npy_intp PyArray_SIZE(ndarray arr)
+    npy_intp PyArray_NBYTES(ndarray arr)
+    void *PyArray_DATA(ndarray arr)
+    object PyArray_FromAny(object obj, dtype newtype, int mindim, int maxdim,
+		    int requirements, object context)
+    object PyArray_FROMANY(object obj, NPY_TYPES type_num, int min,
+                           int max, int requirements)
+    object PyArray_NewFromDescr(object subtype, dtype newtype, int nd,
+                                npy_intp* dims, npy_intp* strides, void* data,
+                                int flags, object parent)
+    void* PyArray_GETPTR2(object obj, int i, int j)
+
+    void PyArray_ITER_NEXT(flatiter it)
+
+    void import_array()

File src/libenzo/enzo_wrap/enzo_grid.pxi

     ctypedef struct c_grid "grid":
         void DeleteAllFields()
         void AllocateGrids()
-        int AppendForcingToBaryonFields() 
-        int DetachForcingFromBaryonFields() 
-        int SetExternalBoundaryValues(c_ExternalBoundary *Exterior)
+        Eint AppendForcingToBaryonFields() 
+        Eint DetachForcingFromBaryonFields() 
+        Eint SetExternalBoundaryValues(c_ExternalBoundary *Exterior)
+
+        # All the grid properties go here
+        
+        Eint GridRank
+        Eint GridDimension[MAX_DIMENSION]
+        Eint GridStartIndex[MAX_DIMENSION]
+        Eint GridEndIndex[MAX_DIMENSION]
+
+        Eflt   GridLeftEdge[MAX_DIMENSION]
+        Eflt   GridRightEdge[MAX_DIMENSION]
+        Eflt   dtFixed
+        Eflt   Time
+        Eflt   OldTime
+        Eint   SubgridsAreStatic
+        Eint   ID
+        
+        # Baryon grid data
+        
+        Eint    NumberOfBaryonFields
+        Eflt   *BaryonField[MAX_NUMBER_OF_BARYON_FIELDS]
+        Eflt   *OldBaryonField[MAX_NUMBER_OF_BARYON_FIELDS]
+        Eflt   *InterpolatedField[MAX_NUMBER_OF_BARYON_FIELDS]
+        Eflt   *RandomForcingField[MAX_DIMENSION]
+        Eint    FieldType[MAX_NUMBER_OF_BARYON_FIELDS]
+        Eflt   *CellLeftEdge[MAX_DIMENSION]
+        Eflt   *CellWidth[MAX_DIMENSION]
+        c_fluxes *BoundaryFluxes
+
+        # MHD data
+
+        Eflt   *divB
+        Eflt   *gradPhi[MAX_DIMENSION]
+
+        Eflt    CourantSafetyNumber
+        Eint    PPMFlatteningParameter
+        Eint    PPMDiffusionParameter
+        Eint    PPMSteepeningParameter
+        
+        # Particle data
+        
+        Eint    NumberOfParticles
+        Eflt   *ParticlePosition[MAX_DIMENSION]
+        Eflt   *ParticleVelocity[MAX_DIMENSION]
+        Eflt   *ParticleAcceleration[MAX_DIMENSION+1]
+        Eflt   *ParticleMass
+        Eint   *ParticleNumber
+        Eint   *ParticleType
+        Eflt   *ParticleAttribute[MAX_NUMBER_OF_PARTICLE_ATTRIBUTES]
+        
+        # Star particle data
+        
+        Eint NumberOfStars
+        #Star *Stars
+
+        # Gravity data
+     
+        Eflt   *PotentialField
+        Eflt   *AccelerationField[MAX_DIMENSION]
+        Eflt   *GravitatingMassField
+        Eflt    GravitatingMassFieldLeftEdge[MAX_DIMENSION]
+        Eint    GravitatingMassFieldDimension[MAX_DIMENSION]
+        Eflt    GravitatingMassFieldCellSize
+        Eflt   *GravitatingMassFieldParticles
+        Eflt    GravitatingMassFieldParticlesLeftEdge[MAX_DIMENSION]
+        Eflt    GravitatingMassFieldParticlesCellSize
+        Eint    GravitatingMassFieldParticlesDimension[MAX_DIMENSION]
+
+        #gravity_boundary_type GravityBoundaryType
+
+        Eflt    PotentialSum
+        
+        # Rebuild Hierarchy Temporaries
+        
+        Eint   *FlaggingField
+        Eflt   *MassFlaggingField
+        Eflt   *ParticleMassFlaggingField
+        
+        # Parallel Information
+        
+        Eint ProcessorNumber
+
+        #  Movie Data Format
+        Eint TimestepsSinceCreation
+
     c_grid *new_grid "new grid" ()
     void del_grid "delete" (c_grid *g)
 
         self.thisptr.SetExternalBoundaryValues(Exterior.thisptr)
     def IsNull(self):
         return self.thisptr == NULL
+
+    def get_baryon_field(self, int index):
+        cdef int dim, size = 1, i
+        cdef Eint32 ndims = 1
+        cdef np.npy_intp dims[3]
+        print "Getting size"
+        for dim in range(3):
+            size *= self.thisptr.GridDimension[dim]
+            dims[dim] = self.thisptr.GridDimension[dim]
+        print "Getting field", E_ENPY_BFLOAT
+        cdef np.ndarray field
+        field = cnp.PyArray_SimpleNewFromData(
+                    ndims, dims, E_ENPY_BFLOAT,
+                    self.thisptr.BaryonField[index])
+        # Might need to set field flags here
+        print "Returning field"
+        return field
+
+    # This code was auto-generated by wrap_dot_h.py
+
+    property GridRank:
+        def __get__(self):
+            return self.thisptr.GridRank
+        def __set__(self, Eint val):
+            self.thisptr.GridRank = val
+
+
+    property GridDimension:
+        def __get__(self):
+            print "Returning a copy of GridDimension"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GridDimension[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GridDimension[i] = val[i]
+
+
+    property GridStartIndex:
+        def __get__(self):
+            print "Returning a copy of GridStartIndex"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GridStartIndex[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GridStartIndex[i] = val[i]
+
+
+    property GridEndIndex:
+        def __get__(self):
+            print "Returning a copy of GridEndIndex"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GridEndIndex[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GridEndIndex[i] = val[i]
+
+
+    property GridLeftEdge:
+        def __get__(self):
+            print "Returning a copy of GridLeftEdge"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GridLeftEdge[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GridLeftEdge[i] = val[i]
+
+
+    property GridRightEdge:
+        def __get__(self):
+            print "Returning a copy of GridRightEdge"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GridRightEdge[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GridRightEdge[i] = val[i]
+
+
+    property dtFixed:
+        def __get__(self):
+            return self.thisptr.dtFixed
+        def __set__(self, Eflt val):
+            self.thisptr.dtFixed = val
+
+
+    property Time:
+        def __get__(self):
+            return self.thisptr.Time
+        def __set__(self, Eflt val):
+            self.thisptr.Time = val
+
+
+    property OldTime:
+        def __get__(self):
+            return self.thisptr.OldTime
+        def __set__(self, Eflt val):
+            self.thisptr.OldTime = val
+
+
+    property SubgridsAreStatic:
+        def __get__(self):
+            return self.thisptr.SubgridsAreStatic
+        def __set__(self, Eint val):
+            self.thisptr.SubgridsAreStatic = val
+
+
+    property ID:
+        def __get__(self):
+            return self.thisptr.ID
+        def __set__(self, Eint val):
+            self.thisptr.ID = val
+
+
+    property NumberOfBaryonFields:
+        def __get__(self):
+            return self.thisptr.NumberOfBaryonFields
+        def __set__(self, Eint val):
+            self.thisptr.NumberOfBaryonFields = val
+
+
+    property FieldType:
+        def __get__(self):
+            print "Returning a copy of FieldType"
+            retval = []
+            for i in range(MAX_NUMBER_OF_BARYON_FIELDS):
+                retval.append(self.thisptr.FieldType[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_NUMBER_OF_BARYON_FIELDS):
+                self.thisptr.FieldType[i] = val[i]
+
+
+    property CourantSafetyNumber:
+        def __get__(self):
+            return self.thisptr.CourantSafetyNumber
+        def __set__(self, Eflt val):
+            self.thisptr.CourantSafetyNumber = val
+
+
+    property PPMFlatteningParameter:
+        def __get__(self):
+            return self.thisptr.PPMFlatteningParameter
+        def __set__(self, Eint val):
+            self.thisptr.PPMFlatteningParameter = val
+
+
+    property PPMDiffusionParameter:
+        def __get__(self):
+            return self.thisptr.PPMDiffusionParameter
+        def __set__(self, Eint val):
+            self.thisptr.PPMDiffusionParameter = val
+
+
+    property PPMSteepeningParameter:
+        def __get__(self):
+            return self.thisptr.PPMSteepeningParameter
+        def __set__(self, Eint val):
+            self.thisptr.PPMSteepeningParameter = val
+
+
+    property NumberOfParticles:
+        def __get__(self):
+            return self.thisptr.NumberOfParticles
+        def __set__(self, Eint val):
+            self.thisptr.NumberOfParticles = val
+
+
+    property NumberOfStars:
+        def __get__(self):
+            return self.thisptr.NumberOfStars
+        def __set__(self, Eint val):
+            self.thisptr.NumberOfStars = val
+
+
+    property GravitatingMassFieldLeftEdge:
+        def __get__(self):
+            print "Returning a copy of GravitatingMassFieldLeftEdge"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GravitatingMassFieldLeftEdge[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GravitatingMassFieldLeftEdge[i] = val[i]
+
+
+    property GravitatingMassFieldDimension:
+        def __get__(self):
+            print "Returning a copy of GravitatingMassFieldDimension"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GravitatingMassFieldDimension[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GravitatingMassFieldDimension[i] = val[i]
+
+
+    property GravitatingMassFieldCellSize:
+        def __get__(self):
+            return self.thisptr.GravitatingMassFieldCellSize
+        def __set__(self, Eflt val):
+            self.thisptr.GravitatingMassFieldCellSize = val
+
+
+    property GravitatingMassFieldParticlesLeftEdge:
+        def __get__(self):
+            print "Returning a copy of GravitatingMassFieldParticlesLeftEdge"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GravitatingMassFieldParticlesLeftEdge[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GravitatingMassFieldParticlesLeftEdge[i] = val[i]
+
+
+    property GravitatingMassFieldParticlesCellSize:
+        def __get__(self):
+            return self.thisptr.GravitatingMassFieldParticlesCellSize
+        def __set__(self, Eflt val):
+            self.thisptr.GravitatingMassFieldParticlesCellSize = val
+
+
+    property GravitatingMassFieldParticlesDimension:
+        def __get__(self):
+            print "Returning a copy of GravitatingMassFieldParticlesDimension"
+            retval = []
+            for i in range(MAX_DIMENSION):
+                retval.append(self.thisptr.GravitatingMassFieldParticlesDimension[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(MAX_DIMENSION):
+                self.thisptr.GravitatingMassFieldParticlesDimension[i] = val[i]
+
+
+    property PotentialSum:
+        def __get__(self):
+            return self.thisptr.PotentialSum
+        def __set__(self, Eflt val):
+            self.thisptr.PotentialSum = val
+
+
+    property ProcessorNumber:
+        def __get__(self):
+            return self.thisptr.ProcessorNumber
+        def __set__(self, Eint val):
+            self.thisptr.ProcessorNumber = val
+
+
+    property TimestepsSinceCreation:
+        def __get__(self):
+            return self.thisptr.TimestepsSinceCreation
+        def __set__(self, Eint val):
+            self.thisptr.TimestepsSinceCreation = val
+
+
+
+
+# SKIPPED: '*Exterior)'
+# SKIPPED: '*BaryonField[MAX_NUMBER_OF_BARYON_FIELDS]'
+# SKIPPED: '*OldBaryonField[MAX_NUMBER_OF_BARYON_FIELDS]'
+# SKIPPED: '*InterpolatedField[MAX_NUMBER_OF_BARYON_FIELDS]'
+# SKIPPED: '*RandomForcingField[MAX_DIMENSION]'
+# SKIPPED: '*CellLeftEdge[MAX_DIMENSION]'
+# SKIPPED: '*CellWidth[MAX_DIMENSION]'
+# SKIPPED: '*divB'
+# SKIPPED: '*gradPhi[MAX_DIMENSION]'
+# SKIPPED: '*ParticlePosition[MAX_DIMENSION]'
+# SKIPPED: '*ParticleVelocity[MAX_DIMENSION]'
+# SKIPPED: '*ParticleAcceleration[MAX_DIMENSION+1]'
+# SKIPPED: '*ParticleMass'
+# SKIPPED: '*ParticleNumber'
+# SKIPPED: '*ParticleType'
+# SKIPPED: '*ParticleAttribute[MAX_NUMBER_OF_PARTICLE_ATTRIBUTES]'
+# SKIPPED: '*PotentialField'
+# SKIPPED: '*AccelerationField[MAX_DIMENSION]'
+# SKIPPED: '*GravitatingMassField'
+# SKIPPED: '*GravitatingMassFieldParticles'
+# SKIPPED: '*FlaggingField'
+# SKIPPED: '*MassFlaggingField'
+# SKIPPED: '*ParticleMassFlaggingField'

File src/libenzo/enzo_wrap/enzo_magic_numbers.pxi

 cdef extern from "macros_and_parameters.h" nogil:
+
+    enum: ENPY_PFLOAT
+    enum: ENPY_BFLOAT
+
     enum: COMMUNICATION_POST_RECEIVE
     enum: COMMUNICATION_SEND
     enum: COMMUNICATION_RECEIVE
     enum: TRUE
     enum: FALSE
 
+E_ENPY_PFLOAT = ENPY_PFLOAT
+E_ENPY_BFLOAT = ENPY_BFLOAT - 1
+
 E_COMMUNICATION_SEND_RECEIVE = COMMUNICATION_SEND_RECEIVE
 E_COMMUNICATION_POST_RECEIVE = COMMUNICATION_POST_RECEIVE
 E_COMMUNICATION_SEND = COMMUNICATION_SEND

File src/libenzo/enzo_wrap/enzo_module.pxd

 ctypedef int Eint32
 ctypedef int Eint64
 
+cimport numpy as np
+cimport c_numpy as cnp
+
 # All our incldues...
 
 cdef extern from "math.h":
     pass
 
 cdef extern from "Fluxes.h":
-    pass
+    ctypedef struct c_fluxes "fluxes":
+        pass
 
 cdef extern from "GridList.h":
     pass

File src/libenzo/enzo_wrap/enzo_routines.py

     #  XXX
 
     initial_dt = 0.1
+    print "Evolving"
     em.EvolveLevel(meta_data, level_array, 0, initial_dt, exterior)
 
+def EvolveLevel(meta_data, level_array, level, dt_upper, exterior):
+    pass
+
 def main(restart, fn):
     top_grid = em.HierarchyEntry()
     meta_data = em.TopGridData()
     em.AddLevel(level_array, top_grid, 0)
     #em.EvolveHierarchy(top_grid, meta_data, exterior, level_array, initial_dt)
     EvolveHierarchy(top_grid, meta_data, exterior, level_array, initial_dt)
+
+    return top_grid, meta_data, exterior, level_array, initial_dt

File src/libenzo/setup.py

 for line in open("../enzo/temp.show-flags"):
     if line.startswith("DEFINES"): break
 
-define_macros = []
+define_macros = [("SHARED_LIBRARY",None)]
 for opt in line.split("=", 1)[1].split():
     vd = opt[2:].split("=")
     if len(vd) == 1: vd.append(None)
 
 for i,j in define_macros:
     if i.startswith("CONFIG_BFLOAT_"):
-        bfloat = i[-1]
+        bfloat = i.split("_")[-1]
     if i.startswith("CONFIG_PFLOAT_"):
-        pfloat = i[-1]
+        pfloat = i.split("_")[-1]
 
-p = subprocess.Popen(["cython", "--cplus", "enzo_module.pyx"], cwd=os.getcwd() + "/enzo_wrap/")
+args = ["cython", "--cplus", "enzo_module.pyx"]
+print args
+p = subprocess.Popen(args, cwd=os.getcwd() + "/enzo_wrap/")
 p.communicate()
 if p.returncode:
     print p.returncode

File src/libenzo/test_run.py

 import enzo_wrap.enzo_routines as er
 
-er.main(True, 'DD0000/moving7_0000')
+vals = er.main(True, 'DD0000/moving7_0000')
+top_grid, meta_data, exterior, level_array, initial_dt = vals
+
+g=level_array[0].GridData
+g.get_baryon_field(0)

File src/libenzo/wrap_dot_h.py

             self.thisptr.%(var)s = val
 """
 
+loop_setter1 = """
+    property %(var)s:
+        def __get__(self):
+            print "Returning a copy of %(var)s"
+            retval = []
+            for i in range(%(size)s):
+                retval.append(self.thisptr.%(var)s[i])
+            return retval
+        def __set__(self, val):
+            cdef int i
+            for i in range(%(size)s):
+                self.thisptr.%(var)s[i] = val[i]
+"""
+
+loop_setter2 = """
+    property %(var)s:
+        def __get__(self):
+            print "Returning a copy of %(var)s"
+            retval = []
+            for i in range(%(size1)s):
+                retval.append([])
+                for j in range(%(size2)s):
+                    retval[-1].append(self.thisptr.%(var)s[i][j])
+            return retval
+        def __set__(self, val):
+            cdef int i, j
+            for i in range(%(size1)s):
+                for j in range(%(size2)s):
+                    self.thisptr.%(var)s[i][j] = val[i][j]
+"""
+
+
 for line in open(sys.argv[-1]):
     if not line.startswith(" "*8): continue
     if len(line.strip()) == 0: continue
-    if "[" in line:
-        skipped.append(line)
-        continue
     ls = line.split()
     if ls[0] not in known_types: continue
     for var in ls[1:]:
-        print prop_template % dict(var=var, ctype=ls[0])
+        if "*" in var:
+            skipped.append((1, ls[0], var, line))
+            continue
+        elif "(" in var or ")" in var: continue
+        var = var.strip()
+        if "[" in var:
+            if var.count("[") == 1:
+                i1, i2 = var.find("[") + 1, var.find("]")
+                size = var[i1:i2]
+                var = var[:i1-1]
+                print loop_setter1 % dict(var=var,
+                                          size=size)
+            elif var.count("[") == 2:
+                i1, i2 = var.find("[") + 1, var.find("]")
+                j1, j2 = var.rfind("[") + 1, var.rfind("]")
+                size1, size2 = var[i1:i2], var[j1:j2]
+                var = var[:i1-1]
+                print loop_setter2 % dict(var=var,
+                                          size1=size1,
+                                          size2=size2)
+            else: skipped.append((2, ls[0], var.strip(), line))
+        else:
+            print prop_template % dict(var=var, ctype=ls[0])
 
 print "\n" * 2
 
 for skip in skipped:
-    print "# SKIPPED: '%s'" % (skip.strip())
+    print "# SKIPPED: '%s'" % (skip[2])