SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RODFNet.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A DFROUTER-network
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef RODFNet_h
23 #define RODFNet_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <router/RONet.h>
37 #include "RODFDetector.h"
38 #include "RODFRouteDesc.h"
39 #include "RODFRouteCont.h"
40 #include <utils/common/StdDefs.h>
41 #include <utils/common/SUMOTime.h>
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class RODFNet : public RONet {
52 public:
56  RODFNet(bool amInHighwayMode);
57 
58 
60  ~RODFNet();
61 
62 
63  void buildApproachList();
64 
65  void computeTypes(RODFDetectorCon& dets,
66  bool sourcesStrict) const;
67  void buildRoutes(RODFDetectorCon& det, bool allEndFollower,
68  bool keepUnfoundEnds, bool includeInBetween,
69  bool keepShortestOnly, int maxFollowingLength) const;
70  SUMOReal getAbsPos(const RODFDetector& det) const;
71 
72  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
73  const RODFDetectorCon& detectors,
74  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
75 
76  void revalidateFlows(const RODFDetectorCon& detectors,
77  RODFDetectorFlows& flows,
78  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
79 
80 
81  void removeEmptyDetectors(RODFDetectorCon& detectors,
82  RODFDetectorFlows& flows);
83 
84  void reportEmptyDetectors(RODFDetectorCon& detectors,
85  RODFDetectorFlows& flows);
86 
88 
89  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
90 
91  bool hasDetector(ROEdge* edge) const;
92  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
93 
94 
95 protected:
96  void revalidateFlows(const RODFDetector* detector,
97  RODFDetectorFlows& flows,
98  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
99  bool isSource(const RODFDetector& det,
100  const RODFDetectorCon& detectors, bool strict) const;
101  bool isFalseSource(const RODFDetector& det,
102  const RODFDetectorCon& detectors) const;
103  bool isDestination(const RODFDetector& det,
104  const RODFDetectorCon& detectors) const;
105 
106  ROEdge* getDetectorEdge(const RODFDetector& det) const;
107  bool isSource(const RODFDetector& det, ROEdge* edge,
108  std::vector<ROEdge*>& seen, const RODFDetectorCon& detectors,
109  bool strict) const;
110  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
111  std::vector<ROEdge*>& seen, const RODFDetectorCon& detectors) const;
112  bool isDestination(const RODFDetector& det, ROEdge* edge, std::vector<ROEdge*>& seen,
113  const RODFDetectorCon& detectors) const;
114 
115  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
116  bool keepUnfoundEnds,
117  bool keepShortestOnly,
118  std::vector<ROEdge*>& visited, const RODFDetector& det,
119  RODFRouteCont& into, const RODFDetectorCon& detectors,
120  int maxFollowingLength,
121  std::vector<ROEdge*>& seen) const;
122 
124 
125  bool hasApproaching(ROEdge* edge) const;
126  bool hasApproached(ROEdge* edge) const;
127 
129  const RODFDetectorCon& detectors) const;
130  bool hasSourceDetector(ROEdge* edge,
131  const RODFDetectorCon& detectors) const;
132 
133  struct IterationEdge {
134  int depth;
136  };
137 
138 protected:
140  public:
143 
146 
148  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
149  return nod1.duration_2 > nod2.duration_2;
150  }
151  };
152 
153 private:
155  struct idComp {
156  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
157  return lhs->getID() < rhs->getID();
158  }
159  };
160 
162  std::map<ROEdge*, std::vector<ROEdge*> > myApproachingEdges;
163 
165  std::map<ROEdge*, std::vector<ROEdge*> > myApproachedEdges;
166 
167  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
168  mutable std::map<std::string, ROEdge*> myDetectorEdges;
169 
172 
174  std::vector<std::string> myDisallowedEdges;
175 
176 
178 
179 };
180 
181 
182 #endif
183 
184 /****************************************************************************/
185