[Users] Howto? Outer loop over coarse maps, inner loop over fine maps

Erik Schnetter eschnetter at perimeterinstitute.ca
Sun Apr 15 17:54:42 CDT 2012


Scott

In Carpet, fine boxes don't necessarily overlap a particular coarse
box. Only the set of fine boxes overlaps (is contained in) the set of
coarse boxes.

Also, the meaning of cctk_bbox and what Carpet calls a bbox are
distinct. cctk_bbox contains booleans indicating whether the current
regions contains a piece of the boundary (or whether it is in the
interior of the grid), while Carpet's bboxes contain (integer)
coordinates describing the rectangles (but in 3D) that make up the
refined regions.

I don't quite understand what you are trying to do. Should we Skype tomorrow?

-erik

On Sun, Apr 15, 2012 at 4:47 PM, Scott Hawley <scott.hawley at belmont.edu> wrote:
> 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?
>



-- 
Erik Schnetter <eschnetter at perimeterinstitute.ca>
http://www.perimeterinstitute.ca/personal/eschnetter/
AIM: eschnett247, Skype: eschnett, Google Talk: schnetter at gmail.com


More information about the Users mailing list