aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/bbox.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/CarpetLib/src/bbox.hh')
-rw-r--r--Carpet/CarpetLib/src/bbox.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh
index 0b813d39d..a79fbe87b 100644
--- a/Carpet/CarpetLib/src/bbox.hh
+++ b/Carpet/CarpetLib/src/bbox.hh
@@ -2,6 +2,7 @@
#define BBOX_HH
#include <cassert>
+#include <cstdlib>
#include <iostream>
#include <limits>
@@ -177,6 +178,12 @@ public:
which means that it also points to the first point. */
iterator end () const;
+ // Memory usage
+ size_t memory () const
+ {
+ return memoryof (_lower) + memoryof (_upper) + memoryof (_stride);
+ }
+
// Input/Output helpers
void input (istream& is);
void output (ostream& os) const;
@@ -184,6 +191,13 @@ public:
+// Memory usage
+
+template<class T, int D>
+inline size_t memoryof (bbox<T,D> const & b) { return b.memory(); }
+
+
+
// Input
/** Read a formatted bbox from a stream. */