pro export_amr_boxes_to_partiview, only_current=ocurrent @TOOLS/common_blocks.inc filename = DIALOG_PICKFILE(FILTER="*.amrbox", PATH=data_dir, $ FILE=default_filename, DIALOG_PARENT=BASE2, $ TITLE="Select partiview AMRboxes Export Filename", $ GET_PATH=data_dir, /NOCONFIRM, /WRITE, $ /OVERWRITE_PROMPT) if filename eq '' then return if N_elements(ocurrent) eq 0 then begin ocurrent = 0 these_grids = all_grid_info endif else these_grids=grid_info h = histogram(these_grids.timestep, reverse_indices=r) ntimesteps = N_elements(uniq(sort(h))) openw, lun, filename, /get_lun printf, lun, 'AMRboxes ',strcompress(string(ntimesteps)), ' timesteps' icts = 0L for i=0, Ntimesteps-1 do begin if h[i] gt 1 then begin ngrids = r[i+1]-r[i] ; printf, lun, 'timestep ', these_grids[r[r[i]]].timestep,' ', ; ngrids, ' grids' ts = these_grids[r[r[i]]].time printf, lun, 'timestep ', strcompress(string(icts++)),' ', strcompress(string(ngrids)), $ ' grids # time:', ts cg = these_grids[r[r[i]]:r[(r[i+1]-1)]] print, cg.level lh = histogram(cg.level, reverse_indices=s) Nlevels = N_elements(lh) print, 'nlevels:', Nlevels for k=0,Nlevels-1 do begin ngtl = s[k+1]-s[k] print, '# grids:', ngtl printf, lun, 'level', strcompress(string(cg[s[s[k]]].level)) for j=0, ngtl-1 do begin ii = s[s[k]+j] printf, lun, strcompress(STRING([cg[ii].left_edge[*],$ cg[ii].right_edge[*]], FORMAT='(7g)')+' #'+string(ii)) endfor endfor endif endfor close, lun free_lun, lun return end