[Yt-svn] yt-commit r646 - trunk/yt/lagos/hop

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Jul 3 16:39:30 PDT 2008


Author: mturk
Date: Thu Jul  3 16:39:29 2008
New Revision: 646
URL: http://yt.spacepope.org/changeset/646

Log:
Got rid of the ID requirement for coping in and out of the HOP code.  It's not
necessary, because the ordering of the particles is stored, and so the IDs are
available both inside and outside.



Modified:
   trunk/yt/lagos/hop/EnzoHop.c
   trunk/yt/lagos/hop/HopOutput.py
   trunk/yt/lagos/hop/hop_hop.c
   trunk/yt/lagos/hop/hop_regroup.c
   trunk/yt/lagos/hop/hop_slice.c
   trunk/yt/lagos/hop/kd.h
   trunk/yt/lagos/hop/slice.h

Modified: trunk/yt/lagos/hop/EnzoHop.c
==============================================================================
--- trunk/yt/lagos/hop/EnzoHop.c	(original)
+++ trunk/yt/lagos/hop/EnzoHop.c	Thu Jul  3 16:39:29 2008
@@ -42,18 +42,18 @@
 Py_EnzoHop(PyObject *obj, PyObject *args)
 {
     PyObject    *oxpos, *oypos, *ozpos,
-                *omass, *oID;
+                *omass;
 
     PyArrayObject    *xpos, *ypos, *zpos,
-                     *mass, *ID;
-    xpos=ypos=zpos=mass=ID=NULL;
+                     *mass;
+    xpos=ypos=zpos=mass=NULL;
     npy_float64 totalmass = 0;
     float thresh = 160.0;
 
     int i;
 
-    if (!PyArg_ParseTuple(args, "OOOOO|f",
-        &oxpos, &oypos, &ozpos, &omass, &oID, &thresh))
+    if (!PyArg_ParseTuple(args, "OOOO|f",
+        &oxpos, &oypos, &ozpos, &omass, &thresh))
     return PyErr_Format(_HOPerror,
             "EnzoHop: Invalid parameters.");
 
@@ -96,15 +96,6 @@
     goto _fail;
     }
 
-    ID    = (PyArrayObject *) PyArray_FromAny(oID,
-                    PyArray_DescrFromType(NPY_INT64), 1, 1,
-                    NPY_INOUT_ARRAY | NPY_UPDATEIFCOPY, NULL);
-    if((!ID)||(PyArray_SIZE(ID) != num_particles)) {
-    PyErr_Format(_HOPerror,
-             "EnzoHop: xpos and ID must be the same length.");
-    goto _fail;
-    }
-
     for(i = 0; i < num_particles; i++)
         totalmass+=*(npy_float64*)PyArray_GETPTR1(mass,i);
 
@@ -127,7 +118,6 @@
 	  kd->p[i].r[1] = (float)*(npy_float64*) PyArray_GETPTR1(ypos, i);
 	  kd->p[i].r[2] = (float)*(npy_float64*) PyArray_GETPTR1(zpos, i);
 	  kd->p[i].fMass = (float)(*(npy_float64*) PyArray_GETPTR1(mass, i)/totalmass);
-	  kd->p[i].iID = (int)*(npy_int64*) PyArray_GETPTR1(ID,i); /* S. Skory */
 	}
 
     HC my_comm;
@@ -176,7 +166,6 @@
     Py_DECREF(ypos);
     Py_DECREF(zpos);
     Py_DECREF(mass);
-    Py_DECREF(ID);
 
     /* We don't need this, as it's done in kdFinish
     if(kd->p!=NULL)free(kd->p);
@@ -189,7 +178,6 @@
     Py_XDECREF(ypos);
     Py_XDECREF(zpos);
     Py_XDECREF(mass);
-    Py_XDECREF(ID);
 
     if(kd->p!=NULL)free(kd->p);
 

Modified: trunk/yt/lagos/hop/HopOutput.py
==============================================================================
--- trunk/yt/lagos/hop/HopOutput.py	(original)
+++ trunk/yt/lagos/hop/HopOutput.py	Thu Jul  3 16:39:29 2008
@@ -53,8 +53,6 @@
         for field in ["particle_position_%s" % ax for ax in 'xyz'] + \
                      ["ParticleMassMsun"]:
             self.particle_fields[field] = self.data_source[field][ii]
-        self.particle_fields["particle_index"] = \
-            self.data_source["particle_index"][ii].astype('int64')
 
     def __run_hop(self):
         self.densities, self.tags = \
@@ -62,7 +60,6 @@
                    self.particle_fields["particle_position_y"],
                    self.particle_fields["particle_position_z"],
                    self.particle_fields["ParticleMassMsun"],
-                   self.particle_fields["particle_index"],
                    self.threshold)
         self.particle_fields["densities"] = self.densities
         self.particle_fields["tags"] = self.tags

Modified: trunk/yt/lagos/hop/hop_hop.c
==============================================================================
--- trunk/yt/lagos/hop/hop_hop.c	(original)
+++ trunk/yt/lagos/hop/hop_hop.c	Thu Jul  3 16:39:29 2008
@@ -519,9 +519,9 @@
     g->npart = s->numlist = s->numpart = smx->kd->nActive;
     g->ngroups = smx->nGroups;
     s->ntag = ivector(1,s->numlist);
-    s->ID = ivector(1,s->numlist);
+    //s->ID = ivector(1,s->numlist);
     for (j=0;j<smx->kd->nActive;j++) {
-      s->ID[1+j] = smx->kd->p[j].iID; /* S Skory's addition */
+      //s->ID[1+j] = smx->kd->p[j].iID; /* S Skory's addition */
       if (smx->kd->p[j].fDensity < densthres) s->ntag[j+1] = -1;
       else s->ntag[j+1] = smx->kd->p[j].iHop;
 

