tree01.hh

Go to the documentation of this file.
1 
6 #ifndef clusterTree01_hh
7 #define clusterTree01_hh
8 
9 #include "cluster/tree.hh"
10 
11 namespace cluster {
12 
13  // ********************************************************** TreeTraits01 **
14 
19  template<class Node>
20  class TreeTraits01 : public TreeTraits<Node> {
21  public:
22  typedef typename TreeTraits<Node>::F F;
23 
24  static Node* newNode(const concepts::Element<F>& elm, const BBall<F>& ball,
25  Node* lnk) {return new Node(elm, ball, lnk);}
26  static Node* newNode(uint idx, Node& chld, const concepts::Real3d& c,
27  concepts::Real r, uint nlf = 0) {
28  return new Node(idx, chld, c, r, nlf);
29  }
30 
31  static Node* child(const Node* nd) {return nd->child();}
32  static Node* link(const Node* nd) {return nd->link();}
33  static Node*& link(Node* nd) {return nd->link();}
34  };
35 
36  // **************************************************************** Tree01 **
37 
43  template<class CNode>
44  class Tree01 : public Tree<CNode> {
45  public:
48  typedef typename Traits::F F;
49 
55  Tree01(const concepts::Space<F>& spc, const BBall<F>& ball,
56  uint nlfmin = 1);
57  inline ~Tree01() {destructor_(root_); delete root_;}
58 
60  inline uint nclst() const {return nclst_;}
62  inline uint nleaf() const {return nlf_;}
64  inline const CNode* root() const {return root_;}
65 
71  void sketch(std::ostream& os, const CNode* lnk = 0, uint l = 0);
72 
73  private:
75  uint nlfmin_;
77  uint nlf_;
79  uint nclst_;
81  CNode* root_;
82 
84  CNode* constructor_(CNode* lfset);
86  void destructor_(CNode* clst);
88  CNode* concat_(CNode* a, CNode* b);
89  };
90 
91 } // namespace cluster
92 
93 #endif // clusterTree01_hh
An abstract class for an element of a space.
Definition: exceptions.hh:15
CNode * constructor_(CNode *lfset)
Constructor used for recursive calls.
Traits::F F
Definition: tree01.hh:48
uint nclst() const
Number of clusters.
Definition: tree01.hh:60
Abstract class for a space.
const CNode * root() const
Root node of the tree.
Definition: tree01.hh:64
CNode * concat_(CNode *a, CNode *b)
Concats two lists.
TreeTraits01< CNode > Traits
Interface of the tree.
Definition: tree01.hh:47
static Node * newNode(uint idx, Node &chld, const concepts::Real3d &c, concepts::Real r, uint nlf=0)
Definition: tree01.hh:26
Tree01(const concepts::Space< F > &spc, const BBall< F > &ball, uint nlfmin=1)
Constructor.
static Node * newNode(const concepts::Element< F > &elm, const BBall< F > &ball, Node *lnk)
Definition: tree01.hh:24
Interface class for a node in a cluster tree.
Definition: tree.hh:252
static Node *& link(Node *nd)
Definition: tree01.hh:33
TreeTraits< Node >::F F
Definition: tree01.hh:22
Abstract class to compute a bounding ball of an element (the leafs of a cluster tree).
Definition: tree.hh:36
void sketch(std::ostream &os, const CNode *lnk=0, uint l=0)
Sketch of a subtree.
Cluster tree.
Definition: tree01.hh:44
Node::CF F
Field of the node (Real or Cmplx)
Definition: tree.hh:255
Abstract class for a cluster tree.
Definition: tree.hh:274
uint nlf_
Number of leafs in the tree.
Definition: tree01.hh:77
static Node * link(const Node *nd)
Definition: tree01.hh:32
Used for the cluster classes for the boundary element method.
Definition: cebysev.hh:13
Interface class for a node in the cluster tree Tree01.
Definition: tree01.hh:20
uint nclst_
Number of clusters in the tree.
Definition: tree01.hh:79
uint nlfmin_
Minimal leafs contained in a cluster.
Definition: tree01.hh:75
CNode * root_
Root of the cluster tree.
Definition: tree01.hh:81
uint nleaf() const
Number of leafs.
Definition: tree01.hh:62
static Node * child(const Node *nd)
Definition: tree01.hh:31
void destructor_(CNode *clst)
Destructor used for recursive calls.
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich