Removed VERBOSE macro since it was superflous
This commit is contained in:
parent
ff5e34ee70
commit
928e1178b1
@ -48,17 +48,17 @@ NodeID readOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in >> n;
|
in >> n;
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i < n; ++i) {
|
||||||
in >> id >> ycoord >> xcoord;
|
in >> id >> ycoord >> xcoord;
|
||||||
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in >> m;
|
in >> m;
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges ...");
|
||||||
|
|
||||||
edgeList.reserve(m);
|
edgeList.reserve(m);
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; ++i) {
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
short type;
|
short type;
|
||||||
NodeID nameID;
|
NodeID nameID;
|
||||||
@ -73,23 +73,19 @@ NodeID readOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (1 == dir) backward = false;
|
if (1 == dir) backward = false;
|
||||||
if (2 == dir) forward = false;
|
if (2 == dir) forward = false;
|
||||||
|
|
||||||
if(length == 0)
|
if(length == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end())
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
{
|
ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source );
|
||||||
cerr << "after " << edgeList.size() << " edges" << endl;
|
|
||||||
cerr << "->" << source << "," << target << "," << length << "," << dir << "," << weight << endl;
|
|
||||||
cerr << "unresolved source NodeID: " << source << endl; exit(0);
|
|
||||||
}
|
}
|
||||||
source = intNodeID->second;
|
source = intNodeID->second;
|
||||||
intNodeID = ext2IntNodeMap.find(target);
|
intNodeID = ext2IntNodeMap.find(target);
|
||||||
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { cerr << "unresolved target NodeID : " << target << endl; exit(0); }
|
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { ERR("unresolved target NodeID : " << target); }
|
||||||
target = intNodeID->second;
|
target = intNodeID->second;
|
||||||
|
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
if(source == UINT_MAX || target == UINT_MAX) { ERR( "nonexisting source or target" ); }
|
||||||
|
|
||||||
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type );
|
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
@ -107,7 +103,7 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
int xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in.read((char*)&n, sizeof(NodeID));
|
in.read((char*)&n, sizeof(NodeID));
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i<n;i++) {
|
||||||
in.read((char*)&id, sizeof(unsigned));
|
in.read((char*)&id, sizeof(unsigned));
|
||||||
in.read((char*)&ycoord, sizeof(int));
|
in.read((char*)&ycoord, sizeof(int));
|
||||||
@ -116,7 +112,7 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in.read((char*)&m, sizeof(unsigned));
|
in.read((char*)&m, sizeof(unsigned));
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges ");
|
||||||
|
|
||||||
for(unsigned i = 0; i < inputRestrictions.size(); ++i) {
|
for(unsigned i = 0; i < inputRestrictions.size(); ++i) {
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(inputRestrictions[i].fromNode);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(inputRestrictions[i].fromNode);
|
||||||
@ -167,13 +163,13 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
if (1 == dir) { backward = false; }
|
if (1 == dir) { backward = false; }
|
||||||
if (2 == dir) { forward = false; }
|
if (2 == dir) { forward = false; }
|
||||||
|
|
||||||
if(length == 0) { cerr << "loaded null length edge" << endl; exit(1); }
|
if(length == 0) { ERR("loaded null length edge" ); }
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cerr << "[warning] unresolved source NodeID: " << source << endl;
|
WARN(" unresolved source NodeID: " << source );
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -181,13 +177,13 @@ NodeID readBinaryOSRMGraphFromStream(istream &in, vector<EdgeT>& edgeList, vecto
|
|||||||
intNodeID = ext2IntNodeMap.find(target);
|
intNodeID = ext2IntNodeMap.find(target);
|
||||||
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) {
|
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
cerr << "unresolved target NodeID : " << target << endl;
|
WARN("unresolved target NodeID : " << target );
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
target = intNodeID->second;
|
target = intNodeID->second;
|
||||||
|
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
if(source == UINT_MAX || target == UINT_MAX) { ERR("nonexisting source or target"); }
|
||||||
|
|
||||||
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout );
|
EdgeT inputEdge(source, target, nameID, weight, forward, backward, type, isRoundabout );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
@ -204,17 +200,17 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
int dir, xcoord, ycoord;// direction (0 = open, 1 = forward, 2+ = open)
|
||||||
ExternalNodeMap ext2IntNodeMap;
|
ExternalNodeMap ext2IntNodeMap;
|
||||||
in >> n;
|
in >> n;
|
||||||
VERBOSE(cout << "Importing n = " << n << " nodes ..." << flush;)
|
DEBUG("Importing n = " << n << " nodes ");
|
||||||
for (NodeID i=0; i<n;i++) {
|
for (NodeID i=0; i<n;++i) {
|
||||||
in >> id >> ycoord >> xcoord;
|
in >> id >> ycoord >> xcoord;
|
||||||
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
int2ExtNodeMap->push_back(NodeInfo(xcoord, ycoord, id));
|
||||||
ext2IntNodeMap.insert(make_pair(id, i));
|
ext2IntNodeMap.insert(make_pair(id, i));
|
||||||
}
|
}
|
||||||
in >> m;
|
in >> m;
|
||||||
VERBOSE(cout << " and " << m << " edges ..." << flush;)
|
DEBUG(" and " << m << " edges");
|
||||||
|
|
||||||
edgeList.reserve(m);
|
edgeList.reserve(m);
|
||||||
for (EdgeID i=0; i<m; i++) {
|
for (EdgeID i=0; i<m; ++i) {
|
||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
unsigned speedType(0);
|
unsigned speedType(0);
|
||||||
short type(0);
|
short type(0);
|
||||||
@ -279,7 +275,7 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
assert(length > 0);
|
assert(length > 0);
|
||||||
assert(weight > 0);
|
assert(weight > 0);
|
||||||
if(dir <0 || dir > 2)
|
if(dir <0 || dir > 2)
|
||||||
std::cerr << "[error] direction bogus: " << dir << std::endl;
|
WARN("direction bogus: " << dir);
|
||||||
assert(0<=dir && dir<=2);
|
assert(0<=dir && dir<=2);
|
||||||
|
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
@ -287,23 +283,19 @@ NodeID readDTMPGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (dir == 1) backward = false;
|
if (dir == 1) backward = false;
|
||||||
if (dir == 2) forward = false;
|
if (dir == 2) forward = false;
|
||||||
|
|
||||||
if(length == 0)
|
if(length == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
// translate the external NodeIDs to internal IDs
|
// translate the external NodeIDs to internal IDs
|
||||||
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
ExternalNodeMap::iterator intNodeID = ext2IntNodeMap.find(source);
|
||||||
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end())
|
if( ext2IntNodeMap.find(source) == ext2IntNodeMap.end()) {
|
||||||
{
|
ERR("after " << edgeList.size() << " edges" << "\n->" << source << "," << target << "," << length << "," << dir << "," << weight << "\n->unresolved source NodeID: " << source);
|
||||||
cerr << "after " << edgeList.size() << " edges" << endl;
|
|
||||||
cerr << "->" << source << "," << target << "," << length << "," << dir << "," << weight << endl;
|
|
||||||
cerr << "unresolved source NodeID: " << source << endl; exit(0);
|
|
||||||
}
|
}
|
||||||
source = intNodeID->second;
|
source = intNodeID->second;
|
||||||
intNodeID = ext2IntNodeMap.find(target);
|
intNodeID = ext2IntNodeMap.find(target);
|
||||||
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { cerr << "unresolved target NodeID : " << target << endl; exit(0); }
|
if(ext2IntNodeMap.find(target) == ext2IntNodeMap.end()) { ERR("unresolved target NodeID : " << target); }
|
||||||
target = intNodeID->second;
|
target = intNodeID->second;
|
||||||
|
|
||||||
if(source == UINT_MAX || target == UINT_MAX) { cerr << "nonexisting source or target" << endl; exit(0); }
|
if(source == UINT_MAX || target == UINT_MAX) { ERR("nonexisting source or target" ); }
|
||||||
|
|
||||||
EdgeT inputEdge(source, target, 0, weight, forward, backward, type );
|
EdgeT inputEdge(source, target, 0, weight, forward, backward, type );
|
||||||
edgeList.push_back(inputEdge);
|
edgeList.push_back(inputEdge);
|
||||||
@ -333,12 +325,9 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
EdgeWeight weight;
|
EdgeWeight weight;
|
||||||
in >> source >> target >> weight >> dir;
|
in >> source >> target >> weight >> dir;
|
||||||
|
|
||||||
// if(dir == 3)
|
|
||||||
// dir = 0;
|
|
||||||
|
|
||||||
assert(weight > 0);
|
assert(weight > 0);
|
||||||
if(dir <0 || dir > 3)
|
if(dir <0 || dir > 3)
|
||||||
std::cerr << "[error] direction bogus: " << dir << std::endl;
|
ERR( "[error] direction bogus: " << dir );
|
||||||
assert(0<=dir && dir<=3);
|
assert(0<=dir && dir<=3);
|
||||||
|
|
||||||
bool forward = true;
|
bool forward = true;
|
||||||
@ -347,8 +336,7 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
if (dir == 2) forward = false;
|
if (dir == 2) forward = false;
|
||||||
if (dir == 3) {backward = true; forward = true;}
|
if (dir == 3) {backward = true; forward = true;}
|
||||||
|
|
||||||
if(weight == 0)
|
if(weight == 0) { ERR("loaded null length edge"); }
|
||||||
{ cerr << "loaded null length edge" << endl; exit(1); }
|
|
||||||
|
|
||||||
if( nodeMap.find(source) == nodeMap.end()) {
|
if( nodeMap.find(source) == nodeMap.end()) {
|
||||||
nodeMap.insert(std::make_pair(source, numberOfNodes ));
|
nodeMap.insert(std::make_pair(source, numberOfNodes ));
|
||||||
@ -365,8 +353,6 @@ NodeID readDDSGGraphFromStream(istream &in, vector<EdgeT>& edgeList, vector<Node
|
|||||||
}
|
}
|
||||||
vector<EdgeT>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
|
vector<EdgeT>(edgeList.begin(), edgeList.end()).swap(edgeList); //remove excess candidates.
|
||||||
|
|
||||||
// cout << "ok" << endl;
|
|
||||||
// std::cout << "imported " << numberOfNodes << " nodes and " << edgeList.size() << " edges" << std::endl;
|
|
||||||
nodeMap.clear();
|
nodeMap.clear();
|
||||||
return numberOfNodes;
|
return numberOfNodes;
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define VERBOSE(x) x
|
|
||||||
#define VERBOSE2(x)
|
|
||||||
#ifdef STXXL_VERBOSE_LEVEL
|
#ifdef STXXL_VERBOSE_LEVEL
|
||||||
#undef STXXL_VERBOSE_LEVEL
|
#undef STXXL_VERBOSE_LEVEL
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user