[ET Trac] [Einstein Toolkit] #1846: Very large grids with bboxset2
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Tue Dec 8 11:41:49 CST 2015
#1846: Very large grids with bboxset2
---------------------+------------------------------------------------------
Reporter: hinder | Owner: eschnett
Type: defect | Status: confirmed
Priority: major | Milestone:
Component: Carpet | Version: development version
Resolution: | Keywords:
---------------------+------------------------------------------------------
Comment (by eschnett):
This patch
{{{
diff --git a/CarpetLib/src/bboxset2.hh b/CarpetLib/src/bboxset2.hh
index f0d7a9d..2d58925 100644
--- a/CarpetLib/src/bboxset2.hh
+++ b/CarpetLib/src/bboxset2.hh
@@ -943,7 +943,7 @@ template <typename T, int D> size_type bboxset<T,
D>::size() const {
#else
TRAVERSE_SUBSETS1(const T &pos(_1); const bboxset1 &subset(_2); {
const size_type subset_size = subset.size();
- total_size += (pos - old_pos) * old_subset_size;
+ total_size += old_subset_size == 0 ? 0 : (pos - old_pos) *
old_subset_size;
old_pos = pos;
old_subset_size = subset_size;
});
}}}
may prevent an integer overflow, if CARPET_AVOID_LAMBDA is set.
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1846#comment:3>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list