Type of tree for partitioning the hough space.
More...
#include <WeightedFastHoughTree.h>
|
| WeightedParititioningDynTree (ADomain topDomain, ADomainDivsion domainDivsion) |
| Constructor attaching a vector of the weighted items to the top most node domain.
|
|
Node & | getTopNode () |
| Getter for the top node of the tree.
|
|
const Node & | getTopNode () const |
| Constant getter for the top node of the tree.
|
|
Node & | getTopNode () |
| Getter for the top node of the tree.
|
|
const Node & | getTopNode () const |
| Constant getter for the top node of the tree.
|
|
int | getNNodes () const |
| Gets the number of nodes currently contained in the tree Also demonstrates how to walk over the tree.
|
|
int | getNNodes () const |
| Gets the number of nodes currently contained in the tree Also demonstrates how to walk over the tree.
|
|
std::map< int, int > | getNNodesByLevel () const |
| Gets the number of nodes by level in the tree Also demonstrates how to walk over the tree.
|
|
std::map< int, int > | getNNodesByLevel () const |
| Gets the number of nodes by level in the tree Also demonstrates how to walk over the tree.
|
|
void | walk (AWalker &walker) |
| Forward walk to the top node.
|
|
void | walk (AWalker &walker, APriorityMeasure &priority) |
| Forward walk to the top node.
|
|
void | walk (AWalker &walker) |
| Forward walk to the top node.
|
|
void | walk (AWalker &walker, APriorityMeasure &priority) |
| Forward walk to the top node.
|
|
void | fell () |
| Fell to tree meaning deleting all child nodes from the tree. Keeps the top node.
|
|
void | fell () |
| Fell to tree meaning deleting all child nodes from the tree. Keeps the top node.
|
|
void | raze () |
| Like fell but also releases all memory the tree has acquired during long execution.
|
|
void | raze () |
| Like fell but also releases all memory the tree has acquired during long execution.
|
|
|
std::vector< Node > * | createChildren (Node *parentNode) |
| Create child nodes for the given parents.
|
|
std::vector< Node > * | createChildren (Node *parentNode) |
| Create child nodes for the given parents.
|
|
std::vector< Node > * | getUnusedChildren () |
| Acquire the next unused child node structure, recycling all memory.
|
|
std::vector< Node > * | getUnusedChildren () |
| Acquire the next unused child node structure, recycling all memory.
|
|
template<class T, class ADomain, class ADomainDivsion>
class Belle2::TrackFindingCDC::WeightedParititioningDynTree< T, ADomain, ADomainDivsion >
Type of tree for partitioning the hough space.
Definition at line 29 of file WeightedFastHoughTree.h.
◆ Properties
◆ SubPropertiesFactory
Type of the factory for the sub node properties.
Definition at line 44 of file DynTree.h.
◆ Super
template<class T, class ADomain, class ADomainDivsion>
◆ This
Type of this class.
Definition at line 38 of file DynTree.h.
◆ WeightedParititioningDynTree()
template<class T, class ADomain, class ADomainDivsion>
Constructor attaching a vector of the weighted items to the top most node domain.
Definition at line 37 of file WeightedFastHoughTree.h.
37 :
38 Super(WithWeightedItems<ADomain, T>(std::move(topDomain)), std::move(domainDivsion))
39 {}
◆ createChildren() [1/2]
std::vector< Node > * createChildren |
( |
Node * | parentNode | ) |
|
|
inlineprivateinherited |
Create child nodes for the given parents.
Definition at line 284 of file DynTree.h.
285 {
286 std::vector<Node>* result = getUnusedChildren();
287 auto subProperties = m_subPropertiesFactory(*parentNode);
288 if (subProperties.empty()) {
289 result->clear();
290 } else {
291
292 result->resize(subProperties.size(), Node(subProperties.back()));
293 size_t iSubNode = 0;
294 for (auto& properties : subProperties) {
295 clearIfApplicable(result->at(iSubNode));
296 result->at(iSubNode) = properties;
297 ++iSubNode;
298 }
299 }
300 return result;
301 }
◆ createChildren() [2/2]
std::vector< Node > * createChildren |
( |
Node * | parentNode | ) |
|
|
inlineprivateinherited |
Create child nodes for the given parents.
Definition at line 284 of file DynTree.h.
285 {
286 std::vector<Node>* result = getUnusedChildren();
287 auto subProperties = m_subPropertiesFactory(*parentNode);
288 if (subProperties.empty()) {
289 result->clear();
290 } else {
291
292 result->resize(subProperties.size(), Node(subProperties.back()));
293 size_t iSubNode = 0;
294 for (auto& properties : subProperties) {
295 clearIfApplicable(result->at(iSubNode));
296 result->at(iSubNode) = properties;
297 ++iSubNode;
298 }
299 }
300 return result;
301 }
◆ fell() [1/2]
Fell to tree meaning deleting all child nodes from the tree. Keeps the top node.
Definition at line 334 of file DynTree.h.
335 {
336 clearIfApplicable(m_topNode);
337 m_topNode.unlink();
338 m_topNode.m_tree = this;
339 for (typename Node::Children& children : m_children) {
340 for (Node& node : children) {
341 clearIfApplicable(node);
342 node.unlink();
343 }
344 }
345 m_nUsedChildren = 0;
346 }
◆ fell() [2/2]
Fell to tree meaning deleting all child nodes from the tree. Keeps the top node.
Definition at line 334 of file DynTree.h.
335 {
336 clearIfApplicable(m_topNode);
337 m_topNode.unlink();
338 m_topNode.m_tree = this;
339 for (typename Node::Children& children : m_children) {
340 for (Node& node : children) {
341 clearIfApplicable(node);
342 node.unlink();
343 }
344 }
345 m_nUsedChildren = 0;
346 }
◆ getNNodes() [1/2]
Gets the number of nodes currently contained in the tree Also demonstrates how to walk over the tree.
Definition at line 248 of file DynTree.h.
249 {
250 int nNodes = 0;
251 auto countNodes = [&nNodes](const Node*) -> bool {
252 ++nNodes;
253 return true;
254 };
255 const_cast<DynTree&>(*this).walk(countNodes);
256
257 return nNodes;
258 }
◆ getNNodes() [2/2]
Gets the number of nodes currently contained in the tree Also demonstrates how to walk over the tree.
Definition at line 248 of file DynTree.h.
249 {
250 int nNodes = 0;
251 auto countNodes = [&nNodes](const Node*) -> bool {
252 ++nNodes;
253 return true;
254 };
255 const_cast<DynTree&>(*this).walk(countNodes);
256
257 return nNodes;
258 }
◆ getNNodesByLevel() [1/2]
std::map< int, int > getNNodesByLevel |
( |
| ) |
const |
|
inlineinherited |
Gets the number of nodes by level in the tree Also demonstrates how to walk over the tree.
Definition at line 264 of file DynTree.h.
265 {
266 std::map<int, int> nNodesByLevel;
267 auto countNodes = [&nNodesByLevel](const Node * node) -> bool {
268 if (nNodesByLevel.count(node->getLevel()) == 0)
269 {
270 nNodesByLevel[node->getLevel()] = 1;
271 } else
272 {
273 nNodesByLevel[node->getLevel()]++;
274 }
275 return true;
276 };
277 const_cast<DynTree&>(*this).walk(countNodes);
278
279 return nNodesByLevel;
280 }
◆ getNNodesByLevel() [2/2]
std::map< int, int > getNNodesByLevel |
( |
| ) |
const |
|
inlineinherited |
Gets the number of nodes by level in the tree Also demonstrates how to walk over the tree.
Definition at line 264 of file DynTree.h.
265 {
266 std::map<int, int> nNodesByLevel;
267 auto countNodes = [&nNodesByLevel](const Node * node) -> bool {
268 if (nNodesByLevel.count(node->getLevel()) == 0)
269 {
270 nNodesByLevel[node->getLevel()] = 1;
271 } else
272 {
273 nNodesByLevel[node->getLevel()]++;
274 }
275 return true;
276 };
277 const_cast<DynTree&>(*this).walk(countNodes);
278
279 return nNodesByLevel;
280 }
◆ getTopNode() [1/4]
Getter for the top node of the tree.
Definition at line 237 of file DynTree.h.
238 { return m_topNode; }
◆ getTopNode() [2/4]
Getter for the top node of the tree.
Definition at line 237 of file DynTree.h.
238 { return m_topNode; }
◆ getTopNode() [3/4]
const Node & getTopNode |
( |
| ) |
const |
|
inlineinherited |
Constant getter for the top node of the tree.
Definition at line 241 of file DynTree.h.
242 { return m_topNode; }
◆ getTopNode() [4/4]
const Node & getTopNode |
( |
| ) |
const |
|
inlineinherited |
Constant getter for the top node of the tree.
Definition at line 241 of file DynTree.h.
242 { return m_topNode; }
◆ getUnusedChildren() [1/2]
std::vector< Node > * getUnusedChildren |
( |
| ) |
|
|
inlineprivateinherited |
Acquire the next unused child node structure, recycling all memory.
Definition at line 304 of file DynTree.h.
305 {
306 if (m_nUsedChildren >= m_children.size()) {
307 m_children.emplace_back();
308 }
309 ++m_nUsedChildren;
310 return &(m_children[m_nUsedChildren - 1]);
311 }
◆ getUnusedChildren() [2/2]
std::vector< Node > * getUnusedChildren |
( |
| ) |
|
|
inlineprivateinherited |
Acquire the next unused child node structure, recycling all memory.
Definition at line 304 of file DynTree.h.
305 {
306 if (m_nUsedChildren >= m_children.size()) {
307 m_children.emplace_back();
308 }
309 ++m_nUsedChildren;
310 return &(m_children[m_nUsedChildren - 1]);
311 }
◆ raze() [1/2]
Like fell but also releases all memory the tree has acquired during long execution.
Definition at line 349 of file DynTree.h.
350 {
351 this->fell();
352 m_children.clear();
353 m_children.shrink_to_fit();
354 }
◆ raze() [2/2]
Like fell but also releases all memory the tree has acquired during long execution.
Definition at line 349 of file DynTree.h.
350 {
351 this->fell();
352 m_children.clear();
353 m_children.shrink_to_fit();
354 }
◆ walk() [1/4]
void walk |
( |
AWalker & | walker | ) |
|
|
inlineinherited |
Forward walk to the top node.
Definition at line 316 of file DynTree.h.
317 {
318 static_assert(std::is_assignable<std::function<bool(Node*)>, AWalker>(), "");
319
320 getTopNode().walk(walker);
321 }
◆ walk() [2/4]
void walk |
( |
AWalker & | walker | ) |
|
|
inlineinherited |
Forward walk to the top node.
Definition at line 316 of file DynTree.h.
317 {
318 static_assert(std::is_assignable<std::function<bool(Node*)>, AWalker>(), "");
319
320 getTopNode().walk(walker);
321 }
◆ walk() [3/4]
void walk |
( |
AWalker & | walker, |
|
|
APriorityMeasure & | priority ) |
|
inlineinherited |
Forward walk to the top node.
Definition at line 325 of file DynTree.h.
326 {
327 static_assert(std::is_assignable<std::function<bool(Node*)>, AWalker>(), "");
328 static_assert(std::is_assignable<std::function<float(Node*)>, APriorityMeasure>(), "");
329
330 getTopNode().walk(walker, priority);
331 }
◆ walk() [4/4]
void walk |
( |
AWalker & | walker, |
|
|
APriorityMeasure & | priority ) |
|
inlineinherited |
Forward walk to the top node.
Definition at line 325 of file DynTree.h.
326 {
327 static_assert(std::is_assignable<std::function<bool(Node*)>, AWalker>(), "");
328 static_assert(std::is_assignable<std::function<float(Node*)>, APriorityMeasure>(), "");
329
330 getTopNode().walk(walker, priority);
331 }
◆ m_children [1/2]
std::deque<typename Node::Children> m_children |
|
inherited |
Central point to provide memory for the child structures.
Definition at line 364 of file DynTree.h.
◆ m_children [2/2]
std::deque<typename Node::Children> m_children |
|
inherited |
Central point to provide memory for the child structures.
Definition at line 364 of file DynTree.h.
◆ m_nUsedChildren [1/2]
Last index of used children.
Definition at line 367 of file DynTree.h.
◆ m_nUsedChildren [2/2]
Last index of used children.
Definition at line 367 of file DynTree.h.
◆ m_subPropertiesFactory [1/2]
Instance of the properties factory for the sub nodes.
Definition at line 358 of file DynTree.h.
◆ m_subPropertiesFactory [2/2]
Instance of the properties factory for the sub nodes.
Definition at line 358 of file DynTree.h.
◆ m_topNode [1/2]
Memory for the top node of the tree.
Definition at line 361 of file DynTree.h.
◆ m_topNode [2/2]
Memory for the top node of the tree.
Definition at line 361 of file DynTree.h.
The documentation for this class was generated from the following file: