From 483d827588ca7c6e9e6c8c6ac8998c6bdf1159c3 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Fri, 17 Sep 2010 21:15:08 -0500 Subject: CarpetReduce: Correct error in calculating weight for restricted region --- Carpet/CarpetReduce/src/mask_carpet.cc | 137 +++++++++++++++++---------------- 1 file changed, 71 insertions(+), 66 deletions(-) (limited to 'Carpet/CarpetReduce') diff --git a/Carpet/CarpetReduce/src/mask_carpet.cc b/Carpet/CarpetReduce/src/mask_carpet.cc index a523742c5..3e41f1846 100644 --- a/Carpet/CarpetReduce/src/mask_carpet.cc +++ b/Carpet/CarpetReduce/src/mask_carpet.cc @@ -12,6 +12,25 @@ #include #include "mask_carpet.hh" + + + +#define SWITCH_TO_LEVEL(cctkGH, rl) \ + do { \ + bool switch_to_level_ = true; \ + assert (is_singlemap_mode()); \ + int const rl_ = (rl); \ + int const m_ = Carpet::map; \ + BEGIN_GLOBAL_MODE (cctkGH) { \ + ENTER_LEVEL_MODE (cctkGH, rl_) { \ + ENTER_SINGLEMAP_MODE (cctkGH, m_, CCTK_GF) { +#define END_SWITCH_TO_LEVEL \ + } LEAVE_SINGLEMAP_MODE; \ + } LEAVE_LEVEL_MODE; \ + } END_GLOBAL_MODE; \ + assert (switch_to_level_); \ + switch_to_level_ = false; \ + } while (false) @@ -53,89 +72,77 @@ namespace CarpetMask { // Set prolongation boundaries of this level - { - BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) { - - DECLARE_CCTK_ARGUMENTS; - - ibbox const & ext = - dd.light_boxes.AT(mglevel).AT(reflevel).AT(component).exterior; - ibset const & active = - dd.local_boxes.AT(mglevel).AT(reflevel).AT(local_component).active; - - vect const & boundaries = - dd.local_boxes.AT(mglevel).AT(reflevel).AT(local_component).prolongation_boundaries; - - ibset const notactive = ext - active; + BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) { + DECLARE_CCTK_ARGUMENTS; + + ibbox const & ext = + dd.light_boxes.AT(mglevel).AT(reflevel).AT(component).exterior; + ibset const & active = + dd.local_boxes.AT(mglevel).AT(reflevel).AT(local_component).active; + + vect const & boundaries = + dd.local_boxes.AT(mglevel).AT(reflevel).AT(local_component).prolongation_boundaries; + + ibset const notactive = ext - active; + + for (int d=0; d 0) { +#if 0 weight[ind] *= 1.0 - 1.0 / mask[ind]; +#endif + weight[ind] -= 1.0 / mask[ind]; } } LC_ENDLOOP3(CarpetMaskSetup_restriction_boundary_apply); } END_LOCAL_COMPONENT_LOOP; - - leave_singlemap_mode (cctkGH); - leave_level_mode (cctkGH); - enter_level_mode (cctkGH, oldreflevel); - enter_singlemap_mode (cctkGH, oldmap, oldgrouptype); - } + } END_SWITCH_TO_LEVEL; } // if reflevel>0 } -- cgit v1.2.3