new test cases

worked on all walkers
new helper methods
new distributions
some bugfixes
This commit is contained in:
2016-02-02 21:43:15 +01:00
parent ec86b07c43
commit 2e2c1a3004
18 changed files with 363 additions and 41 deletions

View File

@@ -235,6 +235,11 @@ public:
remove(nodes[idx]);
}
/**
* mark the given node for deletion
* see: cleanup()
*/
void remove(T& node) {
// disconnect from all neighbors
@@ -250,8 +255,11 @@ public:
}
/** remove all nodes marked for deletion */
void cleanup() {
debugMemoryUsage();
Log::add(name, "running grid cleanup", false);
Log::tick();
@@ -293,6 +301,8 @@ public:
rebuildHashes();
debugMemoryUsage();
}
/** rebuild the UID-hash-list */
@@ -310,6 +320,18 @@ public:
}
/** debug-print the grid's current memory usage */
void debugMemoryUsage() {
const uint32_t bytes = nodes.size() * sizeof(T);
const uint32_t numNodes = nodes.size();
uint32_t numNeighbors = 0;
//uint32_t numNeighborsUnused = 0;
for (T& n : nodes) {
numNeighbors += n._numNeighbors;
}
Log::add(name, "memory: " + std::to_string(bytes/1024.0f/1024.0f) + " MB in " + std::to_string(numNodes) + " nodes");
}
// /**
// * remove all nodes, marked for deletion.
// * BEWARE: this will invalidate all indices used externally!