equal
deleted
inserted
replaced
11 This simple map assigns \f$\pi\f$ to each edge. |
11 This simple map assigns \f$\pi\f$ to each edge. |
12 |
12 |
13 \code |
13 \code |
14 class MyMap |
14 class MyMap |
15 { |
15 { |
16 double get(Graph::EdgeIt e) const { return M_PI;} |
|
17 }; |
|
18 \endcode |
|
19 |
|
20 Or if we accept the new map style, it will look like this: |
|
21 |
|
22 \code |
|
23 class MyMap |
|
24 { |
|
25 double operator[](Graph::EdgeIt e) const { return 1;} |
16 double operator[](Graph::EdgeIt e) const { return 1;} |
26 }; |
17 }; |
27 \endcode |
18 \endcode |
28 |
19 |
29 |
20 |
30 A more complex example |
21 Here is a more complex example. It provides a length function which is obtained |
|
22 from a base length function modified by a potential difference. |
|
23 \todo Please improve on the english. |
31 |
24 |
32 \code |
25 \code |
33 class MyLengthMap |
26 class MyLengthMap |
34 { |
27 { |
35 const Graph::EdgeMap &ol; |
28 const Graph::EdgeMap &ol; |
36 const Graph::NodeMap &pot; |
29 const Graph::NodeMap &pot; |
37 |
30 |
38 double get(Graph::EdgeIt e) const { return ol.get(e)-pot.get(v)-pot.get(u);} |
31 double operator[](Graph::EdgeIt e) const { |
|
32 return ol.get(e)-pot.get(v)-pot.get(u); |
|
33 } |
39 |
34 |
40 MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) : |
35 MyComplexMap(const Graph::EdgeMap &o,const Graph::NodeMap &p) : |
41 ol(o), pot(p); |
36 ol(o), pot(p); |
42 }; |
37 }; |
43 \endcode |
38 \endcode |