diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-08-04 00:25:49 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-08-04 00:25:49 -0400 |
commit | 9166952a1e2571bf5656345d7f8f1d1246e033d7 (patch) | |
tree | 81715eab307797c498c1a1f56671f480e3b14eaf /Carpet/CarpetLib/src/dh.hh | |
parent | dbe1636f5ed6ec4859719ff08f731735e123c59e (diff) |
CarpetLib: Store registered gh, dh, th, gf, data etc. via sets, not via lists
Use set instead of list to store registered gh, dh, th, gf, data.
Do not store an iterator as handle for de-registering.
This corrects some memory corruption with the Intel compiler; the previous code may have been illegal.
Diffstat (limited to 'Carpet/CarpetLib/src/dh.hh')
-rw-r--r-- | Carpet/CarpetLib/src/dh.hh | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh index 2a03ceccc..b558b013f 100644 --- a/Carpet/CarpetLib/src/dh.hh +++ b/Carpet/CarpetLib/src/dh.hh @@ -4,7 +4,7 @@ #include <cassert> #include <cstdlib> #include <iostream> -#include <list> +#include <set> #include <string> #include <vector> @@ -29,8 +29,7 @@ class dh; // A data hierarchy (grid hierarchy plus ghost zones) class dh { - static list<dh*> alldh; - list<dh*>::iterator alldhi; + static set<dh*> alldh; // Types public: @@ -232,7 +231,6 @@ public: // should be readonly // Fields gh & h; // hierarchy - gh::dh_handle gh_handle; #if 0 i2vect ghost_width; // number of ghost zones @@ -250,8 +248,7 @@ public: // should be readonly level_mboxes level_boxes; // grid hierarchy [ml][rl] fast_mboxes fast_boxes; // grid hierarchy [ml][rl][p] - typedef list<ggf*>::iterator ggf_handle; - list<ggf*> gfs; // list of all grid functions + set<ggf*> gfs; // all grid functions public: @@ -288,8 +285,8 @@ private: public: // Grid function management - ggf_handle add (ggf * f); - void erase (ggf_handle fi); + void insert (ggf * f); + void erase (ggf * f); // Output size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; |