Commits

Daniel Reynolds  committed 81e6307

Updated SolveDengo.C routine to include more about the Dengo solver interface.

  • Participants
  • Parent commits 32dc498

Comments (0)

Files changed (1)

File src/enzo/Grid_SolveDengo.C

   }
 
   //--------------
-  // call dengo
-  int ierr = 0;
+  // call dengo in strips of spatial length 1024
+  int icur=0, ierr=0, strip_len;
+  float *strip = (float *) malloc(1024 * DengoData.NumberOfFields * sizeof(float));
+  for (icur=0; icur<size; icur+=1024) {
+
+    // determine strip length
+    strip_len = (1024 < size-icur) ? 1024 : size-icur;
+
+    // fill strip in order specified by Dengo's "Field" list
+    for (ifield=0; ifield<DengoData.NumberOfFields; ifield++) {
+      for (i=0; i<strip_len; i++) 
+	strip[i*DengoData.NumberOfFields + ifield] = BaryonField[DengoData.Field[ifield]][i];
+    }
+
+    // call dengo on this strip
+    
+
+    // unpack Dengo solution back into BaryonField arrays
+    for (ifield=0; ifield<DengoData.NumberOfFields; ifield++) {
+      for (i=0; i<strip_len; i++) 
+	BaryonField[DengoData.Field[ifield]][i] = strip[i*DengoData.NumberOfFields + ifield];
+    }
+
+  }
+
+  // free strip memory
+  free(strip);
   
   
   //--------------
   for (i=0; i<size; i++)  BaryonField[IENum][i] /= rscale;
   
   //    remaining fields (all density-like)
-  int ifield;
   rscale = DensityUnits;
   for (ifield=1; ifield<DengoData.NumberOfFields; ifield++) {
     for (i=0; i<size; i++)