PRO check_parents, grid_info gin = N_elements(grid_info) FOR i=0L,gin-1 DO BEGIN cg = grid_info[i] IF (cg.parent GE 1) THEN BEGIN pin = where(grid_info.parent EQ cg.num, count) if count gt 0 then begin pg = cg IF (vec_GT_vec(pg.left_edge, cg.left_edge) OR vec_LT_vec(pg.right_edge, cg.right_edge)) THEN BEGIN print, i, 'trouble' ; break ENDIF for j=0L, count-1 do begin cc = grid_info[pin[j]] if vec_gt_vec(cc.parent_e_index, (pg.end_index-pg.start_index)) then begin print, 'parent end index in grid ', cc.num, ' is larger than parents:', pg.num, ' dimension', cc.parent_e_index, pg.dim endif endfor ENDIF endif ENDFOR RETURN END pro show_hierarchy_information, grid_info if N_elements(grid_info) eq 1 then return nlb = histogram(grid_info.level, reverse_indices=r) nl = N_elements(nlb) total_cell_count = 0L print, nlb for i=0,nl-1 do begin ind = r[r[i]:r[i+1]-1] ncells = LONG(grid_info[ind].dim[0])* $ grid_info[ind].dim[1]*grid_info[ind].dim[2] lcells = TOTAL(ncells) total_cell_count += lcells help_s = STRING(i, FORMAT = '(i2)') print, string(float(nlb[i]),FORMAT = '(I9)')+' grids on level '+help_s,$ ' with ', STRING(lcells,FORMAT = '(i9)'), $ ' (',STRING(lcells, FORMAT = '(E8.2)'),')', ' cells', $ ' = ', string(float(lcells)^(1./3.), FORMAT = '(G6.4)'),'^3' endfor print, ' --------------------------' print, 'total computational cells:', $ STRING(total_cell_count, FORMAT = '(i11)'),$ ' (',STRING(total_cell_count, FORMAT = '(E8.2)'),') =', $ float(total_cell_count)^(1./3.),'^3' print, N_ELEMENTS(UNIQ(grid_info.parent)-1), ' parent grids' return end function order_grids, grid_info ; order grids from low to high resolution: ; and insert levels numbers ngrids = N_ELEMENTS(grid_info) IF (ngrids lt 1) THEN BEGIN print, 'order_grids: no grid information in grid_info:',$ grid_info RETURN, grid_info ENDIF if ngrids eq 1 then return, grid_info ; nothing to do for sure num_of_levels = Max(grid_info.level) print, 'There are ', STRING(N_ELEMENTS(grid_info),FORMAT = '(i8)'), $ ' grids on ', String(num_of_levels+1, FORMAT = '(i3)'), ' levels!' if num_of_levels eq 0 then return, grid_info ; nothing to do for sure ; do order grid_info = grid_info[sort(grid_info.level)] RETURN, grid_info END