Commit 3a0877d5 authored by remicres's avatar remicres
Browse files

ADD: Add generic functions for memory computation of nodes and graph

Showing with 22 additions and 0 deletions
+22 -0
......@@ -81,6 +81,28 @@ namespace lsrm
return labelImg;
}
/*
* Returns the memory (in bytes) occupied by one node of the graph
*/
virtual unsigned int GetNodeMemory(unsigned int nEdges) = 0;
/*
* Returns the memory (in bytes) occupied by the entire graph
*/
long long unsigned int GetGraphMemory()
{
long long unsigned int memory = 0;
long long unsigned int numberOfMoves = 0;
for(auto& node : m_Graph.m_Nodes)
{
numberOfMoves += node->m_Contour.size();
memory += this->GetNodeMemory(node->m_Edges.size());
}
memory += std::ceil(numberOfMoves / 4);
return memory;
}
/* Set methods */
SetMacro(bool, DoBFSegmentation);
SetMacro(unsigned int, NumberOfIterations);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment