RODFNet.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A DFROUTER-network
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef RODFNet_h
00020 #define RODFNet_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <router/RONet.h>
00033 #include <utils/options/OptionsCont.h>
00034 #include "RODFDetector.h"
00035 #include "RODFRouteDesc.h"
00036 #include "RODFRouteCont.h"
00037 #include <utils/common/StdDefs.h>
00038 #include <utils/common/SUMOTime.h>
00039 
00040 
00041 // ===========================================================================
00042 // class definitions
00043 // ===========================================================================
00048 class RODFNet : public RONet {
00049 public:
00053     RODFNet(bool amInHighwayMode) throw();
00054 
00055 
00057     ~RODFNet() throw();
00058 
00059 
00060     void buildApproachList();
00061 
00062     void computeTypes(RODFDetectorCon &dets,
00063                       bool sourcesStrict) const;
00064     void buildRoutes(RODFDetectorCon &det, bool allEndFollower,
00065                      bool keepUnfoundEnds, bool includeInBetween,
00066                      bool keepShortestOnly, int maxFollowingLength) const;
00067     SUMOReal getAbsPos(const RODFDetector &det) const;
00068 
00069     void buildEdgeFlowMap(const RODFDetectorFlows &flows,
00070                           const RODFDetectorCon &detectors,
00071                           SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
00072 
00073     void revalidateFlows(const RODFDetectorCon &detectors,
00074                          RODFDetectorFlows &flows,
00075                          SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
00076 
00077 
00078     void removeEmptyDetectors(RODFDetectorCon &detectors,
00079                               RODFDetectorFlows &flows,  SUMOTime startTime, SUMOTime endTime,
00080                               SUMOTime stepOffset);
00081 
00082     void reportEmptyDetectors(RODFDetectorCon &detectors,
00083                               RODFDetectorFlows &flows);
00084 
00085     void buildDetectorDependencies(RODFDetectorCon &detectors);
00086 
00087     void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows);
00088 
00089     bool hasDetector(ROEdge *edge) const;
00090     const std::vector<std::string> &getDetectorList(ROEdge *edge) const;
00091 
00092 
00093 protected:
00094     void revalidateFlows(const RODFDetector *detector,
00095                          RODFDetectorFlows &flows,
00096                          SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
00097     bool isSource(const RODFDetector &det,
00098                   const RODFDetectorCon &detectors, bool strict) const;
00099     bool isFalseSource(const RODFDetector &det,
00100                        const RODFDetectorCon &detectors) const;
00101     bool isDestination(const RODFDetector &det,
00102                        const RODFDetectorCon &detectors) const;
00103 
00104     ROEdge *getDetectorEdge(const RODFDetector &det) const;
00105     bool isSource(const RODFDetector &det, ROEdge *edge,
00106                   std::vector<ROEdge*> &seen, const RODFDetectorCon &detectors,
00107                   bool strict) const;
00108     bool isFalseSource(const RODFDetector &det, ROEdge *edge,
00109                        std::vector<ROEdge*> &seen, const RODFDetectorCon &detectors) const;
00110     bool isDestination(const RODFDetector &det, ROEdge *edge, std::vector<ROEdge*> &seen,
00111                        const RODFDetectorCon &detectors) const;
00112 
00113     void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no,
00114                           bool keepUnfoundEnds,
00115                           bool keepShortestOnly,
00116                           std::vector<ROEdge*> &visited, const RODFDetector &det,
00117                           RODFRouteCont &into, const RODFDetectorCon &detectors,
00118                           int maxFollowingLength,
00119                           std::vector<ROEdge*> &seen) const;
00120 
00121     void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const;
00122 
00123     bool hasApproaching(ROEdge *edge) const;
00124     bool hasApproached(ROEdge *edge) const;
00125 
00126     bool hasInBetweenDetectorsOnly(ROEdge *edge,
00127                                    const RODFDetectorCon &detectors) const;
00128     bool hasSourceDetector(ROEdge *edge,
00129                            const RODFDetectorCon &detectors) const;
00130 
00131     struct IterationEdge {
00132         int depth;
00133         ROEdge *edge;
00134     };
00135 
00136 protected:
00137     class DFRouteDescByTimeComperator {
00138     public:
00140         explicit DFRouteDescByTimeComperator() { }
00141 
00143         ~DFRouteDescByTimeComperator() { }
00144 
00146         bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const {
00147             return nod1.duration_2>nod2.duration_2;
00148         }
00149     };
00150 
00151 private:
00153     std::map<ROEdge*, std::vector<ROEdge*> > myApproachingEdges;
00154 
00156     std::map<ROEdge*, std::vector<ROEdge*> > myApproachedEdges;
00157 
00158     mutable std::map<ROEdge*, std::vector<std::string> > myDetectorsOnEdges;
00159     mutable std::map<std::string, ROEdge*> myDetectorEdges;
00160 
00161     bool myAmInHighwayMode;
00162     mutable size_t mySourceNumber, mySinkNumber, myInBetweenNumber, myInvalidNumber;
00163 
00165     std::vector<std::string> myDisallowedEdges;
00166 
00167 
00168     bool myKeepTurnarounds;
00169 
00170 };
00171 
00172 
00173 #endif
00174 
00175 /****************************************************************************/
00176 

Generated on Wed May 5 00:06:36 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6