Class documentation of Concepts

Loading...
Searching...
No Matches
spaceGraph.hh
Go to the documentation of this file.
1
7#ifndef space_graph_hh
8#define space_graph_hh
9
10#include "space/space.hh"
11#include "toolbox/graph.hh"
12
13namespace concepts
14{
15
16 // ********************************************************* SpaceGraph<F> **
17 template<class F>
19 {
20 protected:
21 typedef typename F::type type;
22 typedef typename F::type::type t_type;
23 Graph<type*> graph_;
24 public:
25 virtual void FillGraph(const F & spc, const int power=2, const bool verbose=false);
26 virtual Graph<typename F::type*> getGraph() const;
27 virtual void SplitGraph(const int nPparts);
28 virtual Sequence<typename F::type*> getSubDomain(const int Part) const;
29 virtual Sequence<bool> getSubDomainBool(const int Part) const;
30
31 SpaceGraph(const F & spc, const int power=2, const bool verbose=false)
32 {
33 this->graph_.EmptyGraph();
34 this->FillGraph(spc, power, verbose);
35 };
36
37 SpaceGraph(const std::unique_ptr<F> p_spc, const int power=2, const bool verbose=false)
38 {
39 this->graph_.EmptyGraph();
40 this->FillGraph(*p_spc, power, verbose);
41 };
42
43 SpaceGraph(const F* p_spc, const int power=2, const bool verbose=false)
44 {
45 this->graph_.EmptyGraph();
46 this->FillGraph(*p_spc, power, verbose);
47 };
48
49 SpaceGraph() {};
50 };
51
52 template<class F>
53 void SpaceGraph<F>::FillGraph(const F & spc, const int power, const bool verbose)
54 {
55 this->graph_.EmptyGraph();
56
57 std::unique_ptr<typename F::Scanner> sc(spc.scan());
58 while(*sc)
59 {
60 type & elm = (*sc)++;
61 int Weight = 1, BaseWeight = elm.T().n();
62 for (int i=0; i < power; i++)
64
65 this->graph_.addVertex(&elm, Weight);
66
67 DEBUGL(verbose, "Added vertex at address " << &elm << " of weight " << Weight << " to this graph");
68 }
69 }
70
71 template<class F>
72 Graph<typename F::type*> SpaceGraph<F>::getGraph() const
73 {
74 return this->graph_;
75 }
76
77 template<class F>
78 void SpaceGraph<F>::SplitGraph(const int nbParts)
79 {
80 this->graph_.SetSubdomains(nbParts);
81 }
82
83 template<class F>
84 Sequence<typename F::type*> SpaceGraph<F>::getSubDomain(const int Part) const
85 {
86 return this->graph_.GetSubdomain(Part);
87 }
88
89 template<class F>
90 Sequence<bool> SpaceGraph<F>::getSubDomainBool(const int Part) const
91 {
92 return this->graph_.GetSubdomainBool(Part);
93 }
94
95}
96
97
98#endif // space_graph_hh
#define DEBUGL(doit, msg)
Definition debug.hh:40
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320