SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ODMatrix.h
Go to the documentation of this file.
1
/****************************************************************************/
8
// An O/D (origin/destination) matrix
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
11
// Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
#ifndef ODMatrix_h
22
#define ODMatrix_h
23
24
25
// ===========================================================================
26
// included modules
27
// ===========================================================================
28
#ifdef _MSC_VER
29
#include <
windows_config.h
>
30
#else
31
#include <
config.h
>
32
#endif
33
34
#include <iostream>
35
#include <sstream>
36
#include <fstream>
37
#include <vector>
38
#include <cstdlib>
39
#include <ctime>
40
#include <algorithm>
41
#include <string>
42
#include <
utils/common/SUMOTime.h
>
43
#include "
ODCell.h
"
44
#include "
ODDistrictCont.h
"
45
#include <
utils/distribution/Distribution_Points.h
>
46
47
48
// ===========================================================================
49
// class declarations
50
// ===========================================================================
51
class
OutputDevice
;
52
53
54
// ===========================================================================
55
// class definitions
56
// ===========================================================================
72
class
ODMatrix
{
73
public
:
78
ODMatrix
(
const
ODDistrictCont
& dc) ;
79
80
82
~ODMatrix
() ;
83
84
106
void
add
(
SUMOReal
vehicleNumber,
SUMOTime
begin,
107
SUMOTime
end,
const
std::string& origin,
const
std::string& destination,
108
const
std::string& vehicleType) ;
109
110
135
void
write
(
SUMOTime
begin,
SUMOTime
end,
136
OutputDevice
& dev,
bool
uniform,
bool
noVtype,
137
const
std::string& prefix,
bool
stepLog) ;
138
139
146
SUMOReal
getNoLoaded
()
const
;
147
148
155
SUMOReal
getNoWritten
()
const
;
156
157
164
SUMOReal
getNoDiscarded
()
const
;
165
166
170
void
applyCurve
(
const
Distribution_Points
& ps) ;
171
172
173
protected
:
178
struct
ODVehicle
{
180
std::string
id
;
182
SUMOTime
depart
;
184
ODCell
*
cell
;
186
std::string
from
;
188
std::string
to
;
189
190
};
191
192
194
typedef
std::vector<ODCell*>
CellVector
;
195
196
221
SUMOReal
computeDeparts
(
ODCell
* cell,
222
size_t
& vehName, std::vector<ODVehicle> &into,
bool
uniform,
223
const
std::string& prefix) ;
224
225
241
void
applyCurve
(
const
Distribution_Points
& ps,
ODCell
* cell,
242
CellVector
& newCells) ;
243
244
245
protected
:
247
CellVector
myContainer
;
248
250
const
ODDistrictCont
&
myDistricts
;
251
253
SUMOReal
myNoLoaded
;
254
256
SUMOReal
myNoWritten
;
257
259
SUMOReal
myNoDiscarded
;
260
261
266
class
cell_by_begin_sorter
{
267
public
:
269
explicit
cell_by_begin_sorter
() { }
270
271
282
int
operator()
(
ODCell
* p1,
ODCell
* p2)
const
{
283
if
(p1->
begin
== p2->
begin
) {
284
if
(p1->
origin
== p2->
origin
) {
285
return
p1->
destination
< p2->
destination
;
286
}
287
return
p1->
origin
< p2->
origin
;
288
}
289
return
p1->
begin
< p2->
begin
;
290
}
291
292
};
293
294
302
class
descending_departure_comperator
{
303
public
:
305
descending_departure_comperator
() { }
306
307
316
bool
operator()
(
const
ODVehicle
& p1,
const
ODVehicle
& p2)
const
{
317
if
(p1.
depart
== p2.
depart
) {
318
return
p1.
id
> p2.
id
;
319
}
320
return
p1.
depart
> p2.
depart
;
321
}
322
323
};
324
325
private
:
327
ODMatrix
(
const
ODMatrix
& s);
328
330
ODMatrix
&
operator=
(
const
ODMatrix
& s);
331
332
};
333
334
335
#endif
336
337
/****************************************************************************/
338
tmp
buildd
sumo-0.15.0~dfsg
src
od2trips
ODMatrix.h
Generated on Sun May 27 2012 14:52:09 for SUMO - Simulation of Urban MObility by
1.8.1