LIBINT  2.6.0
drtree.h
1 /*
2  * Copyright (C) 2004-2019 Edward F. Valeev
3  *
4  * This file is part of Libint.
5  *
6  * Libint is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Libint is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Libint. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef _libint2_src_bin_libint_drtree_h_
22 #define _libint2_src_bin_libint_drtree_h_
23 
24 #include <smart_ptr.h>
25 
26 namespace libint2 {
27 
28  class DGVertex;
29 
31  class DRTree :
32  public EnableSafePtrFromThis<DRTree>
33  {
34  public:
35  typedef DRTree this_type;
36 
38  static SafePtr<DRTree> CreateRootedAt(const SafePtr<DGVertex>& v);
39  ~DRTree();
40 
42  unsigned int nvertices() const { return nvertices_; }
44  const SafePtr<DGVertex>& root() const;
46  void detach();
48  void add_vertex(const SafePtr<DGVertex>& v);
50  void detach_from(const SafePtr<DGVertex>& v);
51 
52  private:
54  DRTree(const SafePtr<DGVertex>& root);
56  void grow();
57 
58  unsigned int nvertices_;
59  SafePtr<DGVertex> root_;
60  };
61 
62 }
63 
64 #endif // ifndef
65 
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
const SafePtr< DGVertex > & root() const
the root of the tree
Definition: drtree.cc:59
unsigned int nvertices() const
number of vertices
Definition: drtree.h:42
void detach()
remove all references from vertices to the tree and vice versa
Definition: drtree.cc:89
static SafePtr< DRTree > CreateRootedAt(const SafePtr< DGVertex > &v)
If v is not on a DRTree, make a new one using v as root.
Definition: drtree.cc:29
void add_vertex(const SafePtr< DGVertex > &v)
will try to add v to this subtree. Should not be used by the user
Definition: drtree.cc:65
void detach_from(const SafePtr< DGVertex > &v)
recurively detach v from this
Definition: drtree.cc:95
This is a directed rooted tree.
Definition: drtree.h:31