Modified: trunk/yt/lagos/hop/hop_regroup.c
==============================================================================
--- trunk/yt/lagos/hop/hop_regroup.c	(original)
+++ trunk/yt/lagos/hop/hop_regroup.c	Thu Jul  3 16:39:29 2008
@@ -289,9 +289,9 @@
     s->numpart = g->npart;
     s->numlist = g->npart;
     s->ntag = ivector(1,s->numlist);
-    s->ID = ivector(1,s->numlist);
+    //s->ID = ivector(1,s->numlist);
     fread(s->ntag+1, sizeof(int), s->numlist, f); /* Read in all the tags */
-    fread(s->ID+1, sizeof(int), s->numlist,f); /* Read in the real particle IDs. S Skory */
+    //fread(s->ID+1, sizeof(int), s->numlist,f); /* Read in the real particle IDs. S Skory */
     fclose(f);
 
     return;
@@ -585,7 +585,7 @@
     	s->numpart, gl->ngroups);
     fwrite(&(gl->ngroups),sizeof(int),1,f);
     fwrite(s->ntag+1,sizeof(int),s->numlist,f);
-    fwrite(s->ID+1,sizeof(int),s->numlist,f); /* S Skory */
+    //fwrite(s->ID+1,sizeof(int),s->numlist,f); /* S Skory */
     fclose(f);
 
     return;

Modified: trunk/yt/lagos/hop/hop_slice.c
==============================================================================
--- trunk/yt/lagos/hop/hop_slice.c	(original)
+++ trunk/yt/lagos/hop/hop_slice.c	Thu Jul  3 16:39:29 2008
@@ -20,7 +20,7 @@
     s->pid = NULL; s->offset = 0;
     s->px = s->py = s->pz = s->vx = s->vy = s->vz = NULL;
     s->ntag = NULL;
-    s->ID = NULL; /* S Skory */
+    //s->ID = NULL; /* S Skory */
     s->numpart = s->numlist = 0;
     return s;
 }
@@ -31,8 +31,8 @@
     if (s->ntag!=NULL) {
       free_ivector(s->ntag, 1, s->numlist);
       s->ntag=NULL;
-      free_ivector(s->ID, 1, s->numlist); /* S Skory */
-     s->ID=NULL;
+      //free_ivector(s->ID, 1, s->numlist); /* S Skory */
+     //s->ID=NULL;
     }
     return;
 }

Modified: trunk/yt/lagos/hop/kd.h
==============================================================================
--- trunk/yt/lagos/hop/kd.h	(original)
+++ trunk/yt/lagos/hop/kd.h	Thu Jul  3 16:39:29 2008
@@ -37,7 +37,7 @@
 	float r[3];
 	int iOrder;
 	float fDensity;
-	int iID;  /* the real ID of the particle S. Skory */
+	// int iID;  /* the real ID of the particle S. Skory */
 	int iHop;	/* DJE: The number of the highest-density neighbor;
 				Later, the group number. */
 #ifdef DIFFERENT_MASSES

Modified: trunk/yt/lagos/hop/slice.h
==============================================================================
--- trunk/yt/lagos/hop/slice.h	(original)
+++ trunk/yt/lagos/hop/slice.h	Thu Jul  3 16:39:29 2008
@@ -65,7 +65,7 @@
 
 	/* And here's the group tag information */
 	int *ntag;	/* Only stored for the numlist above */
-        int *ID;       /* The real, true ID of the particle. S Skory */
+        //int *ID;       /* The real, true ID of the particle. S Skory */
 	int numgroups;	/* The number of groups read out of the tag file */
 } Slice;	/* Type Slice is defined */
 



More information about the yt-svn mailing list