Fix naming convention of Percent
This commit is contained in:
parent
83482afa02
commit
d12a95b4ef
@ -561,7 +561,7 @@ class GraphContractor
|
|||||||
number_of_contracted_nodes += end_independent_nodes_idx - begin_independent_nodes_idx;
|
number_of_contracted_nodes += end_independent_nodes_idx - begin_independent_nodes_idx;
|
||||||
remaining_nodes.resize(begin_independent_nodes_idx);
|
remaining_nodes.resize(begin_independent_nodes_idx);
|
||||||
|
|
||||||
p.printStatus(number_of_contracted_nodes);
|
p.PrintStatus(number_of_contracted_nodes);
|
||||||
++current_level;
|
++current_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,7 +627,7 @@ class GraphContractor
|
|||||||
Edge new_edge;
|
Edge new_edge;
|
||||||
for (const auto node : util::irange(0u, number_of_nodes))
|
for (const auto node : util::irange(0u, number_of_nodes))
|
||||||
{
|
{
|
||||||
p.printStatus(node);
|
p.PrintStatus(node);
|
||||||
for (auto edge : contractor_graph->GetAdjacentEdgeRange(node))
|
for (auto edge : contractor_graph->GetAdjacentEdgeRange(node))
|
||||||
{
|
{
|
||||||
const NodeID target = contractor_graph->GetTarget(edge);
|
const NodeID target = contractor_graph->GetTarget(edge);
|
||||||
|
@ -12,10 +12,10 @@ namespace util
|
|||||||
class Percent
|
class Percent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Percent(unsigned max_value, unsigned step = 5) { reinit(max_value, step); }
|
explicit Percent(unsigned max_value, unsigned step = 5) { Reinit(max_value, step); }
|
||||||
|
|
||||||
// Reinitializes
|
// Reinitializes
|
||||||
void reinit(unsigned max_value, unsigned step = 5)
|
void Reinit(unsigned max_value, unsigned step = 5)
|
||||||
{
|
{
|
||||||
m_max_value = max_value;
|
m_max_value = max_value;
|
||||||
m_current_value = 0;
|
m_current_value = 0;
|
||||||
@ -26,27 +26,27 @@ class Percent
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If there has been significant progress, display it.
|
// If there has been significant progress, display it.
|
||||||
void printStatus(unsigned current_value)
|
void PrintStatus(unsigned current_value)
|
||||||
{
|
{
|
||||||
if (current_value >= m_next_threshold)
|
if (current_value >= m_next_threshold)
|
||||||
{
|
{
|
||||||
m_next_threshold += m_percent_interval;
|
m_next_threshold += m_percent_interval;
|
||||||
printPercent(current_value / static_cast<double>(m_max_value) * 100.);
|
PrintPercent(current_value / static_cast<double>(m_max_value) * 100.);
|
||||||
}
|
}
|
||||||
if (current_value + 1 == m_max_value)
|
if (current_value + 1 == m_max_value)
|
||||||
std::cout << " 100%" << std::endl;
|
std::cout << " 100%" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printIncrement()
|
void PrintIncrement()
|
||||||
{
|
{
|
||||||
++m_current_value;
|
++m_current_value;
|
||||||
printStatus(m_current_value);
|
PrintStatus(m_current_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printAddition(const unsigned addition)
|
void PrintAddition(const unsigned addition)
|
||||||
{
|
{
|
||||||
m_current_value += addition;
|
m_current_value += addition;
|
||||||
printStatus(m_current_value);
|
PrintStatus(m_current_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -58,7 +58,7 @@ class Percent
|
|||||||
unsigned m_step;
|
unsigned m_step;
|
||||||
|
|
||||||
// Displays progress.
|
// Displays progress.
|
||||||
void printPercent(double percent)
|
void PrintPercent(double percent)
|
||||||
{
|
{
|
||||||
while (percent >= m_last_percent + m_step)
|
while (percent >= m_last_percent + m_step)
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedNodes()
|
|||||||
{
|
{
|
||||||
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
BOOST_ASSERT(node_u != SPECIAL_NODEID);
|
||||||
BOOST_ASSERT(node_u < m_node_based_graph->GetNumberOfNodes());
|
BOOST_ASSERT(node_u < m_node_based_graph->GetNumberOfNodes());
|
||||||
progress.printStatus(node_u);
|
progress.PrintStatus(node_u);
|
||||||
for (EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(node_u))
|
for (EdgeID e1 : m_node_based_graph->GetAdjacentEdgeRange(node_u))
|
||||||
{
|
{
|
||||||
const EdgeData &edge_data = m_node_based_graph->GetEdgeData(e1);
|
const EdgeData &edge_data = m_node_based_graph->GetEdgeData(e1);
|
||||||
@ -328,7 +328,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
|||||||
street_name_suffix_table);
|
street_name_suffix_table);
|
||||||
for (const auto node_u : util::irange(0u, m_node_based_graph->GetNumberOfNodes()))
|
for (const auto node_u : util::irange(0u, m_node_based_graph->GetNumberOfNodes()))
|
||||||
{
|
{
|
||||||
progress.printStatus(node_u);
|
progress.PrintStatus(node_u);
|
||||||
for (const EdgeID edge_from_u : m_node_based_graph->GetAdjacentEdgeRange(node_u))
|
for (const EdgeID edge_from_u : m_node_based_graph->GetAdjacentEdgeRange(node_u))
|
||||||
{
|
{
|
||||||
if (m_node_based_graph->GetEdgeData(edge_from_u).reversed)
|
if (m_node_based_graph->GetEdgeData(edge_from_u).reversed)
|
||||||
|
@ -26,7 +26,7 @@ void GraphCompressor::Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
|||||||
|
|
||||||
for (const NodeID node_v : util::irange(0u, original_number_of_nodes))
|
for (const NodeID node_v : util::irange(0u, original_number_of_nodes))
|
||||||
{
|
{
|
||||||
progress.printStatus(node_v);
|
progress.PrintStatus(node_v);
|
||||||
|
|
||||||
// only contract degree 2 vertices
|
// only contract degree 2 vertices
|
||||||
if (2 != graph.GetOutDegree(node_v))
|
if (2 != graph.GetOutDegree(node_v))
|
||||||
|
@ -136,7 +136,6 @@ int main(int argc, char *argv[]) try
|
|||||||
osrm::tools::deleteFileIfExists("component.shx");
|
osrm::tools::deleteFileIfExists("component.shx");
|
||||||
osrm::tools::deleteFileIfExists("component.shp");
|
osrm::tools::deleteFileIfExists("component.shp");
|
||||||
|
|
||||||
osrm::util::Percent percentage(graph->GetNumberOfNodes());
|
|
||||||
|
|
||||||
OGRRegisterAll();
|
OGRRegisterAll();
|
||||||
|
|
||||||
@ -167,11 +166,11 @@ int main(int argc, char *argv[]) try
|
|||||||
<< TIMER_MSEC(SCC_RUN_SETUP) / 1000. << "s";
|
<< TIMER_MSEC(SCC_RUN_SETUP) / 1000. << "s";
|
||||||
|
|
||||||
uint64_t total_network_length = 0;
|
uint64_t total_network_length = 0;
|
||||||
percentage.reinit(graph->GetNumberOfNodes());
|
osrm::util::Percent percentage(graph->GetNumberOfNodes());
|
||||||
TIMER_START(SCC_OUTPUT);
|
TIMER_START(SCC_OUTPUT);
|
||||||
for (const NodeID source : osrm::util::irange(0u, graph->GetNumberOfNodes()))
|
for (const NodeID source : osrm::util::irange(0u, graph->GetNumberOfNodes()))
|
||||||
{
|
{
|
||||||
percentage.printIncrement();
|
percentage.PrintIncrement();
|
||||||
for (const auto current_edge : graph->GetAdjacentEdgeRange(source))
|
for (const auto current_edge : graph->GetAdjacentEdgeRange(source))
|
||||||
{
|
{
|
||||||
const auto target = graph->GetTarget(current_edge);
|
const auto target = graph->GetTarget(current_edge);
|
||||||
|
Loading…
Reference in New Issue
Block a user