Erik,
How does one "nest" loops over grids at different levels? In my way of doing things, it was something like...
l = level;
gblm1 = mgh[l-1]; while (gblm1 != NULL) { Bbox coarse_bbox = gblm1->bbox;
gbl = mgh[l]; while (gbl != NULL) { Bbox fine_bbox = gbl->bbox;
// On the regions for which the finer grid overlaps the coarse grid, // do some operations...
gbl = gbl->next; }
gblm1 = gblm1->next; }
I have an idea of something to try, below, but I'm worried that I'm abusing the SWITCH_TO_LEVEL macro…
//reflevel = finer grid… SWITCH_TO_LEVEL( cctkGH, reflevel - 1 ) { BEGIN_MAP_LOOP (cctkGH, CCTK_GF) { BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) { DECLARE_CCTK_ARGUMENTS;
SWITCH_TO_LEVEL( cctkGH, reflevel ) { BEGIN_MAP_LOOP (cctkGH, CCTK_GF) { BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) { DECLARE_CCTK_ARGUMENTS;
// where fine grid bbox overlaps coarse bbox…. // do operations on coarse grid… SWITCH_TO_LEVEL( cctkGH, reflevel - 1 ) { // do operations…, e.g. call "L" operator } END_SWITCH_TO_LEVEL;
} END_LOCAL_COMPONENT_LOOP; } END_MAP_LOOP; } END_SWITCH_TO_LEVEL;
} END_LOCAL_COMPONENT_LOOP; } END_MAP_LOOP;
} END_SWITCH_TO_LEVEL;
Or?