Eclipse SUMO - Simulation of Urban MObility
FareZones.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Fare Modul for calculating prices during intermodal routing
16 /****************************************************************************/
17 
18 #ifndef SUMO_FAREZONES_H
19 #define SUMO_FAREZONES_H
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <unordered_map>
27 #include <cstdint>
28 
29 static std::unordered_map<long long int, int> repToFareZone = std::unordered_map<long long int, int> {
30  {1, 110},
31  {2, 121},
32  {4, 122},
33  {8, 123},
34  {16, 124},
35  {32, 125},
36  {64, 126},
37  {128, 127},
38  {256, 128},
39  {512, 129},
40  {1024, 131},
41  {2048, 132},
42  {4096, 133},
43  {8192, 134},
44  {16384, 141},
45  {32768, 142},
46  {65536, 143},
47  {131072, 144},
48  {262144, 145},
49  {524288, 146},
50  {1048576, 147},
51  {2097152, 151},
52  {4194304, 152},
53  {8388608, 153},
54  {16777216, 154},
55  {33554432, 155},
56  {67108864, 156},
57  {134217728, 162},
58  {268435456, 163},
59  {536870912, 164},
60  {1073741824, 165},
61  {2147483648, 166},
62  {4294967296, 167},
63  {8589934592, 168},
64  {17179869184, 210},
65  {34359738368, 221},
66  {68719476736, 222},
67  {137438953472, 223},
68  {274877906944, 224},
69  {549755813888, 225},
70  {1099511627776, 231},
71  {2199023255552, 232},
72  {4398046511104, 233},
73  {8796093022208, 234},
74  {17592186044416, 241},
75  {35184372088832, 242},
76  {70368744177664, 243},
77  {140737488355328, 251},
78  {281474976710656, 252},
79  {562949953421312, 253},
80  {1125899906842624, 254},
81  {2251799813685248, 255},
82  {4503599627370496, 256},
83  {9007199254740992, 257},
84  {18014398509481984, 258},
85  {36028797018963968, 259},
86  {72057594037927936, 261},
87  {144115188075855872, 299},
88  {288230376151711744, 321},
89  {576460752303423488, 322},
90  {1152921504606846976, 323},
91  {2305843009213693952, 324}
92 };
93 
94 static std::unordered_map<int, long long int> fareZoneToRep = std::unordered_map<int, long long int > {
95  {110, 1 },
96  {121, 2 },
97  {122, 4 },
98  {123, 8 },
99  {124, 16 },
100  {125, 32 },
101  {126, 64 },
102  {127, 128 },
103  {128, 256 },
104  {129, 512 },
105  {131, 1024 },
106  {132, 2048 },
107  {133, 4096 },
108  {134, 8192 },
109  {141, 16384 },
110  {142, 32768 },
111  {143, 65536 },
112  {144, 131072 },
113  {145, 262144 },
114  {146, 524288 },
115  {147, 1048576 },
116  {151, 2097152 },
117  {152, 4194304 },
118  {153, 8388608 },
119  {154, 16777216 },
120  {155, 33554432 },
121  {156, 67108864 },
122  {162, 134217728 },
123  {163, 268435456 },
124  {164, 536870912 },
125  {165, 1073741824 },
126  {166, 2147483648 },
127  {167, 4294967296 },
128  {168, 8589934592 },
129  {210, 17179869184 },
130  {221, 34359738368 },
131  {222, 68719476736 },
132  {223, 137438953472 },
133  {224, 274877906944 },
134  {225, 549755813888 },
135  {231, 1099511627776 },
136  {232, 2199023255552 },
137  {233, 4398046511104 },
138  {234, 8796093022208 },
139  {241, 17592186044416 },
140  {242, 35184372088832 },
141  {243, 70368744177664 },
142  {251, 140737488355328 },
143  {252, 281474976710656 },
144  {253, 562949953421312 },
145  {254, 1125899906842624 },
146  {255, 2251799813685248 },
147  {256, 4503599627370496 },
148  {257, 9007199254740992 },
149  {258, 18014398509481984 },
150  {259, 36028797018963968 },
151  {261, 72057594037927936 },
152  {299, 144115188075855872 },
153  {321, 288230376151711744 },
154  {322, 576460752303423488 },
155  {323, 1152921504606846976 },
156  {324, 2305843009213693952 }
157 };
158 
164 inline int getOverlayZone(int zoneNumber) {
165  if (zoneNumber < 400) {
166  return zoneNumber; //real "zone" numbers, no city zones
167  }
168 
169  switch (zoneNumber) {
170  case 511:
171  return 165;
172  case 512:
173  return 166;
174  case 513:
175  return 167;
176  case 514:
177  return 142;
178  case 515:
179  return 123;
180  case 516:
181  return 127;
182  case 518:
183  return 145;
184  case 519:
185  return 144;
186  case 521:
187  return 153;
188  case 551:
189  return 231;
190  case 552:
191  return 232;
192  case 553:
193  return 233;
194  case 554:
195  return 259;
196  case 555:
197  return 241;
198  case 556:
199  return 255;
200  case 571:
201  return 322;
202  case 572:
203  return 324;
204  default:
205  return zoneNumber;
206  }
207 }
208 
209 #endif //SUMO_FAREZONES_H
fareZoneToRep
static std::unordered_map< int, long long int > fareZoneToRep
Definition: FareZones.h:94
getOverlayZone
int getOverlayZone(int zoneNumber)
Definition: FareZones.h:164
repToFareZone
static std::unordered_map< long long int, int > repToFareZone
Definition: FareZones.h:29
config.h