aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/ggf.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2008-01-29 04:45:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2008-01-29 04:45:00 +0000
commit7aef61b73a345b41ebc0ad6a0d85bf13dda86b01 (patch)
treeb0d6c970be35bc7d3d563abd31132e525b317a66 /Carpet/CarpetLib/src/ggf.cc
parentdfaee1a51775e04aecedad010bd366ab020d8e1a (diff)
CarpetLib: Free memory when deallocating grid functions
darcs-hash:20080129044555-dae7b-74b17623c5239e72cfb5e82b305604ee694daba8.gz
Diffstat (limited to 'Carpet/CarpetLib/src/ggf.cc')
-rw-r--r--Carpet/CarpetLib/src/ggf.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc
index 70fe3884b..d0dc2e2e4 100644
--- a/Carpet/CarpetLib/src/ggf.cc
+++ b/Carpet/CarpetLib/src/ggf.cc
@@ -239,7 +239,7 @@ void ggf::recompose_fill (comm_state & state, int const rl,
void ggf::recompose_free_old (const int rl)
{
// Delete old storage
- static Timer timer ("dh::recompose");
+ static Timer timer ("dh::recompose_free_old");
timer.start ();
for (int ml=0; ml<(int)oldstorage.size(); ++ml) {
@@ -254,6 +254,24 @@ void ggf::recompose_free_old (const int rl)
timer.stop (0);
}
+void ggf::recompose_free (const int rl)
+{
+ // Delete old storage
+ static Timer timer ("dh::recompose_free");
+ timer.start ();
+
+ for (int ml=0; ml<(int)storage.size(); ++ml) {
+ for (int c=0; c<(int)storage.AT(ml).AT(rl).size(); ++c) {
+ for (int tl=0; tl<timelevels(ml,rl); ++tl) {
+ delete storage.AT(ml).AT(rl).AT(c).AT(tl);
+ } // for tl
+ } // for c
+ storage.AT(ml).AT(rl).clear();
+ } // for ml
+
+ timer.stop (0);
+}
+
// Cycle the time levels by rotating the data sets