<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; "><div>Erik,</div><div> </div><div>How does one "nest" loops over grids at different levels? In my way of doing things, it was something like...</div><div><br></div><div><br></div><div>l = level;</div><div><br></div><div><div> gblm1 = mgh[l-1];</div><div> while (gblm1 != NULL) {</div></div><div> Bbox coarse_bbox = gblm1->bbox;</div><div><br></div><div> gbl = mgh[l];</div><div> while (gbl != NULL) { </div><div> Bbox fine_bbox = gbl->bbox;</div><div><br></div><div> // On the regions for which the finer grid overlaps the coarse grid,</div><div> // do some operations...</div><div> </div><div> gbl = gbl->next;</div><div> }</div><div><br></div><div><div> gblm1 = gblm1->next;</div><div>}</div></div><div><br></div><div><br></div><div>I have an idea of something to try, below, but I'm worried that I'm abusing the SWITCH_TO_LEVEL macro…</div><div><br></div><div><br></div><div>//reflevel = finer grid…</div><div><div> SWITCH_TO_LEVEL( cctkGH, reflevel - 1 ) {</div></div><div> BEGIN_MAP_LOOP (cctkGH, CCTK_GF) {</div><div><div> BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {</div><div> DECLARE_CCTK_ARGUMENTS;</div></div><div><br></div><div><div> </div><div> SWITCH_TO_LEVEL( cctkGH, reflevel ) {</div><div><div> BEGIN_MAP_LOOP (cctkGH, CCTK_GF) {</div><div><div> BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {</div><div> DECLARE_CCTK_ARGUMENTS;</div></div></div><div><br></div><div> // where fine grid bbox overlaps coarse bbox….</div><div> // do operations on coarse grid…</div><div> SWITCH_TO_LEVEL( cctkGH, reflevel - 1 ) { </div><div> // do operations…, e.g. call "L" operator</div><div> } END_SWITCH_TO_LEVEL; </div><div><br></div><div><div> } END_LOCAL_COMPONENT_LOOP;</div><div> } END_MAP_LOOP;</div></div><div> } END_SWITCH_TO_LEVEL; </div><div><br></div><div><br></div><div> } END_LOCAL_COMPONENT_LOOP;</div><div> } END_MAP_LOOP;</div><div> </div><div> </div><div><div>} END_SWITCH_TO_LEVEL; </div></div></div><div><br></div><div><br></div><div><br></div><div>Or?</div><div><br></div></body></html>