From 4306806ad6d517f4e9b675d3cd541c95db3ea7fa Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 14 Nov 2012 16:39:38 -0500 Subject: CarpetLib: Define dh members tallying the size of refinement boundaries Define dh members tallying the size of refinement boundaries. This may be used to implement (2d) face grid functions at some point. --- Carpet/CarpetLib/src/dh.cc | 40 +++++++++++++++++++++++++++++++++++++++- Carpet/CarpetLib/src/dh.hh | 4 ++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Carpet/CarpetLib/src/dh.cc b/Carpet/CarpetLib/src/dh.cc index 911355e34..8ada3e9cf 100644 --- a/Carpet/CarpetLib/src/dh.cc +++ b/Carpet/CarpetLib/src/dh.cc @@ -1205,6 +1205,21 @@ regrid (bool const do_init) << " local.fine_boundary=" << local_box.fine_boundary[dir][face] << "\n"; } + ibset const& boxes = + local_box.fine_boundary[dir][face]; + vector& offsets = + local_box.fine_boundary_offsets[dir][face]; + assert(offsets.empty()); + offsets.reserve(boxes.setsize()); + int offset = 0; + for (ibset::const_iterator + bi=boxes.begin(); bi!=boxes.end(); ++bi) + { + offsets.push_back(offset); + offset += (*bi).size(); + } + local_box.fine_boundary_size[dir][face] = offset; + } // for face } // for dir @@ -1248,6 +1263,21 @@ regrid (bool const do_init) } assert ((obox.buffers.shift(-idir,2) & all_coarse_boundary[dir][face]).empty()); + ibset const& boxes = + local_obox.coarse_boundary[dir][face]; + vector& offsets = + local_obox.coarse_boundary_offsets[dir][face]; + assert(offsets.empty()); + offsets.reserve(boxes.setsize()); + int offset = 0; + for (ibset::const_iterator + bi=boxes.begin(); bi!=boxes.end(); ++bi) + { + offsets.push_back(offset); + offset += (*bi).size(); + } + local_obox.coarse_boundary_size[dir][face] = offset; + } // for face } // for dir @@ -2434,7 +2464,11 @@ memory () memoryof (restricted_region) + memoryof (unused_region) + memoryof (coarse_boundary) + - memoryof (fine_boundary); + memoryof (fine_boundary) + + memoryof (coarse_boundary_offsets) + + memoryof (fine_boundary_offsets) + + memoryof (coarse_boundary_size) + + memoryof (fine_boundary_size); } size_t @@ -2772,6 +2806,10 @@ output (ostream & os) << " unused_region: " << unused_region << eol << " coarse_boundary: " << coarse_boundary << eol << " fine_boundary: " << fine_boundary << eol + << " coarse_boundary_offsets: " << coarse_boundary_offsets << eol + << " fine_boundary_offsets: " << fine_boundary_offsets << eol + << " coarse_boundary_size: " << coarse_boundary_size << eol + << " fine_boundary_size: " << fine_boundary_size << eol << "}" << eol; return os; } diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh index 3ee014006..fa3dbed40 100644 --- a/Carpet/CarpetLib/src/dh.hh +++ b/Carpet/CarpetLib/src/dh.hh @@ -80,6 +80,10 @@ public: // Refluxing vect,dim> coarse_boundary; vect,dim> fine_boundary; + vect,2>,dim> coarse_boundary_offsets; + vect,2>,dim> fine_boundary_offsets; + vect,dim> coarse_boundary_size; + vect,dim> fine_boundary_size; size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream & is); -- cgit v1.2.3