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
217
SUMOReal
computeDeparts
(
ODCell
* cell,
218
size_t
& vehName, std::vector<ODVehicle>& into,
bool
uniform,
219
const
std::string& prefix);
220
221
237
void
applyCurve
(
const
Distribution_Points
& ps,
ODCell
* cell,
238
std::vector<ODCell*>& newCells);
239
240
241
protected
:
243
std::vector<ODCell*>
myContainer
;
244
246
const
ODDistrictCont
&
myDistricts
;
247
249
SUMOReal
myNoLoaded
;
250
252
SUMOReal
myNoWritten
;
253
255
SUMOReal
myNoDiscarded
;
256
257
262
class
cell_by_begin_sorter
{
263
public
:
265
explicit
cell_by_begin_sorter
() { }
266
267
278
int
operator()
(
ODCell
* p1,
ODCell
* p2)
const
{
279
if
(p1->
begin
== p2->
begin
) {
280
if
(p1->
origin
== p2->
origin
) {
281
return
p1->
destination
< p2->
destination
;
282
}
283
return
p1->
origin
< p2->
origin
;
284
}
285
return
p1->
begin
< p2->
begin
;
286
}
287
288
};
289
290
298
class
descending_departure_comperator
{
299
public
:
301
descending_departure_comperator
() { }
302
303
312
bool
operator()
(
const
ODVehicle
& p1,
const
ODVehicle
& p2)
const
{
313
if
(p1.
depart
== p2.
depart
) {
314
return
p1.
id
> p2.
id
;
315
}
316
return
p1.
depart
> p2.
depart
;
317
}
318
319
};
320
321
private
:
323
ODMatrix
(
const
ODMatrix
& s);
324
326
ODMatrix
&
operator=
(
const
ODMatrix
& s);
327
328
};
329
330
331
#endif
332
333
/****************************************************************************/
334
build
buildd
sumo-0.16.0~dfsg
src
od2trips
ODMatrix.h
Generated on Tue Apr 16 2013 01:32:19 for SUMO - Simulation of Urban MObility by
1.8.3.1