Class documentation of Concepts

Loading...
Searching...
No Matches
tree03.hh
Go to the documentation of this file.
1
6#ifndef clusterTree03_hh
7#define clusterTree03_hh
8
9#include "toolbox/hashMap.hh"
10#include "cluster/tree.hh"
11
12namespace cluster {
13
14 // ********************************************************** TreeTraits03 **
15
20 template<class Node>
21 class TreeTraits03 : public TreeTraits<Node> {
22 public:
23 typedef typename TreeTraits<Node>::F F;
24
25 static Node* newNode(const concepts::Element<F>& elm, const BBall<F>& ball,
26 Node* lnk) {return new Node(elm, ball, lnk);}
27 static Node* newNode(uint idx, Node& chld, const concepts::Real3d& c,
28 concepts::Real r, uint nlf = 0) {
29 return new Node(idx, chld, c, r, nlf);
30 }
31
32 static Node* child(const Node* nd) {return nd->child();}
33 static Node* link(const Node* nd) {return nd->link();}
34 static Node*& link(Node* nd) {return nd->link();}
35 };
36
37 // ************************************************************ CebyCenter **
38
43 template<class Node>
44 class CebyCenter {
45 public:
48 typedef typename Traits::F F;
49
53 inline CebyCenter(uint nvtx);
54 inline ~CebyCenter() {delete[] vtx_;}
55
64 void operator()(const Node* lfset, concepts::Real3d& c, concepts::Real& r,
65 const concepts::Real3d* (&e)[4], uint& ne);
66
67 private:
68 static concepts::Real eps_;
70 uint nvtx_;
72 const concepts::Real3d** vtx_;
74 std::unordered_map<uint, uint> vtxtag_;
76 uint tag_;
77 };
78
79 template<class Node>
81 : nvtx_(nvtx), vtxtag_(), tag_(0) {
82 vtx_ = new const concepts::Real3d*[nvtx_];
83 }
84
85 // **************************************************************** Tree03 **
86
92 template<class CNode>
93 class Tree03 : public Tree<CNode> {
94 public:
97 typedef typename Traits::F F;
98
105 Tree03(const concepts::Space<F>& spc, const BBall<F>& ball,
106 uint nlfmin = 1);
107 inline ~Tree03() {destructor_(root_); delete root_;}
108
110 inline uint nclst() const {return nclst_;}
112 inline uint nleaf() const {return nlf_;}
114 inline const CNode* root() const {return root_;}
115
121 void sketch(std::ostream& os, const CNode* lnk = 0, uint l = 0);
122
123 private:
125 uint nlfmin_;
127 uint nlf_;
129 uint nclst_;
131 CNode* root_;
132
136 CNode* constructor_(CNode* lfset, CebyCenter<CNode>& cby);
138 void destructor_(CNode* clst);
140 CNode* concat_(CNode* a, CNode* b);
141 };
142
143} // namespace cluster
144
145#endif // clusterTree03_hh
void operator()(const Node *lfset, concepts::Real3d &c, concepts::Real &r, const concepts::Real3d *(&e)[4], uint &ne)
TreeTraits03< Node > Traits
Interface for the algorithm.
Definition tree03.hh:47
CebyCenter(uint nvtx)
Definition tree03.hh:80
uint nclst() const
Number of clusters.
Definition tree03.hh:110
TreeTraits03< CNode > Traits
Interface of the tree.
Definition tree03.hh:96
uint nleaf() const
Number of leafs.
Definition tree03.hh:112
void sketch(std::ostream &os, const CNode *lnk=0, uint l=0)
const CNode * root() const
Root node of the tree.
Definition tree03.hh:114
Tree03(const concepts::Space< F > &spc, const BBall< F > &ball, uint nlfmin=1)
Node::CF F
Field of the node (Real or Cmplx)
Definition tree.hh:255
double Real
Definition typedefs.hh:39