pro zero_solution_under_subgrid, u_g, all, ZERO=zero, all_grid_info = a_g if N_elements(a_g) eq 0 then a_g = u_g zero = (N_ELEMENTS(zero) gt 0) ? zero : 0. ; 0. is the default value N_grids = N_elements(u_g) ri = INTARR(3) FOR i=0L,N_grids-1 DO BEGIN ci = where(a_g.parent EQ u_g[i].num, count) ; list of indeces of grids that have me as parent IF (count GT 0) THEN BEGIN FOR jj=0L,N_ELEMENTS(ci)-1 DO BEGIN ; zeroing all data values where childs are: cc = ci[jj] li = (((a_g[cc].parent_s_index[*]) - all[i].li[*]) > 0 ) < (all[i].dims -1) for j=0L,N_elements(li)-1 do $ ri[j] = ((min([a_g[cc].parent_e_index[j], all[i].ri[j]])-all[i].li[j]) $ < (all[i].dims[j]-1)) > li[j] ; print, 'zsus:', ri-li+1 for j=0,all[i].N_Dfields-1 do begin if all[i].np_total gt 0 then begin ds = size(*all[i].data[j]) if ds[0] lt 1 then break if N_elements(*all[i].data[j]) eq product(all[i].dims > 1) then begin (*all[i].data[j])[li[0]:ri[0], li[1]:ri[1], li[2]:ri[2]] = zero ; print, li, ri endif else begin print, 'zero_solution_under_subgrid: somethings wrong', a_g[cc].num, i, jj, j, $ all[i].data_fields[j], 'Ne:', N_elements(all[i].data[j]), product(all[i].dims),(all[i].dims) ; breaki endelse endif ENDFOR ENDFOR END ENDFOR RETURN END