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