diff options
author | Roland Haas <roland.haas@physics.gatech.edu> | 2012-11-09 09:39:42 -0800 |
---|---|---|
committer | Roland Haas <rhaas@tapir.caltech.edu> | 2013-02-11 13:13:13 -0800 |
commit | 4e166b68d40ec9ced2acdbebaccace667f6f6eeb (patch) | |
tree | 5f2e3e457dbf0bd3b32a5a3e0414c91e3cfc64bb /Carpet/CarpetEvolutionMask/src | |
parent | cb1399a1072460b74e75b7d5c54389fbd7dffbb6 (diff) |
CarpetEvolutionMask: compute a mask indicating where buffers are
this is s first implementatoion of this functionality. Eventually I want
to extend it to label buffer points by the last MoL substep at which the
grid point needs to have a RHS computed. Zero will mean "all the time"
large numbers will mean "never".
Diffstat (limited to 'Carpet/CarpetEvolutionMask/src')
-rw-r--r-- | Carpet/CarpetEvolutionMask/src/evolution_mask.cc | 56 | ||||
-rw-r--r-- | Carpet/CarpetEvolutionMask/src/evolution_mask_init.c | 3 |
2 files changed, 59 insertions, 0 deletions
diff --git a/Carpet/CarpetEvolutionMask/src/evolution_mask.cc b/Carpet/CarpetEvolutionMask/src/evolution_mask.cc index 85670f700..5f39fac42 100644 --- a/Carpet/CarpetEvolutionMask/src/evolution_mask.cc +++ b/Carpet/CarpetEvolutionMask/src/evolution_mask.cc @@ -104,6 +104,11 @@ namespace CarpetEvolutionMask { ibset antishrunk (antirefined.expand(antishrinkby). expanded_for(coarsebase)); + // TODO: look up how this is done in regrid.cc + ibset buffers + (antirefined.expand(antishrinkby) & base); + buffers -= antirefined; + buffers &= base; // cout << "antishrunk1: " << antishrunk << endl; @@ -212,6 +217,57 @@ namespace CarpetEvolutionMask { enter_level_mode (cctkGH, oldreflevel); enter_singlemap_mode (cctkGH, oldmap, oldgrouptype); } + + // Indicate which points are in the buffer region on current level + if (provide_buffer_mask) { + BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) { + + DECLARE_CCTK_ARGUMENTS; + + ibbox const & ext + = dd.light_boxes.at(mglevel).at(reflevel).at(component).exterior; + + for (ibset::const_iterator bi = buffers.begin(); + bi != buffers.end(); + ++bi) + { + + ibbox const & box = (*bi) & ext; + if (! box.empty()) { + + assert (all ((box.lower() - ext.lower() ) >= 0)); + assert (all ((box.upper() - ext.lower() + ext.stride()) >= 0)); + assert (all ((box.lower() - ext.lower() ) % ext.stride() == 0)); + assert (all ((box.upper() - ext.lower() + ext.stride()) % ext.stride() == 0)); + ivect const imin = (box.lower() - ext.lower() ) / ext.stride(); + ivect const imax = (box.upper() - ext.lower() + ext.stride()) / ext.stride(); + assert (all (izero <= imin)); + assert (box.empty() || all (imin <= imax)); + assert (all (imax <= ivect::ref(cctk_lsh))); + + if (verbose) { + ostringstream buf; + buf << "Setting buffer region on level " << reflevel << ": " << imin << ":" << imax-ione; + CCTK_INFO (buf.str().c_str()); + } + + // Set mask in the buffer region to 1 + assert (dim == 3); + for (int k=imin[2]; k<imax[2]; ++k) { + for (int j=imin[1]; j<imax[1]; ++j) { + for (int i=imin[0]; i<imax[0]; ++i) { + int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); + buffer_mask[ind] = 1; + } + } + } + + } // if box not empty + + } // for box + + } END_LOCAL_COMPONENT_LOOP; + } } // if reflevel>0 } diff --git a/Carpet/CarpetEvolutionMask/src/evolution_mask_init.c b/Carpet/CarpetEvolutionMask/src/evolution_mask_init.c index 193b0fab5..18848d1af 100644 --- a/Carpet/CarpetEvolutionMask/src/evolution_mask_init.c +++ b/Carpet/CarpetEvolutionMask/src/evolution_mask_init.c @@ -27,6 +27,9 @@ EvolutionMaskBase_InitEvolutionMask (CCTK_ARGUMENTS) int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); evolution_mask[ind] = 1.0; + if (provide_buffer_mask) { + buffer_mask[ind] = 0; + } } } |