author | hegyi |
Tue, 12 Jul 2005 18:21:49 +0000 | |
changeset 1550 | 4dcbb4ab1d7a |
parent 1524 | 587a823bcdd0 |
child 1597 | 15b51d278bf0 |
permissions | -rw-r--r-- |
ladanyi@1442 | 1 |
#include <mapstorage.h> |
ladanyi@1442 | 2 |
|
ladanyi@1442 | 3 |
MapStorage::MapStorage(Graph & graph):g(graph) |
ladanyi@1442 | 4 |
{ |
ladanyi@1442 | 5 |
}; |
ladanyi@1442 | 6 |
|
ladanyi@1442 | 7 |
int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap) |
ladanyi@1442 | 8 |
{ |
ladanyi@1442 | 9 |
nodemap_storage[name]=nodemap; |
ladanyi@1442 | 10 |
return 0; |
ladanyi@1442 | 11 |
} |
ladanyi@1442 | 12 |
|
ladanyi@1442 | 13 |
int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap) |
ladanyi@1442 | 14 |
{ |
ladanyi@1442 | 15 |
edgemap_storage[name]=edgemap; |
ladanyi@1442 | 16 |
return 0; |
ladanyi@1442 | 17 |
} |
ladanyi@1442 | 18 |
|
ladanyi@1442 | 19 |
double MapStorage::maxOfNodeMap(const std::string & name) |
ladanyi@1442 | 20 |
{ |
ladanyi@1442 | 21 |
double max=0; |
ladanyi@1442 | 22 |
for (NodeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 23 |
{ |
ladanyi@1442 | 24 |
if( (*nodemap_storage[name])[j]>max ) |
ladanyi@1442 | 25 |
{ |
ladanyi@1442 | 26 |
max=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 27 |
} |
ladanyi@1442 | 28 |
} |
ladanyi@1442 | 29 |
return max; |
ladanyi@1442 | 30 |
} |
ladanyi@1442 | 31 |
|
ladanyi@1442 | 32 |
double MapStorage::maxOfEdgeMap(const std::string & name) |
ladanyi@1442 | 33 |
{ |
ladanyi@1442 | 34 |
double max=0; |
ladanyi@1442 | 35 |
for (EdgeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 36 |
{ |
ladanyi@1442 | 37 |
if( (*edgemap_storage[name])[j]>max ) |
ladanyi@1442 | 38 |
{ |
ladanyi@1442 | 39 |
max=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 40 |
} |
ladanyi@1442 | 41 |
} |
ladanyi@1442 | 42 |
return max; |
ladanyi@1442 | 43 |
} |
ladanyi@1442 | 44 |
|
ladanyi@1442 | 45 |
double MapStorage::minOfNodeMap(const std::string & name) |
ladanyi@1442 | 46 |
{ |
ladanyi@1442 | 47 |
NodeIt j(g); |
ladanyi@1442 | 48 |
double min=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 49 |
for (; j!=INVALID; ++j) |
ladanyi@1442 | 50 |
{ |
ladanyi@1442 | 51 |
if( (*nodemap_storage[name])[j]<min ) |
ladanyi@1442 | 52 |
{ |
ladanyi@1442 | 53 |
min=(*nodemap_storage[name])[j]; |
ladanyi@1442 | 54 |
} |
ladanyi@1442 | 55 |
} |
ladanyi@1442 | 56 |
return min; |
ladanyi@1442 | 57 |
} |
ladanyi@1442 | 58 |
|
ladanyi@1442 | 59 |
double MapStorage::minOfEdgeMap(const std::string & name) |
ladanyi@1442 | 60 |
{ |
ladanyi@1442 | 61 |
EdgeIt j(g); |
ladanyi@1442 | 62 |
double min=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 63 |
for (EdgeIt j(g); j!=INVALID; ++j) |
ladanyi@1442 | 64 |
{ |
ladanyi@1442 | 65 |
if( (*edgemap_storage[name])[j]<min ) |
ladanyi@1442 | 66 |
{ |
ladanyi@1442 | 67 |
min=(*edgemap_storage[name])[j]; |
ladanyi@1442 | 68 |
} |
ladanyi@1442 | 69 |
} |
ladanyi@1442 | 70 |
return min; |
ladanyi@1442 | 71 |
} |
ladanyi@1442 | 72 |
|
hegyi@1524 | 73 |
void MapStorage::initMapsForEdge(Graph::Edge e) |
hegyi@1509 | 74 |
{ |
hegyi@1525 | 75 |
std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it; |
hegyi@1525 | 76 |
for(ems_it=edgemap_storage.begin();ems_it!=edgemap_storage.end();ems_it++) |
hegyi@1525 | 77 |
{ |
hegyi@1525 | 78 |
(*((*ems_it).second))[e]=5; |
hegyi@1525 | 79 |
} |
hegyi@1509 | 80 |
} |