Merged for loop changes pulled down from upstream

This commit is contained in:
Sasa Ivetic 2011-10-05 11:19:50 -05:00
commit 5132c84dfa
4 changed files with 24 additions and 40 deletions

View File

@ -171,7 +171,7 @@ private:
cout << "Scanning for useless shortcuts" << endl;
BuildOutgoingGraph();
#pragma omp parallel for
for ( int i = 0; i < _graph.size(); i++ ) {
for ( int i = 0; i < ( int ) _graph.size(); i++ ) {
for ( unsigned edge = _firstEdge[_graph[i].source]; edge < _firstEdge[_graph[i].source + 1]; ++edge ) {
if ( edge == i )
continue;

View File

@ -23,7 +23,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include <climits>
#include <string>
#include "HashTable.h"
#include <boost/unordered_map.hpp>
#include "Util.h"
struct _PathData {
@ -31,24 +31,7 @@ struct _PathData {
NodeID node;
};
/* Default Speed Profile:
motorway 110
motorway_link 90
trunk 90
trunk_link 70
primary 70
primary_link 60
secondary 60
secondary_link 50
tertiary 55
unclassified 25
residential 40
living_street 10
service 30
ferry 5
*/
typedef google::dense_hash_map<std::string, NodeID> StringMap;
typedef boost::unordered_map<std::string, NodeID> StringMap;
struct _Node : NodeInfo{
_Node(int _lat, int _lon, unsigned int _id) : NodeInfo(_lat, _lon, _id) {}
@ -88,7 +71,7 @@ struct _Way {
_Way() : id(UINT_MAX), nameID(UINT_MAX) {
direction = _Way::notSure;
maximumSpeed = -1;
speed = -1;
type = -1;
useful = false;
access = true;
@ -100,7 +83,7 @@ struct _Way {
unsigned id;
unsigned nameID;
std::string name;
double maximumSpeed;
double speed;
short type;
bool useful:1;
bool access:1;
@ -140,6 +123,7 @@ struct _Edge {
_Edge() : start(0), target(0), type(0), direction(0), speed(0), nameID(0) {};
_Edge(NodeID s, NodeID t) : start(s), target(t), type(0), direction(0), speed(0), nameID(0) { }
_Edge(NodeID s, NodeID t, short tp, short d, double sp): start(s), target(t), type(tp), direction(d), speed(sp), nameID(0) { }
_Edge(NodeID s, NodeID t, short tp, short d, double sp, unsigned nid): start(s), target(t), type(tp), direction(d), speed(sp), nameID(nid) { }
NodeID start;
NodeID target;
short type;
@ -174,7 +158,6 @@ struct _Restriction {
char unused7:1;
} flags;
_Restriction(NodeID vn) : viaNode(vn), fromNode(UINT_MAX), toNode(UINT_MAX) { }
_Restriction(bool isOnly = false) : viaNode(UINT_MAX), fromNode(UINT_MAX), toNode(UINT_MAX) {
flags.isOnly = isOnly;
@ -198,7 +181,6 @@ struct _RawRestrictionContainer {
}
};
struct CmpRestrictionByFrom: public std::binary_function<_RawRestrictionContainer, _RawRestrictionContainer, bool> {
typedef _RawRestrictionContainer value_type;
bool operator () (const _RawRestrictionContainer & a, const _RawRestrictionContainer & b) const {
@ -256,17 +238,19 @@ struct CmpWayStartAndEnd : public std::binary_function<_WayIDStartAndEndEdge, _W
};
struct Settings {
struct SpeedProfile {
vector< double > speed;
vector< string > names;
} speedProfile;
int indexInAccessListOf( const string & key) {
for(unsigned i = 0; i< speedProfile.names.size(); i++) {
if(speedProfile.names[i] == key)
return i;
}
return -1;
Settings() : obeyPollards(false), obeyOneways(false), useRestrictions(false), accessTag("motorcar") {}
StringMap speedProfile;
int operator[](const string & param) const {
if(speedProfile.find(param) == speedProfile.end())
return 0;
else
return speedProfile.at(param);
}
bool obeyPollards;
bool obeyOneways;
bool useRestrictions;
string accessTag;
};
struct Cmp : public std::binary_function<NodeID, NodeID, bool> {

View File

@ -92,7 +92,7 @@ private:
_Way _ReadXMLWay( ) {
_Way way;
way.direction = _Way::notSure;
way.maximumSpeed = -1;
way.speed = -1;
way.type = -1;
way.useful = false;
way.access = true;

View File

@ -38,15 +38,15 @@ using namespace std;
#endif
#define STXXL_VERBOSE_LEVEL -100
#define INFO(x) std::cout << "[info " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;
#define ERR(x) std::cerr << "[error " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl; exit(-1);
#define WARN(x) std::cerr << "[warn " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;
#define INFO(x) do {std::cout << "[info " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
#define ERR(x) do {std::cerr << "[error " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl; exit(-1);} while(0);
#define WARN(x) do {std::cerr << "[warn " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
#ifdef NDEBUG
#define DEBUG(x)
#else
#define DEBUG(x) std::cout << "[debug " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;
#define DEBUG(x) do {std::cout << "[debug " << __FILE__ << ":" << __LINE__ << "] " << x << std::endl;} while(0);
#endif
#define DELETE(x) { if(NULL != x) { delete x; x = NULL; } }
#define DELETE(x) do { if(NULL != x) { delete x; x = NULL; } }while(0);
#ifndef M_PI
#define M_PI 3.14159265358979323846