[Yt-svn] yt: Fixed ART IO. Forgot that we read in ioctch.
hg at spacepope.org
hg at spacepope.org
Thu Oct 21 15:24:36 PDT 2010
hg Repository: yt
details: yt/rev/080643ec3066
changeset: 3458:080643ec3066
user: Christopher Erick Moody <cemoody at ucsc.edu>
date:
Thu Oct 21 15:24:29 2010 -0700
description:
Fixed ART IO. Forgot that we read in ioctch.
diffstat:
yt/utilities/_amr_utils/fortran_reader.pyx | 12 +-
yt/utilities/amr_utils.c | 179 ++++++++++++----------------
2 files changed, 83 insertions(+), 108 deletions(-)
diffs (truncated from 464 to 300 lines):
diff -r 8f25a0593545 -r 080643ec3066 yt/utilities/_amr_utils/fortran_reader.pyx
--- a/yt/utilities/_amr_utils/fortran_reader.pyx Thu Oct 21 14:52:55 2010 -0700
+++ b/yt/utilities/_amr_utils/fortran_reader.pyx Thu Oct 21 15:24:29 2010 -0700
@@ -190,12 +190,12 @@
# nhydro_vars is the number of columns- 3 (adjusting for vars)
# this is normally 10=(8+2chem species)
cdef FILE *f = fopen(fn, "rb")
- cdef long offset
+ cdef long offset,ioctch
cdef long nocts,nc #number of octs/children in previous levels
cdef int j,lev
#parameters
- cdef int record_size = 2+1+nhydro_vars+3
+ cdef int record_size = 2+1+1+nhydro_vars+2
#record values
cdef int pada,padb
@@ -228,7 +228,8 @@
offset += 4*15*nocts
# after the oct section is the child section.
# there are 2 pads, 1 integer child ID (idc)
- # then #nhydro_vars of floats + 3 vars
+ # 1 integer ioctch
+ # then #nhydro_vars of floats + 2 vars
offset += + 4*(record_size)*nc
#now we read in the first idc, then make our
@@ -245,6 +246,7 @@
while j<100:
fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
+ fread(&ioctch, sizeof(int), 1, f); FIX_LONG(ioctch)
if grid_idc != idc_readin:
# in the next iteration we'll read the previous record
# so rewind one further record
@@ -256,10 +258,10 @@
fread(&temp, sizeof(float), 1, f);
FIX_FLOAT(temp)
hvars[j] = temp
- for j in range(3):
+ for j in range(2):
fread(&temp, sizeof(float), 1, f);
FIX_FLOAT(temp)
- var[j] = temp
+ var[j+1] = temp
fclose(f)
diff -r 8f25a0593545 -r 080643ec3066 yt/utilities/amr_utils.c
--- a/yt/utilities/amr_utils.c Thu Oct 21 14:52:55 2010 -0700
+++ b/yt/utilities/amr_utils.c Thu Oct 21 15:24:29 2010 -0700
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13 on Thu Oct 21 14:40:23 2010 */
+/* Generated by Cython 0.13 on Thu Oct 21 15:22:17 2010 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -1376,7 +1376,6 @@
static char __pyx_k__y_is[] = "y_is";
static char __pyx_k__z_is[] = "z_is";
static char __pyx_k__alpha[] = "alpha";
-static char __pyx_k__blah1[] = "blah1";
static char __pyx_k__close[] = "close";
static char __pyx_k__coord[] = "coord";
static char __pyx_k__descr[] = "descr";
@@ -1583,7 +1582,6 @@
static PyObject *__pyx_n_s__ax_vec;
static PyObject *__pyx_n_s__ay_vec;
static PyObject *__pyx_n_s__base;
-static PyObject *__pyx_n_s__blah1;
static PyObject *__pyx_n_s__blue;
static PyObject *__pyx_n_s__bounds;
static PyObject *__pyx_n_s__box_center;
@@ -24626,6 +24624,7 @@
PyArrayObject *__pyx_v_var = 0;
FILE *__pyx_v_f;
long __pyx_v_offset;
+ long __pyx_v_ioctch;
long __pyx_v_nocts;
long __pyx_v_nc;
int __pyx_v_j;
@@ -24796,7 +24795,7 @@
* # nhydro_vars is the number of columns- 3 (adjusting for vars)
* # this is normally 10=(8+2chem species)
* cdef FILE *f = fopen(fn, "rb") # <<<<<<<<<<<<<<
- * cdef long offset
+ * cdef long offset,ioctch
* cdef long nocts,nc #number of octs/children in previous levels
*/
__pyx_v_f = fopen(__pyx_v_fn, __pyx_k__rb);
@@ -24804,11 +24803,11 @@
/* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":198
*
* #parameters
- * cdef int record_size = 2+1+nhydro_vars+3 # <<<<<<<<<<<<<<
+ * cdef int record_size = 2+1+1+nhydro_vars+2 # <<<<<<<<<<<<<<
*
* #record values
*/
- __pyx_v_record_size = ((3 + __pyx_v_nhydro_vars) + 3);
+ __pyx_v_record_size = ((4 + __pyx_v_nhydro_vars) + 2);
/* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":204
* cdef int idc,idc_readin
@@ -24926,16 +24925,16 @@
*/
__pyx_v_offset += (60 * __pyx_v_nocts);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":232
- * # there are 2 pads, 1 integer child ID (idc)
- * # then #nhydro_vars of floats + 3 vars
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":233
+ * # 1 integer ioctch
+ * # then #nhydro_vars of floats + 2 vars
* offset += + 4*(record_size)*nc # <<<<<<<<<<<<<<
*
* #now we read in the first idc, then make our
*/
__pyx_v_offset += ((4 * __pyx_v_record_size) * __pyx_v_nc);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":237
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":238
* #seek guess
* #print 'entry',offset
* fseek(f, offset, SEEK_SET) # <<<<<<<<<<<<<<
@@ -24944,7 +24943,7 @@
*/
fseek(__pyx_v_f, __pyx_v_offset, SEEK_SET);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":238
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":239
* #print 'entry',offset
* fseek(f, offset, SEEK_SET)
* fread(&pada, sizeof(int), 1, f); FIX_LONG(pada) # <<<<<<<<<<<<<<
@@ -24954,7 +24953,7 @@
fread((&__pyx_v_pada), (sizeof(int)), 1, __pyx_v_f);
FIX_LONG(__pyx_v_pada);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":239
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":240
* fseek(f, offset, SEEK_SET)
* fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin) # <<<<<<<<<<<<<<
@@ -24964,7 +24963,7 @@
fread((&__pyx_v_idc_readin), (sizeof(int)), 1, __pyx_v_f);
FIX_LONG(__pyx_v_idc_readin);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":241
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":242
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
*
* offset += (grid_idc - idc_readin)*record_size*4 # <<<<<<<<<<<<<<
@@ -24973,7 +24972,7 @@
*/
__pyx_v_offset += (((__pyx_v_grid_idc - __pyx_v_idc_readin) * __pyx_v_record_size) * 4);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":242
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":243
*
* offset += (grid_idc - idc_readin)*record_size*4
* fseek(f, offset, SEEK_SET) # <<<<<<<<<<<<<<
@@ -24982,49 +24981,59 @@
*/
fseek(__pyx_v_f, __pyx_v_offset, SEEK_SET);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":243
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":244
* offset += (grid_idc - idc_readin)*record_size*4
* fseek(f, offset, SEEK_SET)
* j=0 # <<<<<<<<<<<<<<
*
- * while j<10000:
+ * while j<100:
*/
__pyx_v_j = 0;
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":245
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":246
* j=0
*
- * while j<10000: # <<<<<<<<<<<<<<
+ * while j<100: # <<<<<<<<<<<<<<
* fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
*/
while (1) {
- __pyx_t_6 = (__pyx_v_j < 10000);
+ __pyx_t_6 = (__pyx_v_j < 100);
if (!__pyx_t_6) break;
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":246
- *
- * while j<10000:
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":247
+ *
+ * while j<100:
* fread(&pada, sizeof(int), 1, f); FIX_LONG(pada) # <<<<<<<<<<<<<<
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
- * if grid_idc != idc_readin:
+ * fread(&ioctch, sizeof(int), 1, f); FIX_LONG(ioctch)
*/
fread((&__pyx_v_pada), (sizeof(int)), 1, __pyx_v_f);
FIX_LONG(__pyx_v_pada);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":247
- * while j<10000:
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":248
+ * while j<100:
* fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin) # <<<<<<<<<<<<<<
+ * fread(&ioctch, sizeof(int), 1, f); FIX_LONG(ioctch)
+ * if grid_idc != idc_readin:
+ */
+ fread((&__pyx_v_idc_readin), (sizeof(int)), 1, __pyx_v_f);
+ FIX_LONG(__pyx_v_idc_readin);
+
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":249
+ * fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
+ * fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
+ * fread(&ioctch, sizeof(int), 1, f); FIX_LONG(ioctch) # <<<<<<<<<<<<<<
* if grid_idc != idc_readin:
* # in the next iteration we'll read the previous record
*/
- fread((&__pyx_v_idc_readin), (sizeof(int)), 1, __pyx_v_f);
- FIX_LONG(__pyx_v_idc_readin);
-
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":248
- * fread(&pada, sizeof(int), 1, f); FIX_LONG(pada)
+ fread((&__pyx_v_ioctch), (sizeof(int)), 1, __pyx_v_f);
+ FIX_LONG(__pyx_v_ioctch);
+
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":250
* fread(&idc_readin, sizeof(int), 1, f); FIX_LONG(idc_readin)
+ * fread(&ioctch, sizeof(int), 1, f); FIX_LONG(ioctch)
* if grid_idc != idc_readin: # <<<<<<<<<<<<<<
* # in the next iteration we'll read the previous record
* # so rewind one further record
@@ -25032,7 +25041,7 @@
__pyx_t_6 = (__pyx_v_grid_idc != __pyx_v_idc_readin);
if (__pyx_t_6) {
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":251
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":253
* # in the next iteration we'll read the previous record
* # so rewind one further record
* j+=1 # <<<<<<<<<<<<<<
@@ -25041,7 +25050,7 @@
*/
__pyx_v_j += 1;
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":252
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":254
* # so rewind one further record
* j+=1
* offset = offset - record_size*4 # <<<<<<<<<<<<<<
@@ -25050,7 +25059,7 @@
*/
__pyx_v_offset = (__pyx_v_offset - (__pyx_v_record_size * 4));
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":253
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":255
* j+=1
* offset = offset - record_size*4
* fseek(f, offset, SEEK_SET) # <<<<<<<<<<<<<<
@@ -25062,7 +25071,7 @@
}
/*else*/ {
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":254
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":256
* offset = offset - record_size*4
* fseek(f, offset, SEEK_SET)
* else: break # <<<<<<<<<<<<<<
@@ -25075,7 +25084,7 @@
}
__pyx_L11_break:;
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":255
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":257
* fseek(f, offset, SEEK_SET)
* else: break
* for j in range(nhydro_vars): # <<<<<<<<<<<<<<
@@ -25086,7 +25095,7 @@
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_1; __pyx_t_4+=1) {
__pyx_v_j = __pyx_t_4;
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":256
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":258
* else: break
* for j in range(nhydro_vars):
* fread(&temp, sizeof(float), 1, f); # <<<<<<<<<<<<<<
@@ -25095,20 +25104,20 @@
*/
fread((&__pyx_v_temp), (sizeof(float)), 1, __pyx_v_f);
- /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":257
+ /* "/sdata/cemoody/code/yt/src/yt-trunk-svn/yt/utilities/_amr_utils/fortran_reader.pyx":259
* for j in range(nhydro_vars):
* fread(&temp, sizeof(float), 1, f);
More information about the yt-svn
mailing list