aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-05-01 10:00:28 -0400
committerErik Schnetter <schnetter@gmail.com>2012-05-01 10:00:28 -0400
commitb31f378e589a80eee7eb89feb78a8b0b45989bc4 (patch)
treed0e3a2535172d9f4cc1492e09c172006d6915298
parentad8950de32395727462c79c9a3ad86625b6231ef (diff)
Carpet…: Rename buffer2 to overlap zones; correct implementation in dh
Rename buffer2 zones to overlap zones. Complete implementing overlap zones in the dh class.
-rw-r--r--Carpet/Carpet/param.ccl2
-rw-r--r--Carpet/Carpet/src/SetupGH.cc16
-rw-r--r--Carpet/CarpetLib/src/defs.hh34
-rw-r--r--Carpet/CarpetLib/src/dh.cc88
-rw-r--r--Carpet/CarpetLib/src/dh.hh13
-rw-r--r--Carpet/CarpetRegrid2/src/property.cc2
6 files changed, 94 insertions, 61 deletions
diff --git a/Carpet/Carpet/param.ccl b/Carpet/Carpet/param.ccl
index b0f4b8428..0a3644a53 100644
--- a/Carpet/Carpet/param.ccl
+++ b/Carpet/Carpet/param.ccl
@@ -202,7 +202,7 @@ CCTK_INT additional_buffer_zones "Additional buffer zones"
*:* :: ""
} 0
-BOOLEAN use_buffer2_zones "Use buffer2 zones"
+BOOLEAN use_overlap_zones "Use overlap zones"
{
} "no"
diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc
index 7fabac895..c43c73ae8 100644
--- a/Carpet/Carpet/src/SetupGH.cc
+++ b/Carpet/Carpet/src/SetupGH.cc
@@ -829,14 +829,14 @@ namespace Carpet {
cout << " [" << rl << "]: " << buffers.AT(rl) << "\n";
assert (all (all (buffers.AT(rl) >= 0)));
}
- CCTK_INFO ("Buffer2 zone counts (excluding ghosts):");
- vector<i2vect> buffers2 (maxreflevels);
- for (int rl=1; rl<maxreflevels; ++rl) {
+ CCTK_INFO ("Overlap zone counts:");
+ vector<i2vect> overlaps (maxreflevels);
+ for (int rl=0; rl<maxreflevels; ++rl) {
gh const& hh = * vhh.AT(m);
- buffers2.AT(rl) =
+ overlaps.AT(rl) =
rl == 0 ?
i2vect (0) :
- (use_buffer2_zones ?
+ (use_overlap_zones ?
hh.reffacts.AT(rl) / hh.reffacts.AT(rl-1) * ghosts.AT(rl) :
i2vect (0));
cout << " [" << rl << "]: " << buffers.AT(rl) << "\n";
@@ -850,7 +850,7 @@ namespace Carpet {
vdd.resize(maps);
vdd.AT(m) = new dh (* vhh.AT(m),
- ghosts, buffers, buffers2,
+ ghosts, buffers, overlaps,
my_prolongation_orders_space);
if (maxreflevels > 1) {
@@ -1128,11 +1128,11 @@ namespace Carpet {
baseexts, nboundaryzones);
vector<i2vect> const buffers (1, i2vect (0));
- vector<i2vect> const buffers2 (1, i2vect (0));
+ vector<i2vect> const overlaps (1, i2vect (0));
vector<int> const my_prolongation_orders_space (1, 0);
arrdata.AT(group).AT(m).dd =
new dh (*arrdata.AT(group).AT(m).hh,
- ghosts, buffers, buffers2, my_prolongation_orders_space);
+ ghosts, buffers, overlaps, my_prolongation_orders_space);
arrdata.AT(group).AT(m).tt =
new th (*arrdata.AT(group).AT(m).hh, timelevels, grouptimereffacts,
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 31fad850c..ad9cd1919 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -558,23 +558,23 @@ bool equals (vector<T> const& v, vector<T> const& w)
// Container memory usage
-inline size_t memoryof (char const e) { return sizeof e; }
-inline size_t memoryof (short const e) { return sizeof e; }
-inline size_t memoryof (int const e) { return sizeof e; }
-inline size_t memoryof (long const e) { return sizeof e; }
-inline size_t memoryof (long long const e) { return sizeof e; }
-inline size_t memoryof (unsigned char const e) { return sizeof e; }
-inline size_t memoryof (unsigned short const e) { return sizeof e; }
-inline size_t memoryof (unsigned int const e) { return sizeof e; }
-inline size_t memoryof (unsigned long const e) { return sizeof e; }
-inline size_t memoryof (unsigned long long const e) { return sizeof e; }
-inline size_t memoryof (float const e) { return sizeof e; }
-inline size_t memoryof (double const e) { return sizeof e; }
-inline size_t memoryof (long double const e) { return sizeof e; }
-inline size_t memoryof (void * const e) { return sizeof e; }
-inline size_t memoryof (void const * const e) { return sizeof e; }
-template<class T> inline size_t memoryof (T * const e) { return sizeof e; }
-template<class T> inline size_t memoryof (T const * const e) { return sizeof e; }
+inline size_t memoryof (char const & e) { return sizeof e; }
+inline size_t memoryof (short const & e) { return sizeof e; }
+inline size_t memoryof (int const & e) { return sizeof e; }
+inline size_t memoryof (long const & e) { return sizeof e; }
+inline size_t memoryof (long long const & e) { return sizeof e; }
+inline size_t memoryof (unsigned char const & e) { return sizeof e; }
+inline size_t memoryof (unsigned short const & e) { return sizeof e; }
+inline size_t memoryof (unsigned int const & e) { return sizeof e; }
+inline size_t memoryof (unsigned long const & e) { return sizeof e; }
+inline size_t memoryof (unsigned long long const & e) { return sizeof e; }
+inline size_t memoryof (float const & e) { return sizeof e; }
+inline size_t memoryof (double const & e) { return sizeof e; }
+inline size_t memoryof (long double const & e) { return sizeof e; }
+inline size_t memoryof (void * const & e) { return sizeof e; }
+inline size_t memoryof (void const * const & e) { return sizeof e; }
+template<class T> inline size_t memoryof (T * const & e) { return sizeof e; }
+template<class T> inline size_t memoryof (T const * const & e) { return sizeof e; }
template<class T> inline size_t memoryof (typename list<T>::iterator const & i) { return sizeof i; }
template<class T> inline size_t memoryof (typename list<T>::const_iterator const & i) { return sizeof i; }
diff --git a/Carpet/CarpetLib/src/dh.cc b/Carpet/CarpetLib/src/dh.cc
index a01f82278..b01010b03 100644
--- a/Carpet/CarpetLib/src/dh.cc
+++ b/Carpet/CarpetLib/src/dh.cc
@@ -73,24 +73,24 @@ dh::
dh (gh & h_,
vector<i2vect> const & ghost_widths_,
vector<i2vect> const & buffer_widths_,
- vector<i2vect> const & buffer2_widths_,
+ vector<i2vect> const & overlap_widths_,
vector<int> const & prolongation_orders_space_)
: h(h_),
ghost_widths(ghost_widths_),
buffer_widths(buffer_widths_),
- buffer2_widths(buffer2_widths_),
+ overlap_widths(overlap_widths_),
prolongation_orders_space(prolongation_orders_space_)
{
fast_dboxes::init_fast_ref_refl_sendrecv();
size_t const maxreflevels = h.reffacts.size();
assert (ghost_widths.size() >= maxreflevels);
assert (buffer_widths.size() >= maxreflevels);
- assert (buffer2_widths.size() >= maxreflevels);
+ assert (overlap_widths.size() >= maxreflevels);
assert (prolongation_orders_space.size() >= maxreflevels);
for (size_t rl=0; rl<maxreflevels; ++rl) {
assert (all (all (ghost_widths.AT(rl) >= 0)));
assert (all (all (buffer_widths.AT(rl) >= 0)));
- assert (all (all (buffer2_widths.AT(rl) >= 0)));
+ assert (all (all (overlap_widths.AT(rl) >= 0)));
assert (prolongation_orders_space.AT(rl) >= 0);
}
@@ -290,7 +290,7 @@ regrid (bool const do_init)
i2vect const& ghost_width = ghost_widths.AT(rl);
i2vect const& buffer_width = buffer_widths.AT(rl);
- i2vect const& buffer2_width = buffer2_widths.AT(rl);
+ i2vect const& overlap_width = overlap_widths.AT(rl);
@@ -506,7 +506,7 @@ regrid (bool const do_init)
ibset const notowned = domain_enlarged - allowned;
// All not-active points
- ibset const notactive = notowned.expand (buffer_width);
+ ibset const notactive = notowned.expand (buffer_width + overlap_width);
// All not-active points, in stages
int const num_substeps =
@@ -519,8 +519,9 @@ regrid (bool const do_init)
CCTK_WARN (CCTK_WARN_COMPLAIN, buf.str().c_str());
}
+ ibset const notactive_overlaps = notowned.expand (overlap_width);;
vector<ibset> notactive_stepped (num_substeps+1);
- notactive_stepped.AT(0) = notowned;
+ notactive_stepped.AT(0) = notactive_overlaps;
for (int substep = 1; substep <= num_substeps; ++ substep) {
notactive_stepped.AT(substep) =
notactive_stepped.AT(substep-1).expand (ghost_width);
@@ -530,8 +531,11 @@ regrid (bool const do_init)
"The stepped not-active region must be equal to the not-active region");
}
+ // All overlap zones
+ ibset const alloverlaps = allowned & notactive_overlaps;
+
// All buffer zones
- ibset const allbuffers = allowned & notactive;
+ ibset const allbuffers = allowned & notactive - alloverlaps;
// All active points
ibset& allactive = level_level.active;
@@ -551,15 +555,22 @@ regrid (bool const do_init)
"The stepped buffer zones must be equal to the buffer zones");
}
- // Buffer zones must be in the active part of the domain
+ // Overlap zones and buffer zones must be in the active part of
+ // the domain
ASSERT_rl (allactive <= domain_active,
"The active region must be in the active part of the domain");
+ ASSERT_rl (alloverlaps <= domain_active,
+ "The overlap zones must be in the active part of the domain");
ASSERT_rl (allbuffers <= domain_active,
"The buffer zones must be in the active part of the domain");
+ ASSERT_rl ((allactive & alloverlaps).empty(),
+ "The active points and the overlap zones cannot overlap");
ASSERT_rl ((allactive & allbuffers).empty(),
"The active points and the buffer zones cannot overlap");
- ASSERT_rl (allactive + allbuffers == allowned,
- "The active points and the buffer points together must be exactly the owned region");
+ ASSERT_rl ((alloverlaps & allbuffers).empty(),
+ "The overlap zones and the buffer zones cannot overlap");
+ ASSERT_rl (allactive + alloverlaps + allbuffers == allowned,
+ "The active points, the overlap points, and buffer points together must be exactly the owned region");
@@ -569,10 +580,13 @@ regrid (bool const do_init)
// Buffer zones:
box.buffers = box.owned & allbuffers;
+ // Overlap zones:
+ box.overlaps = box.owned & alloverlaps;
+
// Active region:
box.active = box.owned & allactive;
- ASSERT_c (box.active == box.owned - box.buffers,
- "The active region must equal the owned region minus the buffer zones");
+ ASSERT_c (box.active == box.owned - (box.buffers + box.overlaps),
+ "The active region must equal the owned region minus the (buffer zones plus overlap zones)");
} // for c
for (int lc = 0; lc < h.local_components(rl); ++ lc) {
@@ -580,10 +594,11 @@ regrid (bool const do_init)
local_dboxes & local_box = local_level.AT(lc);
full_dboxes const& box = full_level.AT(c);
- // Stepped buffer zones:
local_box.buffers = box.buffers;
+ local_box.overlaps = box.overlaps;
#if 0
+ // Stepped buffer zones:
local_box.buffers_stepped.resize (num_substeps);
for (int substep = 0; substep < num_substeps; ++ substep) {
local_box.buffers_stepped.AT(substep) =
@@ -615,7 +630,11 @@ regrid (bool const do_init)
ASSERT_c ((box.active & box.buffers).empty(),
"Consistency check");
- ASSERT_c ((box.active | box.buffers) == box.owned,
+ ASSERT_c ((box.active & box.overlaps).empty(),
+ "Consistency check");
+ ASSERT_c ((box.overlaps & box.buffers).empty(),
+ "Consistency check");
+ ASSERT_c ((box.active | box.overlaps | box.buffers) == box.owned,
"Consistency check");
ASSERT_c ((box.owned & box.boundaries).empty(),
@@ -976,35 +995,33 @@ regrid (bool const do_init)
ibbox const& odomext = h.baseextent(ml,orl);
// Refinement restriction may fill all coarse interior points,
- // and must use all fine active points that are not buffer2
- // points
+ // and must use all fine active points
ibset allrestricted;
switch (h.refcent) {
case vertex_centered:
// TODO: support this
- assert (all (all (buffer2_width == 0)));
allrestricted = allactive.contracted_for(odomext);
break;
case cell_centered: {
ibset const& source = allactive;
ibbox const& target = odomext;
- ibbox const all = allactive.container().expand(10,10);
- ibbox const all_target = all.contracted_for(target);
+ ibbox const all_source = allactive.container().expand(10,10);
+ ibbox const all_target = all_source.contracted_for(target);
ibset const tmp0 = source;
ibset const tmp1 = tmp0.expanded_for(target);
ibset const tmp2 = all_target - tmp1;
- ibset const tmp3 = tmp2.expand(1,1).expand(buffer2_width);
+ ibset const tmp3 = tmp2.expand(1,1);
ibset const tmp4 = all_target - tmp3;
allrestricted = tmp4;
- // cout << "source=" << source << "\n"
- // << "target=" << target << "\n"
- // << "all=" << all << "\n"
- // << "all_target=" << all_target << "\n"
- // << "tmp1=" << tmp1 << "\n"
- // << "tmp2=" << tmp2 << "\n"
- // << "tmp3=" << tmp3 << "\n"
- // << "allrestricted=" << allrestricted << "\n";
+ cout << "source=" << source << "\n"
+ << "target=" << target << "\n"
+ << "all_source=" << all_source << "\n"
+ << "all_target=" << all_target << "\n"
+ << "tmp1=" << tmp1 << "\n"
+ << "tmp2=" << tmp2 << "\n"
+ << "tmp3=" << tmp3 << "\n"
+ << "allrestricted=" << allrestricted << "\n";
break;
}
default:
@@ -2165,6 +2182,7 @@ operator== (full_dboxes const & b) const
boundaries == b.boundaries and
owned == b.owned and
buffers == b.buffers and
+ overlaps == b.overlaps and
active == b.active and
sync == b.sync and
bndref == b.bndref and
@@ -2274,6 +2292,7 @@ memory ()
sizeof gh_handle + // memoryof (gh_handle) +
memoryof (ghost_widths) +
memoryof (buffer_widths) +
+ memoryof (overlap_widths) +
memoryof (prolongation_orders_space) +
memoryof (light_boxes) +
memoryof (fast_boxes) +
@@ -2314,6 +2333,7 @@ memory ()
{
return
memoryof (buffers) +
+ memoryof (overlaps) +
memoryof (active) +
#if 0
memoryof (buffers_stepped) +
@@ -2342,6 +2362,7 @@ memory ()
memoryof (boundaries) +
memoryof (owned) +
memoryof (buffers) +
+ memoryof (overlaps) +
memoryof (active) +
memoryof (sync) +
memoryof (bndref) +
@@ -2419,6 +2440,9 @@ input (istream & is)
consume (is, "buffers:");
is >> buffers;
skipws (is);
+ consume (is, "overlaps:");
+ is >> overlaps;
+ skipws (is);
consume (is, "active:");
is >> active;
#if 0
@@ -2488,6 +2512,9 @@ input (istream & is)
consume (is, "buffers:");
is >> buffers;
skipws (is);
+ consume (is, "overlaps:");
+ is >> overlaps;
+ skipws (is);
consume (is, "active:");
is >> active;
skipws (is);
@@ -2564,6 +2591,7 @@ output (ostream & os)
os << "dh:"
<< "ghost_widths=" << ghost_widths << ","
<< "buffer_widths=" << buffer_widths << ","
+ << "overlap_widths=" << overlap_widths << ","
<< "prolongation_orders_space=" << prolongation_orders_space << ","
<< "light_boxes=" << light_boxes << ","
<< "fast_boxes=" << fast_boxes << ","
@@ -2604,6 +2632,7 @@ output (ostream & os)
// Regions:
os << "dh::local_dboxes:{" << eol
<< " buffers: " << buffers << eol
+ << " overlaps: " << overlaps << eol
<< " active: " << active << eol
#if 0
<< " buffers_stepped: " << buffers_stepped << eol
@@ -2635,6 +2664,7 @@ output (ostream & os)
<< " boundaries: " << boundaries << eol
<< " owned: " << owned << eol
<< " buffers: " << buffers << eol
+ << " overlaps: " << overlaps << eol
<< " active: " << active << eol
<< " sync: " << sync << eol
<< " bndref: " << bndref << eol
diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh
index 7a2282fba..46d927ace 100644
--- a/Carpet/CarpetLib/src/dh.hh
+++ b/Carpet/CarpetLib/src/dh.hh
@@ -18,7 +18,7 @@
using namespace std;
#define CARPET_HAVE_BUFFER_WIDTHS
-#define CARPET_HAVE_BUFFER2_WIDTHS
+#define CARPET_HAVE_OVERLAP_WIDTHS
// Forward declaration
class ggf;
@@ -63,7 +63,8 @@ public:
// Information about the processor-local region:
ibset buffers; // buffer zones
- ibset active; // owned minus buffers
+ ibset overlaps; // overlap zones
+ ibset active; // owned minus (buffers + overlaps)
#if 0
vector<ibset> buffers_stepped; // buffer zones [substep]
#endif
@@ -98,6 +99,7 @@ public:
// ibset boundaries;
// ibset owned;
// ibset buffers;
+ // ibset overlaps;
ibset active;
// ibset bndref;
@@ -117,7 +119,8 @@ public:
ibbox owned; // evolved in time
ibset buffers; // buffer zones
- ibset active; // owned minus buffers
+ ibset overlaps; // overlap zones
+ ibset active; // owned minus (buffers plus overlaps)
ibset sync; // filled by synchronisation
ibset bndref; // filled by boundary prolongation
@@ -220,7 +223,7 @@ public: // should be readonly
#endif
vector<i2vect> ghost_widths; // number of ghost zones [rl]
vector<i2vect> buffer_widths; // number of buffer zones [rl]
- vector<i2vect> buffer2_widths; // number of2 buffer zones [rl]
+ vector<i2vect> overlap_widths; // number of overlap zones [rl]
vector<int> prolongation_orders_space; // order of spatial
// prolongation operator [rl]
@@ -237,7 +240,7 @@ public:
dh (gh & h,
vector<i2vect> const & ghost_widths,
vector<i2vect> const & buffer_widths,
- vector<i2vect> const & buffer2_widths,
+ vector<i2vect> const & overlap_widths,
vector<int> const & prolongation_orders_space);
// Destructors
diff --git a/Carpet/CarpetRegrid2/src/property.cc b/Carpet/CarpetRegrid2/src/property.cc
index ee1b4d195..ed80dfac9 100644
--- a/Carpet/CarpetRegrid2/src/property.cc
+++ b/Carpet/CarpetRegrid2/src/property.cc
@@ -141,7 +141,7 @@ namespace CarpetRegrid2 {
vector<ibset> const& regions, int const rl)
{
return regions.at(rl).expand (dd.buffer_widths.at(rl) +
- dd.buffer2_widths.at(rl));
+ dd.overlap_widths.at(rl));
}
bool add_buffers::