connectorSet.hh

Go to the documentation of this file.
1 
6 #ifndef ConnectorSet_hh
7 #define ConnectorSet_hh
8 
9 #include "connector.hh"
10 #include "toolbox/set.hh"
11 
12 namespace concepts {
13 
14  // ******************************************************** Set<Attribute> **
15 
16  template<>
17  class Set<Attribute> : public BaseSet<Attribute> {
18  public:
20  Set() : BaseSet<Attribute>() {}
22  Set(const Set<uint>& set) : BaseSet<Attribute>() {
23  for(Set<uint>::const_iterator i = set.begin(); i != set.end();)
24  this->insert(*i++);
25  }
31  Set(const std::string& str) : BaseSet<Attribute>() {
32  *this = Set<uint>(str);
33  }
35  Set(const Attribute& attr) : BaseSet<Attribute>() { insert(attr); }
37  Set(const uint attr) : BaseSet<Attribute>() { insert(Attribute(attr)); }
38  virtual ~Set() {}
39  };
40 
41  // ******************************************************* Set<const Key*> **
42 
43  template<>
44  class Set<const Key*> : public BaseSet<const Key*> {
45  public:
46  Set() : BaseSet<const Key*>() {}
47  template<class F>
48  Set(const F& set) : BaseSet<const Key*>(set) {}
49  virtual ~Set() {}
50 
51  Set<uint> key() const;
52  };
53 
54  // ************************************************* Set<const Connector*> **
55 
56  template<>
57  class Set<const Connector*> : public BaseSet<const Connector*> {
58  public:
59  Set() : BaseSet<const Connector*>() {}
60  template<class F>
61  Set(const F& set) : BaseSet<const Connector*>(set) {}
62  virtual ~Set() {}
63 
65  };
66 
67  // ******************************************************* Set<Connector*> **
68 
69  template<>
70  class Set<Connector*> : public BaseSet<Connector*> {
71  public:
72  Set() : BaseSet<Connector*>() {}
73  template<class F>
74  Set(const F& set) : BaseSet<Connector*>(set) {}
75  virtual ~Set() {}
76 
78  };
79 
80  // ************************************************ Set<const Connector0*> **
81 
82  template<>
83  class Set<const Connector0*> : public BaseSet<const Connector0*> {
84  public:
85  Set() : BaseSet<const Connector0*>() {}
86  template<class F>
87  Set(const F& set) : BaseSet<const Connector0*>(set) {}
88 // virtual ~Set() {}
89 
91  };
92 
93  // ****************************************************** Set<Connector0*> **
94 
95  template<>
96  class Set<Connector0*> : public BaseSet<Connector0*> {
97  public:
98  Set() : BaseSet<Connector0*>() {}
99  template<class F>
100  Set(const F& set) : BaseSet<Connector0*>(set) {}
101 // virtual ~Set() {}
102 
104  };
105 
106  // ************************************************ Set<const Connector1*> **
107 
108  template<>
109  class Set<const Connector1*> : public BaseSet<const Connector1*> {
110  public:
111  Set() : BaseSet<const Connector1*>() {}
112  template<class F>
113  Set(const F& set) : BaseSet<const Connector1*>(set) {}
114  virtual ~Set() {}
115 
117  Set<Connector0*> vertex(uint i) const;
119  };
120 
121  // ****************************************************** Set<Connector1*> **
122 
123  template<>
125  public:
126  Set() : BaseSet<Connector1*>() {}
127  template<class F>
128  Set(const F& set) : BaseSet<Connector1*>(set) {}
129  virtual ~Set() {}
130 
132  Set<Connector0*> vertex(uint i) const;
134  };
135 
136  // ************************************************ Set<const Connector2*> **
137 
138  template<>
139  class Set<const Connector2*> : public BaseSet<const Connector2*> {
140  public:
141  Set() : BaseSet<const Connector2*>() {}
142  template<class F>
143  Set(const F& set) : BaseSet<const Connector2*>(set) {}
144  virtual ~Set() {}
145 
147  Set<Connector0*> vertex(uint i) const;
148  Set<Connector1*> edge(uint i) const;
150  };
151 
152  // ****************************************************** Set<Connector2*> **
153 
154  template<>
156  public:
157  Set() : BaseSet<Connector2*>() {}
158  template<class F>
159  Set(const F& set) : BaseSet<Connector2*>(set) {}
160  virtual ~Set() {}
161 
163  Set<Connector0*> vertex(uint i) const;
164  Set<Connector1*> edge(uint i) const;
166  };
167 
168  // ********************************************************* allConnectors **
169 
176  template<class F, class G>
177  void allConnectors(const F& cntr, G* (F::*fun)(uint) const, Set<G*>& set) {
178  G* cntri; // connectors inside cntr
179  uint i = 0;
180  while ((cntri = (cntr.*fun)(i++)) != 0) set.insert(cntri);
181  }
182 
183 } // namespace concepts
184 
185 #endif // ConnectorSet_hh
186 
Sequence< G * > allConnectors(const F &cntr, G *(F::*fun)(uint) const)
Return all connectors of a particular type of another connector, e.g.
Set(const Attribute &attr)
Constructor for a single attribute.
Definition: connectorSet.hh:35
Set< Connector0 * > vertex(uint i) const
Set< const Key * > key() const
Set()
Default constructor.
Definition: connectorSet.hh:20
Set< const Connector2 * > child(uint i) const
Set with operations, output operator, and method of the particular element types.
Definition: traces.hh:18
Set< Connector0 * > vertex(uint i) const
Set< const Connector1 * > child(uint i) const
Set< const Key * > key() const
Set< Connector1 * > edge(uint i) const
Set< Connector1 * > edge(uint i) const
Set(const std::string &str)
Constructor, set is defined by a string.
Definition: connectorSet.hh:31
Set< const Key * > key() const
Set< const Key * > key() const
Set< Connector0 * > vertex(uint i) const
A 2D element of the topology.
Definition: connector.hh:226
Set with operations and output operator.
Definition: set.hh:28
Set< Connector0 * > vertex(uint i) const
Set< const Connector2 * > child(uint i) const
Set(const Set< uint > &set)
Constructor if a set of unsigned integer is given.
Definition: connectorSet.hh:22
Set< const Key * > key() const
A 1D element of the topology.
Definition: connector.hh:182
Set< const Key * > key() const
Set< const Connector1 * > child(uint i) const
Key class.
Definition: connector.hh:53
Set< const Key * > key() const
Set< const Key * > key() const
Attributes for elements of the topology.
Definition: connector.hh:22
An abstract class for elements of the topology.
Definition: connector.hh:85
A 0D element of the topology.
Definition: connector.hh:147
Set< uint > key() const
Set(const uint attr)
Constructor for a single attribute.
Definition: connectorSet.hh:37
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich