Permalink
Browse files

*** empty log message ***

  • Loading branch information...
1 parent 2fdf2b7 commit d704eab6b898d0cf0b263933046c4148b331149c @drolbr committed Apr 27, 2009
Showing with 95 additions and 166 deletions.
  1. +7 −28 detect_odd_nodes_statement.c
  2. +1 −1 doc/recurse_statement.txt
  3. +1 −1 html/index.html
  4. +8 −30 make_area_statement.c
  5. +75 −103 recurse_statement.c
  6. +3 −3 script_tools.c
@@ -30,29 +30,15 @@ void Detect_Odd_Nodes_Statement::set_attributes(const char **attr)
void Detect_Odd_Nodes_Statement::forecast(MYSQL* mysql)
{
- if (input == output)
- {
- Set_Forecast& sf_io(declare_union_set(output));
-
- declare_used_time(1 + sf_io.way_count/10);
- finish_statement_forecast();
-
- display_full();
- add_sanity_remark("\"detect-odd-nodes\" won't produce any result if from and into are equal.");
- display_state();
- }
- else
- {
- const Set_Forecast& sf_in(declare_read_set(input));
- Set_Forecast& sf_out(declare_write_set(output));
+ Set_Forecast sf_in(declare_read_set(input));
+ Set_Forecast& sf_out(declare_write_set(output));
- sf_out.node_count = sf_in.way_count;
- declare_used_time(1 + sf_in.way_count/10);
- finish_statement_forecast();
+ sf_out.node_count = sf_in.way_count;
+ declare_used_time(1 + sf_in.way_count/10);
+ finish_statement_forecast();
- display_full();
- display_state();
- }
+ display_full();
+ display_state();
}
void Detect_Odd_Nodes_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
@@ -61,13 +47,6 @@ void Detect_Odd_Nodes_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
set< Way > ways;
set< Relation > relations;
set< Area > areas;
- if (input == output)
- {
- nodes = maps[output].get_nodes();
- ways = maps[output].get_ways();
- relations = maps[output].get_relations();
- areas = maps[output].get_areas();
- }
map< string, Set >::const_iterator mit(maps.find(input));
if (mit == maps.end())
@@ -15,7 +15,7 @@ from = set:ways,relations:from
type = arg:[way-node,relation-relation,relation-way,relation-node]:type
* changes
-into = union set:from set:into:nodes,ways,relations (set:from:ways,relations)
+into = set:into:nodes,ways,relations (set:from:ways,relations)
way-node: 28 nodes per way
relation-relation: 1 relation per relation
relation-way: 22 ways per relation
View
@@ -13,11 +13,11 @@
<!--
offene Probleme:
- gzip-Komprimierung
-- Anpassen der Union-Logik
- Umstellung auf Relation_
- Reorganisation von make-area
- area-query
- recurse: area-node
+- Durchsetzung der Constraints
//-->
<p>
View
@@ -57,31 +57,16 @@ inline void area_insert(Area& area, int lat1, int lon1, int lat2, int lon2)
void Make_Area_Statement::forecast(MYSQL* mysql)
{
- if (input == output)
- {
- Set_Forecast& sf_io(declare_union_set(output));
- declare_read_set(tags);
+ Set_Forecast sf_in(declare_read_set(input));
+ declare_read_set(tags);
+ Set_Forecast& sf_out(declare_write_set(output));
- sf_io.area_count += 1;
- declare_used_time(100 + sf_io.node_count + sf_io.way_count);
- finish_statement_forecast();
-
- display_full();
- display_state();
- }
- else
- {
- const Set_Forecast& sf_in(declare_read_set(input));
- declare_read_set(tags);
- Set_Forecast& sf_out(declare_write_set(output));
+ sf_out.area_count = 1;
+ declare_used_time(100 + sf_in.node_count + sf_in.way_count);
+ finish_statement_forecast();
- sf_out.area_count = 1;
- declare_used_time(100 + sf_in.node_count + sf_in.way_count);
- finish_statement_forecast();
-
- display_full();
- display_state();
- }
+ display_full();
+ display_state();
}
void Make_Area_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
@@ -90,13 +75,6 @@ void Make_Area_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
set< Way > ways;
set< Relation > relations;
set< Area > areas;
- if (input == output)
- {
- nodes = maps[output].get_nodes();
- ways = maps[output].get_ways();
- relations = maps[output].get_relations();
- areas = maps[output].get_areas();
- }
map< string, Set >::const_iterator mit(maps.find(input));
if (mit == maps.end())
View
@@ -68,107 +68,54 @@ void Recurse_Statement::set_attributes(const char **attr)
void Recurse_Statement::forecast(MYSQL* mysql)
{
- if (input == output)
- {
- Set_Forecast& sf_io(declare_union_set(output));
+ Set_Forecast sf_in(declare_read_set(input));
+ Set_Forecast& sf_out(declare_write_set(output));
- if (type == RECURSE_RELATION_RELATION)
- {
- sf_io.relation_count += sf_io.relation_count;
- declare_used_time(100*sf_io.relation_count);
- }
- else if (type == RECURSE_RELATION_BACKWARDS)
- {
- sf_io.relation_count += sf_io.relation_count;
- declare_used_time(2000);
- }
- else if (type == RECURSE_RELATION_WAY)
- {
- sf_io.way_count += 22*sf_io.relation_count;
- declare_used_time(100*sf_io.relation_count);
- }
- else if (type == RECURSE_RELATION_NODE)
- {
- sf_io.node_count += 2*sf_io.relation_count;
- declare_used_time(100*sf_io.relation_count);
- }
- else if (type == RECURSE_WAY_NODE)
- {
- sf_io.node_count += 28*sf_io.way_count;
- declare_used_time(50*sf_io.way_count);
- }
- else if (type == RECURSE_WAY_RELATION)
- {
- sf_io.relation_count += sf_io.way_count/10;
- declare_used_time(2000);
- }
- else if (type == RECURSE_NODE_WAY)
- {
- sf_io.way_count += sf_io.node_count/2;
- declare_used_time(sf_io.node_count/1000); //TODO
- }
- else if (type == RECURSE_NODE_RELATION)
- {
- sf_io.relation_count += sf_io.node_count/100;
- declare_used_time(2000);
- }
-
- finish_statement_forecast();
-
- display_full();
- display_state();
+ if (type == RECURSE_RELATION_RELATION)
+ {
+ sf_out.relation_count = sf_in.relation_count;
+ declare_used_time(100*sf_in.relation_count);
}
- else
+ else if (type == RECURSE_RELATION_BACKWARDS)
{
- const Set_Forecast& sf_in(declare_read_set(input));
- Set_Forecast& sf_out(declare_write_set(output));
-
- if (type == RECURSE_RELATION_RELATION)
- {
- sf_out.relation_count += sf_in.relation_count;
- declare_used_time(100*sf_in.relation_count);
- }
- else if (type == RECURSE_RELATION_BACKWARDS)
- {
- sf_out.relation_count += sf_in.relation_count;
- declare_used_time(2000);
- }
- else if (type == RECURSE_RELATION_WAY)
- {
- sf_out.way_count += 22*sf_in.relation_count;
- declare_used_time(100*sf_in.relation_count);
- }
- else if (type == RECURSE_RELATION_NODE)
- {
- sf_out.node_count += 2*sf_in.relation_count;
- declare_used_time(100*sf_in.relation_count);
- }
- else if (type == RECURSE_WAY_NODE)
- {
- sf_out.node_count += 28*sf_in.way_count;
- declare_used_time(50*sf_in.way_count);
- }
- else if (type == RECURSE_WAY_RELATION)
- {
- sf_out.relation_count += sf_in.way_count/10;
- declare_used_time(2000);
- }
- else if (type == RECURSE_NODE_WAY)
- {
- sf_out.way_count += sf_in.node_count/2;
- declare_used_time(sf_in.node_count/1000); //TODO
- }
- else if (type == RECURSE_NODE_RELATION)
- {
- sf_out.relation_count += sf_in.node_count/100;
- declare_used_time(2000);
- }
+ sf_out.relation_count = sf_in.relation_count;
+ declare_used_time(2000);
+ }
+ else if (type == RECURSE_RELATION_WAY)
+ {
+ sf_out.way_count = 22*sf_in.relation_count;
+ declare_used_time(100*sf_in.relation_count);
+ }
+ else if (type == RECURSE_RELATION_NODE)
+ {
+ sf_out.node_count = 2*sf_in.relation_count;
+ declare_used_time(100*sf_in.relation_count);
+ }
+ else if (type == RECURSE_WAY_NODE)
+ {
+ sf_out.node_count = 28*sf_in.way_count;
+ declare_used_time(50*sf_in.way_count);
+ }
+ else if (type == RECURSE_WAY_RELATION)
+ {
+ sf_out.relation_count = sf_in.way_count/10;
+ declare_used_time(2000);
+ }
+ else if (type == RECURSE_NODE_WAY)
+ {
+ sf_out.way_count = sf_in.node_count/2;
+ declare_used_time(sf_in.node_count/1000); //TODO
+ }
+ else if (type == RECURSE_NODE_RELATION)
+ {
+ sf_out.relation_count = sf_in.node_count/100;
+ declare_used_time(2000);
+ }
- finish_statement_forecast();
+ finish_statement_forecast();
- display_full();
- display_state();
- }
+ display_full();
+ display_state();
}
void multiWay_to_multiint_collect(const set< Way >& source, set< uint32 >& result_set)
@@ -213,13 +160,6 @@ void Recurse_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
set< Way >* ways(&(maps[output].get_ways_handle()));
set< Relation >* relations(&(maps[output].get_relations_handle()));
set< Area >* areas(&(maps[output].get_areas_handle()));
- if (input != output)
- {
- nodes->clear();
- ways->clear();
- relations->clear();
- areas->clear();
- }
map< string, Set >::const_iterator mit(maps.find(input));
if (mit == maps.end())
@@ -229,6 +169,10 @@ void Recurse_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
{
set< uint32 > trelations;
multiRelation_to_multiint_collect_relations(mit->second.get_relations(), trelations);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
multiint_to_multiRelation_query(trelations, *relations);
}
else if (type == RECURSE_RELATION_BACKWARDS)
@@ -239,6 +183,10 @@ void Recurse_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
source.insert(Relation_(it->id));
set< Relation_ > result;
multiRelation_backwards_query(source, result);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
for (set< Relation_ >::const_iterator it(result.begin()); it != result.end(); ++it)
{
Relation relation(it->head);
@@ -259,24 +207,40 @@ void Recurse_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
{
set< uint32 > tways;
multiRelation_to_multiint_collect_ways(mit->second.get_relations(), tways);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
multiint_to_multiWay_query(tways, *ways);
}
else if (type == RECURSE_RELATION_NODE)
{
set< uint32 > tnodes;
multiRelation_to_multiint_collect_nodes(mit->second.get_relations(), tnodes);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
multiint_to_multiNode_query(tnodes, *nodes);
}
else if (type == RECURSE_WAY_NODE)
{
set< uint32 > tnodes;
multiWay_to_multiint_collect(mit->second.get_ways(), tnodes);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
multiint_to_multiNode_query(tnodes, *nodes);
}
else if (type == RECURSE_WAY_RELATION)
{
set< Relation_ > result;
multiWay_to_multiRelation_query(mit->second.get_ways(), result);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
for (set< Relation_ >::const_iterator it(result.begin()); it != result.end(); ++it)
{
Relation relation(it->head);
@@ -295,12 +259,20 @@ void Recurse_Statement::execute(MYSQL* mysql, map< string, Set >& maps)
}
else if (type == RECURSE_NODE_WAY)
{
+ ways->clear();
+ areas->clear();
+ relations->clear();
multiNode_to_multiWay_query(mit->second.get_nodes(), *ways);
+ nodes->clear();
}
else if (type == RECURSE_NODE_RELATION)
{
set< Relation_ > result;
multiNode_to_multiRelation_query(mit->second.get_nodes(), result);
+ nodes->clear();
+ ways->clear();
+ areas->clear();
+ relations->clear();
for (set< Relation_ >::const_iterator it(result.begin()); it != result.end(); ++it)
{
Relation relation(it->head);
View
@@ -139,7 +139,7 @@ void Root_Statement::set_attributes(const char **attr)
attributes["name"] = "";
attributes["replace"] = "0";
attributes["version"] = "0";
- attributes["debug"] = "quiet";
+ attributes["debug"] = "errors";
eval_cstr_array(get_name(), attributes, attr);
@@ -346,8 +346,8 @@ void finish_statement_forecast()
for (map< string, Set_Forecast >::const_iterator it(sets.begin()); it != sets.end(); ++it)
{
element_count += it->second.node_count;
- element_count += 29*it->second.way_count;
- element_count += 26*it->second.relation_count;
+ element_count += 10*it->second.way_count;
+ element_count += 20*it->second.relation_count;
}
if ((element_limit == 0) && (element_count > 10*1000*1000))
add_sanity_error("Number of elements exceeds limit of 10,000,000 elements.");

0 comments on commit d704eab

Please sign in to comment.