From be437f3e53c36a8de0b8f82e0ec367e0f09535b6 Mon Sep 17 00:00:00 2001 From: Ann Almgren Date: Mon, 7 Oct 2024 14:27:05 -0700 Subject: [PATCH] allow us to specify realbox for tagging that extends past domain (#1857) --- Source/ERF_Tagging.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Source/ERF_Tagging.cpp b/Source/ERF_Tagging.cpp index a2c028eee..c80e046e7 100644 --- a/Source/ERF_Tagging.cpp +++ b/Source/ERF_Tagging.cpp @@ -159,18 +159,32 @@ ERF::refinement_criteria_setup () klo = domain.smallEnd(2) - 1; khi = domain.smallEnd(2) - 1; - for (int k=domain.smallEnd(2); k<=domain.bigEnd(2)+1; ++k) { - if (zlevels_stag[lev_for_box][k] > rbox_lo[2]) { - klo = k-1; - break; + if (rbox_lo[2] < zlevels_stag[lev_for_box][domain.smallEnd(2)]) + { + klo = domain.smallEnd(2); + } + else + { + for (int k=domain.smallEnd(2); k<=domain.bigEnd(2)+1; ++k) { + if (zlevels_stag[lev_for_box][k] > rbox_lo[2]) { + klo = k-1; + break; + } } } AMREX_ASSERT(klo >= domain.smallEnd(2)); - for (int k=klo+1; k<=domain.bigEnd(2)+1; ++k) { - if (zlevels_stag[lev_for_box][k] > rbox_hi[2]) { - khi = k-1; - break; + if (rbox_hi[2] > zlevels_stag[lev_for_box][domain.bigEnd(2)+1]) + { + khi = domain.bigEnd(2); + } + else + { + for (int k=klo+1; k<=domain.bigEnd(2)+1; ++k) { + if (zlevels_stag[lev_for_box][k] > rbox_hi[2]) { + khi = k-1; + break; + } } } AMREX_ASSERT((khi <= domain.bigEnd(2)) && (khi > klo));