LIBINT 2.7.2
dgarc.h
1/*
2 * Copyright (C) 2004-2021 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//#include <rr.h>
22#include <iostream>
23#include <smart_ptr.h>
24
25#ifndef _libint2_src_bin_libint_dgarc_h_
26#define _libint2_src_bin_libint_dgarc_h_
27
28namespace libint2 {
29
30 class RecurrenceRelation;
31 class DGVertex;
34 class DGArc {
35
36 SafePtr<DGVertex> orig_; // Where this Arc leavs
37 SafePtr<DGVertex> dest_; // Where this Arc leads to
38
39 public:
40 DGArc(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest);
41 virtual ~DGArc() {}
42
43 SafePtr<DGVertex> orig() const { return orig_; }
44 SafePtr<DGVertex> dest() const { return dest_; }
45
47 virtual void print(std::ostream& os) const =0;
48
49 };
50
53 class DGArcDirect : public DGArc {
54
55 public:
56 DGArcDirect(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest) : DGArc(orig,dest) {}
57 virtual ~DGArcDirect() {}
58
60 void print(std::ostream& os) const override
61 {
62 os << "DGArcDirect: connects " << orig().get() << " to " << dest().get();
63 }
64 };
65
68 class DGArcRR : public DGArc {
69
70 public:
71 virtual ~DGArcRR() {}
72
74 virtual SafePtr<RecurrenceRelation> rr() const =0;
75
76 protected:
77 DGArcRR(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest);
78
79 };
80
83 // NOTE TO SELF (11/24/2004): need to implement checks on ArcRel
84 // It obviously must implement some functions
85 template <class ArcRel> class DGArcRel : public DGArcRR {
86
87 SafePtr<ArcRel> rel_; // Relationship described by the arc
88
89 public:
90 DGArcRel(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest,
91 const SafePtr<ArcRel>& rel);
92 virtual ~DGArcRel();
93
95 SafePtr<RecurrenceRelation> rr() const override { return dynamic_pointer_cast<RecurrenceRelation,ArcRel>(rel_); }
97 void print(std::ostream& os) const override
98 {
99 os << "DGArcRel<T>: connects " << orig().get() << " to " << dest().get() << std::endl;
100 }
101
102 };
103
104 template <class ArcRel>
105 DGArcRel<ArcRel>::DGArcRel(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest,
106 const SafePtr<ArcRel>& rel) :
107 DGArcRR(orig,dest), rel_(rel)
108 {
109 };
110
111 template <class ArcRel>
112 DGArcRel<ArcRel>::~DGArcRel()
113 {
114 };
115
116};
117
118#endif
119
Class DGArcDirect describes arcs that does not correspond to any relationship.
Definition: dgarc.h:53
void print(std::ostream &os) const override
Overload of DGArc::print()
Definition: dgarc.h:60
Class DGArcRR describes arcs correspond to recurrence relations.
Definition: dgarc.h:68
virtual SafePtr< RecurrenceRelation > rr() const =0
rr() returns pointer to the RecurrenceRelation describing the arc
Class DGArcRel describes arcs in a directed graph which is represented by a relationship ArcRel.
Definition: dgarc.h:85
SafePtr< RecurrenceRelation > rr() const override
Implementation of DGArcRR::rr()
Definition: dgarc.h:95
void print(std::ostream &os) const override
Overload of DGArc::print()
Definition: dgarc.h:97
Class DGArc describes arcs in a directed graph.
Definition: dgarc.h:34
virtual void print(std::ostream &os) const =0
Print out the arc.
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24