diff options
author | Erik Schnetter <schnetter@gmail.com> | 2012-11-14 16:39:38 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2012-11-14 16:39:38 -0500 |
commit | 4306806ad6d517f4e9b675d3cd541c95db3ea7fa (patch) | |
tree | f08db8835cc797f0d17f602419089fca63f87f01 | |
parent | 17845edc3640298238c742a51509be2423cd6373 (diff) |
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.
-rw-r--r-- | Carpet/CarpetLib/src/dh.cc | 40 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/dh.hh | 4 |
2 files changed, 43 insertions, 1 deletions
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<int>& 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<int>& 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<vect<ibset,2>,dim> coarse_boundary; vect<vect<ibset,2>,dim> fine_boundary; + vect<vect<vector<int>,2>,dim> coarse_boundary_offsets; + vect<vect<vector<int>,2>,dim> fine_boundary_offsets; + vect<vect<int,2>,dim> coarse_boundary_size; + vect<vect<int,2>,dim> fine_boundary_size; size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream & is); |