[Users] Howto? Outer loop over coarse maps, inner loop over fine maps
Scott Hawley
scott.hawley at belmont.edu
Sun Apr 15 15:47:31 CDT 2012
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20120415/9807878f/attachment.html
More information about the Users
mailing list