LIBINT  2.1.0-stable
dgarc.h
1 /*
2  * This file is a part of Libint.
3  * Copyright (C) 2004-2014 Edward F. Valeev
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see http://www.gnu.org/licenses/.
17  *
18  */
19 
20 //#include <rr.h>
21 #include <iostream>
22 #include <smart_ptr.h>
23 
24 #ifndef _libint2_src_bin_libint_dgarc_h_
25 #define _libint2_src_bin_libint_dgarc_h_
26 
27 namespace libint2 {
28 
29  class RecurrenceRelation;
30  class DGVertex;
33  class DGArc {
34 
35  SafePtr<DGVertex> orig_; // Where this Arc leavs
36  SafePtr<DGVertex> dest_; // Where this Arc leads to
37 
38  public:
39  DGArc(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest);
40  virtual ~DGArc() {}
41 
42  SafePtr<DGVertex> orig() const { return orig_; }
43  SafePtr<DGVertex> dest() const { return dest_; }
44 
46  virtual void print(std::ostream& os) const =0;
47 
48  };
49 
52  class DGArcDirect : public DGArc {
53 
54  public:
55  DGArcDirect(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest) : DGArc(orig,dest) {}
56  virtual ~DGArcDirect() {}
57 
59  void print(std::ostream& os) const
60  {
61  os << "DGArcDirect: connects " << orig().get() << " to " << dest().get();
62  }
63  };
64 
67  class DGArcRR : public DGArc {
68 
69  public:
70  virtual ~DGArcRR() {}
71 
73  virtual SafePtr<RecurrenceRelation> rr() const =0;
74 
75  protected:
76  DGArcRR(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest);
77 
78  };
79 
82  // NOTE TO SELF (11/24/2004): need to implement checks on ArcRel
83  // It obviously must implement some functions
84  template <class ArcRel> class DGArcRel : public DGArcRR {
85 
86  SafePtr<ArcRel> rel_; // Relationship described by the arc
87 
88  public:
89  DGArcRel(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest,
90  const SafePtr<ArcRel>& rel);
91  virtual ~DGArcRel();
92 
94  SafePtr<RecurrenceRelation> rr() const { return dynamic_pointer_cast<RecurrenceRelation,ArcRel>(rel_); }
96  void print(std::ostream& os) const
97  {
98  os << "DGArcRel<T>: connects " << orig().get() << " to " << dest().get() << std::endl;
99  }
100 
101  };
102 
103  template <class ArcRel>
104  DGArcRel<ArcRel>::DGArcRel(const SafePtr<DGVertex>& orig, const SafePtr<DGVertex>& dest,
105  const SafePtr<ArcRel>& rel) :
106  DGArcRR(orig,dest), rel_(rel)
107  {
108  };
109 
110  template <class ArcRel>
112  {
113  };
114 
115 };
116 
117 #endif
118 
virtual void print(std::ostream &os) const =0
Print out the arc.
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23
Class DGArcRR describes arcs correspond to recurrence relations.
Definition: dgarc.h:67
Class DGArc describes arcs in a directed graph.
Definition: dgarc.h:33
RecurrenceRelation describes all recurrence relations.
Definition: rr.h:100
SafePtr< RecurrenceRelation > rr() const
Implementation of DGArcRR::rr()
Definition: dgarc.h:94
Class DGArcRel describes arcs in a directed graph which is represented by a relationship ArcRel...
Definition: dg.h:43
Class DGArcDirect describes arcs that does not correspond to any relationship.
Definition: dgarc.h:52
void print(std::ostream &os) const
Overload of DGArc::print()
Definition: dgarc.h:59
void print(std::ostream &os) const
Overload of DGArc::print()
Definition: dgarc.h:96