LIBINT 2.9.0
drtree.h
1/*
2 * Copyright (C) 2004-2024 Edward F. Valeev
3 *
4 * This file is part of Libint compiler.
5 *
6 * Libint compiler 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 compiler 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 compiler. 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
26namespace libint2 {
27
28class DGVertex;
29
31class DRTree : public std::enable_shared_from_this<DRTree> {
32 public:
33 typedef DRTree this_type;
34
36 static std::shared_ptr<DRTree> CreateRootedAt(
37 const std::shared_ptr<DGVertex>& v);
38 ~DRTree();
39
41 unsigned int nvertices() const { return nvertices_; }
43 const std::shared_ptr<DGVertex>& root() const;
45 void detach();
47 void add_vertex(const std::shared_ptr<DGVertex>& v);
49 void detach_from(const std::shared_ptr<DGVertex>& v);
50
51 private:
53 DRTree(const std::shared_ptr<DGVertex>& root);
55 void grow();
56
57 unsigned int nvertices_;
58 std::shared_ptr<DGVertex> root_;
59};
60
61} // namespace libint2
62
63#endif // ifndef
This is a directed rooted tree.
Definition drtree.h:31
void detach_from(const std::shared_ptr< DGVertex > &v)
recurively detach v from this
Definition drtree.cc:77
const std::shared_ptr< DGVertex > & root() const
the root of the tree
Definition drtree.cc:48
void detach()
remove all references from vertices to the tree and vice versa
Definition drtree.cc:75
unsigned int nvertices() const
number of vertices
Definition drtree.h:41
static std::shared_ptr< DRTree > CreateRootedAt(const std::shared_ptr< DGVertex > &v)
If v is not on a DRTree, make a new one using v as root.
Definition drtree.cc:28
void add_vertex(const std::shared_ptr< DGVertex > &v)
will try to add v to this subtree. Should not be used by the user
Definition drtree.cc:50
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24