From 3a0877d52d1b3a8115b4a5fad7bcd7f659104cef Mon Sep 17 00:00:00 2001 From: remicres <remi.cresson@teledetection.fr> Date: Thu, 11 Aug 2016 13:13:06 +0000 Subject: [PATCH] ADD: Add generic functions for memory computation of nodes and graph --- include/lsrmSegmenter.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/lsrmSegmenter.h b/include/lsrmSegmenter.h index 92771b9..bedc01a 100644 --- a/include/lsrmSegmenter.h +++ b/include/lsrmSegmenter.h @@ -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); -- GitLab