\( \def\bold#1{\bf #1} \newcommand{\d}{\mathrm{d}} \) BTP: Manual and Source Code Documentation

Power Uphill

bike mass [kg]
body mass [kg]
altitude gain [m]
climb length [km]
gradient [%]
time [s]
speed [km/h]
power [W]
power/mass [W/kg]
climbrate [m/min]

average power on climb stage

BTP  3.0
Routing/ClimbAnalysis/PowerCalculation
strongcalc.cpp
1 #include "strongcalc.h"
2 
3 STRONGcalc::STRONGcalc(OSM* o, KOO* s, KOO* e,char max, char min,
4  STRONGsetting* hs,Track*** trck, int* N, bool Hmonly){
5  this->o = o;
6  this->s = s;
7  this->e = e;
8  this->max = max;
9  this->min = min;
10  this->hs = hs;
11  this->trck = trck;
12  int hmmax;
13  // determine the maximum vertical meters to calculate
14  if(s != NULL && e != NULL){
15  radius = distance(s->lat,s->lon,e->lat,e->lon)*hs->rfac+hs->rabs;
16  hmmax = qMax(int(radius*hs->hmperkm),hs->hmmax);
17  }
18  else{
19  if(s == NULL && e == NULL){
20  radius = 1e10;
21  hmmax = hs->hmmax;
22  }
23  else{
24  radius = hs->rabs;
25  hmmax = qMax(int(radius*hs->hmperkm),hs->hmmax);
26  }
27  }
28  *N = this->N = hmmax / hs->hmstep + 1;
29  if(Hmonly){
30  if(hs->noSTRONGPlus)
31  runmode = RMcalc;
32  else
33  runmode = RMcalcRestricted;
34  }
35  else
36  if(hs->noSTRONGPlus)
37  runmode = RMcalcClimb;
38  else
39  runmode = RMcalcClimbRestricted;
40 }
41 void STRONGcalc::exit(){}
42 void STRONGcalc::run(){
43  switch(runmode){
44  case RMcalc:
45  init_Strong();
46  calc<STRONGfib>(f);
47  delete f;
48  delete mind;
49  delete mindSTRONG;
50  break;
51  case RMcalcClimb:
53  init_Strong();
54  calc<STRONGfib>(f);
56  delete f;
57  delete mind;
58  delete mindSTRONG;
59  break;
60  case RMcalcRestricted:
62  calc<STRONGPlusfib>(fplus);
63  delete fplus;
64  delete mind;
65  delete mindSTRONG;
66  break;
67  case RMcalcClimbRestricted:
69  calc<STRONGClimbfib>(fclimb);
70  delete fclimb;
71  delete mind;
72  delete mindSTRONG;
73  break;
74  case RMload:
75  load_STRONG();
76  break;
77  case RMsave:
78  save_STRONG();
79  break;
80  }
81  emit finished(foundSTRONG);
82 }
83 template <class T> void STRONGcalc::calc(FibunacciHeap<T>**f){
84  Neighbour* n;
85  for(int i = 0; i < N; i++){/*Der Algorithmus arbeitet und wird Schritt i für Schritt i vom
86  Interface aufgerufen */
87  T* t; float d; STRONG* cS; int si = -1;
88 
89  do{ t = f[i]->extmin();
90  }while(t != NULL && t->d < 0);
91 
92  while(t != NULL){
93  /*der Fibunacci-Heap der Hoehe (i*stepsize) ist noch nicht
94  abgearbeitet*/
95 
96  /*bevor KOO abgehandelt wird, Daten speichern, damit traceback()
97  sinnvoll arbeiten kann,
98  ausserdem den naechsten Neighbour festlegen*/
99  cS = &(t->k->cd->s[i]);
100  cS->via = t->via;
101  cS->from = t->from;
102  n = t->k->cd->neighbours;
103 
104  while(n != NULL){
105  if( n->nb->cd->s != NULL
106  && n->way->type >= min && n->way->type <= max
107  && traceback(cS,n)){
108  /*Der Weg erfüllt die Anforderung an den Typ und hat die
109  Prioritaetswarteschlange noch nie durchlaufen, der Endpunkt
110  liegt außerdem im zu betrachtenden Routingbereich*/
111  si = index_STRONG(t,n);
112  if(si < N){
113  /*nur, wenn der Grenzwert noch nicht überschritten ist*/
114  if( n->nb->cd->s[si].from == NULL
115  && n->nb->cd->s[si].via == NULL){
116  /*KOO wurde noch nie erreicht*/
117  store_STRONG(t,n,si,i);
118  }
119  else{
120  /*KOO wurde schon erreicht, pruefe: hat der Punkt die
121  Prioritaetswarteschlange schon wieder verlassen, falls
122  nicht: pruefe, ob Distanz jetzt kuerzer ist*/
123  if( n->nb->cd->s[si].via == NULL &&
124  ((T*)(n->nb->cd->s[si].from))->d > d + n->d){
125  /*alten Eintrag einschlaefern*/
126  ((T*)(n->nb->cd->s[si].from))->d = -1;
127  store_STRONG(t,n,si,i);
128  }
129  }
130  }
131  }
132  n = n->next;
133  }
134 
135  /*Liste der schwersten laufenden STRONGs ggf. aktualualisiern*/
136  if( i >= 0 && mind[i] > d ){
137  mind[i] = d ;
138  mindSTRONG[i] = cS;
139  }
140 
141  /*naechstes Element der Prioritaetswarteliste*/
142  do{
143  delete t;
144  t = f[i]->extmin();
145  if(t!=NULL)
146  d = t->d;
147  else
148  d= -1;
149  }while(t != NULL && d < 0);
150  }
151 
152  /*Ein der i.te FibunacciHeap ist abgearbeitet wurden. Das zwischenzeilich
153  erreichte Paretooptimum soll in trck gespeichert werden*/
154  STRONG_to_trck(i);
155 
156  emit refresh_progress(i);
157  if(calcstopped)
158  i = N;
159  }
160 }
162  /*Arrays initialisieren*/
163  calcstopped = 0;
164  foundSTRONG = 0;
165  f = new FibunacciHeap<STRONGfib>*[N];
166  *trck = new Track*[N];
167  mind = new double[N];
168  mindSTRONG = new STRONG*[N];
169  dummy = new Neighbour;
170  dummy->brthr = dummy;
171  dummy->d = dummy->hm = 0;
172  for(int j = 0; j < N; j++){
173  /*Arrays auf Startwert setzen*/
174  (*trck)[j] = NULL;
175  mind[j] = 100000000000000000.;
176  mindSTRONG[j] = NULL;
177  f[j] = new FibunacciHeap<STRONGfib>;
178  }
180  if(s != NULL){
181  /*soll mit festen Startpunkt routen.
182  Der 0. FibunacciHeap wird nur mit dem Startknoten beladen.
183  Das Gebiet wird begrenzt.*/
184  STRONGfib* t = f[0]->ins(0);
185  t->from = NULL;
186  t->hm = 0.;
187  t->k = s;
188  t->via = dummy;
189  s->cd->s[0].from = t;
190  s->cd->s[0].via = dummy;
191  }
192  else{
193  /*offener Start und offenes Ende.
194  Der FibunacciHeap wird mit allen Kreuzungsknoten gleichzeitig
195  gestartet.
196  Das Gebiet wird nicht begrenzt.*/
198  }
199 }
201  /*Arrays initialisieren*/
202  calcstopped = 0;
203  foundSTRONG = 0;
205  *trck = new Track*[N];
206  mind = new double[N];
207  mindSTRONG = new STRONG*[N];
208  dummy = new Neighbour;
209  dummy->brthr = dummy;
210  for(int j = 0; j < N; j++){
211  /*Arrays auf Startwert setzen*/
212  (*trck)[j] = NULL;
213  mind[j] = 100000000000000000.;
214  mindSTRONG[j] = NULL;
216  }
218  if(s != NULL){
219  /*soll mit festen Startpunkt routen.
220  Der 0. FibunacciHeap wird nur mit dem Startknoten beladen.
221  Das Gebiet wird begrenzt.*/
222  STRONGPlusfib* t = fplus[0]->ins(0);
223  t->from = NULL;
224  t->hm = 0.;
225  t->hmup = 0.;
226  t->hmdown = 0.;
227  t->k = s;
228  t->via = dummy;
229  s->cd->s[0].from = t;
230 
231  s->cd->s[0].via = dummy;
232  }
233  else{
234  /*offener Start und offenes Ende.
235  Der FibunacciHeap wird mit allen Kreuzungsknoten gleichzeitig
236  gestartet.
237  Das Gebiet wird nicht begrenzt.*/
239  }
240 }
242  /*Arrays initialisieren*/
243  calcstopped = 0;
244  foundSTRONG = 0;
246  *trck = new Track*[N];
247  mind = new double[N];
248  mindSTRONG = new STRONG*[N];
249  dummy = new Neighbour;
250  dummy->brthr = dummy;
251  for(int j = 0; j < N; j++){
252  /*Arrays auf Startwert setzen*/
253  (*trck)[j] = NULL;
254  mind[j] = 100000000000000000.;
255  mindSTRONG[j] = NULL;
257  }
259  if(s != NULL){
260  /*soll mit festen Startpunkt routen.
261  Der 0. FibunacciHeap wird nur mit dem Startknoten beladen.
262  Das Gebiet wird begrenzt.*/
263  STRONGClimbfib* t = fclimb[0]->ins(0);
264  t->from = NULL;
265  t->hm = 0.;
266  t->hmup = 0.;
267  t->hmdown = 0.;
268  t->Psum = 0;
269  t->dP = 0;
270  t->k = s;
271  t->via = dummy;
272  s->cd->s[0].from = t;
273 
274  s->cd->s[0].via = dummy;
275  }
276  else{
277  /*offener Start und offenes Ende.
278  Der FibunacciHeap wird mit allen Kreuzungsknoten gleichzeitig
279  gestartet.
280  Das Gebiet wird nicht begrenzt.*/
282  }
283 }
285  if(k != NULL){
286  if(k->cd != NULL){
287  STRONGfib* t = (STRONGfib*) f[0]->ins(0);
288  t->from = NULL;
289  t->hm = 0;
290  t->k = k;
291  t->via = dummy;
292  k->cd->s[0].via = dummy;
293  k->cd->s[0].from = t;
294  }
295  init_AreaStrong(k->l);
296  init_AreaStrong(k->r);
297  }
298 }
300  if(k != NULL){
301  if(k->cd != NULL){
302  STRONGPlusfib* t = (STRONGPlusfib*) fplus[0]->ins(0);
303  t->from = NULL;
304  t->hm = 0.;
305  t->hmup = 0.;
306  t->hmdown = 0.;
307  t->k = k;
308  t->via = dummy;
309  k->cd->s[0].via = dummy;
310  k->cd->s[0].from = t;
311  }
312  init_AreaStrongPlus(k->l);
313  init_AreaStrongPlus(k->r);
314  }
315 }
317  if(k != NULL){
318  if(k->cd != NULL){
319  STRONGClimbfib* t = (STRONGClimbfib*) fclimb[0]->ins(0);
320  t->from = NULL;
321  t->hm = 0.;
322  t->hmup = 0.;
323  t->hmdown = 0.;
324  t->dP = 0;
325  t->Psum = 0;
326  t->k = k;
327  t->via = dummy;
328  k->cd->s[0].via = dummy;
329  k->cd->s[0].from = t;
330  }
331  init_AreaStrongClimb(k->l);
332  init_AreaStrongClimb(k->r);
333  }
334 }
335 
337  if(k != NULL){
338  if(k->cd != NULL){
339  delete(k->cd->s);
340  if( s == NULL || e == NULL ||
341  distance(k->lat,k->lon,s->lat,s->lon)
342  +distance(k->lat,k->lon,e->lat,e->lon) < radius){
343  k->cd->s = new STRONG[N];
344  for(int i = 0; i < N; i++){
345  k->cd->s[i].from = NULL;
346  k->cd->s[i].via = NULL;
347  }
348  }
349  else
350  k->cd->s = NULL;
351  }
352  setSTRONG(k->l);
353  setSTRONG(k->r);
354  }
355 }
357  /*Strecke rekonstruieren*/
358  if(e != NULL){
359  /*STRONG mit festgelegtem Ende*/
360  if(e->cd->s[i].via != NULL){
361  Neighbour** n;
362  long nbc;
363  extract_neighbourlist(NULL,&(e->cd->s[i]),&n,&nbc);
364  if(nbc > 1) {
365  (*trck)[i] = new Track(&(n[1]),nbc-1);
366  foundSTRONG = 1;
367  }
368  delete n;
369  }
370  }
371  else{
372  /*STRONG mit offenem Ende*/
373  if(mindSTRONG[i]!= NULL){
374  Neighbour** n;
375  long nbc;
376  extract_neighbourlist(NULL,mindSTRONG[i],&n,&nbc);
377  if(nbc > 1) {
378  (*trck)[i] = new Track(&(n[1]),nbc-1);
379  foundSTRONG = 1;
380  }
381  delete n;
382  }
383  }
384 }
386  if(s == NULL)
387  return 1;
388  else{
389  STRONG *k = s;
390  while((k->from != NULL) && (k->via != n) && (k->via != n->brthr))
391  k = (STRONG*) k->from;
392  if(k->from != NULL)
393  return 0;
394  else
395  return 1;
396  }
397 }
399  return int((t->hm + n->hm)/hs->hmstep);
400 }
402  hm = t->hm;
403  hmup = t->hmup;
404  hmdown = t->hmdown;
405 
407  if(hmup > hs->dhmin)
408  return int((hm + hmup)/hs->hmstep);
409  else
410  return int(hm/hs->hmstep);
411 }
413  hm = t->hm;
414  hmup = t->hmup;
415  hmdown = t->hmdown;
416  Psum = t->Psum;
417  dP = t->dP;
419  if(dP > hs->minP)
420  return int((Psum + dP)/hs->hmstep);
421  else
422  return int(Psum/hs->hmstep);
423 }
424 
426  /*addiert die Höhenmeter eines Weges zu den Gesamthöhenmetern, sofern die
427  STRONGPlus_restriciton dabei erfüllt ist*/
428  short result = 1;
429  if(n->rd == fw){
430  /*Lese die Höhendaten vorwaerts*/
431  for(int i = 1; i < n->tpc; i++){
432  if(n->tp[i].h > n->tp[i-1].h)
433  hmup = hmup + n->tp[i].h - n->tp[i-1].h;
434  else
435  hmdown = hmdown + n->tp[i-1].h - n->tp[i].h;
436  if(hmup > 0 && 1.*(hmdown)/(hmup) > hs->downtoupmax){
437  /*die STRONGPlus_restricition "Anstiege muessen wesentlich mehr
438  bergauf als bergab gehen" ist verletzt, der Anstieg endet an
439  dieser Stelle*/
440  result = 0;
441  if(hmup > hs->dhmin)
442  /*aber die zweite restricition ist erfüllt, der Anstieg hat
443  die Mindesthöhendifferenz dhmin*/
444  hm = hm + hmup;
445 
446  hmup = 0.; //Reset
447  hmdown = 0.; //Reset
448  }
449  }
450  }
451  else{
452  /*Lese die Hoehendaten rueckwaerts*/
453  for(int i = n->tpc-2; i >= 0; i--){
454  if(n->tp[i].h > n->tp[i+1].h)
455  hmup = hmup + n->tp[i].h - n->tp[i+1].h;
456  else
457  hmdown = hmdown + n->tp[i+1].h - n->tp[i].h;
458  if(hmup > 0 && 1.*(hmdown)/(hmup) > hs->downtoupmax){
459  /*die STRONGPlus_restricition "Anstiege muessen wesentlich mehr
460  bergauf als bergab gehen" ist verletzt, der Anstieg endet an
461  dieser Stelle*/
462  result = 0;
463  if(hmup > hs->dhmin)
464  /*aber die zweite restricition ist erfüllt, der Anstieg hat
465  die Mindesthöhendifferenz dhmin*/
466  hm = hm + hmup;
467 
468  hmup = 0.; //Reset
469  hmdown = 0.; //Reset
470  }
471  }
472  }
473  return result;
474 }
476  // refreshs Prec if neccessary
477  short result = 1;
478  float slope, dd;
479  if(n->rd == fw){
480  /*Lese die Höhendaten vorwaerts*/
481  for(int i = 1; i < n->tpc; i++){
482  if(n->tp[i].h > n->tp[i-1].h){
483  hmup = hmup + n->tp[i].h - n->tp[i-1].h;
484  dd = n->tp[i].d - n->tp[i-1].d;
485  if(dd > 0){
486  slope = qMin(float(0.28),(n->tp[i].h - n->tp[i-1].h)/(dd*1000));
487  if(slope > 0.035)
488  dP += slope*slope*dd*1000;
489  }
490  }
491  else
492  hmdown = hmdown + n->tp[i-1].h - n->tp[i].h;
493  if(hmup > 0 && 1.*(hmdown)/(hmup) > hs->downtoupmax){
494  /*die STRONGPlus_restricition "Anstiege muessen wesentlich mehr
495  bergauf als bergab gehen" ist verletzt, der Anstieg endet an
496  dieser Stelle*/
497  result = 0;
498  if(hmup > hs->dhmin)
499  /*aber die zweite restricition ist erfüllt, der Anstieg hat
500  die Mindesthöhendifferenz dhmin*/
501  hm = hm + hmup;
502  hmup = 0.; //Reset
503  hmdown = 0.; //Reset
504  if(dP > hs->minP)
505  Psum += dP;
506  dP = 0.;
507 
508  }
509  }
510  }
511  else{
512  /*Lese die Hoehendaten rueckwaerts*/
513  for(int i = n->tpc-2; i >= 0; i--){
514  if(n->tp[i].h > n->tp[i+1].h){
515  hmup = hmup + n->tp[i].h - n->tp[i+1].h;
516  dd = n->tp[i+1].d - n->tp[i].d;
517  if(dd > 0){
518  slope = qMin(float(0.28),(n->tp[i].h - n->tp[i+1].h)/(dd*1000));
519  if(slope > 0.035)
520  dP += slope*slope*dd*1000;
521  }
522  }
523  else
524  hmdown = hmdown + n->tp[i+1].h - n->tp[i].h;
525  if(hmup > 0 && 1.*(hmdown)/(hmup) > hs->downtoupmax){
526  /*die STRONGPlus_restricition "Anstiege muessen wesentlich mehr
527  bergauf als bergab gehen" ist verletzt, der Anstieg endet an
528  dieser Stelle*/
529  result = 0;
530  if(hmup > hs->dhmin)
531  /*aber die zweite restricition ist erfüllt, der Anstieg hat
532  die Mindesthöhendifferenz dhmin*/
533  hm = hm + hmup;
534 
535  hmup = 0.; //Reset
536  hmdown = 0.; //Reset
537  if(dP > hs->minP)
538  Psum += dP;
539  dP = 0.;
540  }
541  }
542  }
543  return result;
544 }
545 
547  Neighbour ***nl,long int* nc){
548  STRONG* st = e;
549  int nct = 0;
550  while(st != s){
551  st = (STRONG*)st->from;
552  nct++;
553  }
554  *nl = new Neighbour*[nct];
555  *nc = nct;
556  st = e;
557  while(st != s){
558  nct--;
559  (*nl)[nct] = st->via;
560  st = (STRONG*)st->from;
561  }
562 }
563 void STRONGcalc::store_STRONG(STRONGfib* t, Neighbour* n, int si, int i){
564  /*als STRONG speichern*/
565  STRONGfib* t2 = f[si]->ins(t->d + n->d);
566  t2->k = n->nb;
567  t2->from = &(t->k->cd->s[i]);
568  t2->via = n;
569  t2->hm = t->hm + n->hm;
570  n->nb->cd->s[si].from = t2;
571 
572 }
574  /*als STRONGplus speichern*/
575  STRONGPlusfib* t2 = fplus[si]->ins(t->d + n->d);
576  t2->k = n->nb;
577  t2->from = &(t->k->cd->s[i]);
578  t2->via = n;
579  t2->hm = hm;
580  t2->hmup = hmup;
581  t2->hmdown = hmdown;
582  n->nb->cd->s[si].from = t2;
583 }
585  /*als STRONGclimb speichern*/
586  STRONGClimbfib* t2 = fclimb[si]->ins(t->d + n->d);
587  t2->k = n->nb;
588  t2->from = &(t->k->cd->s[i]);
589  t2->via = n;
590  t2->hm = hm;
591  t2->hmup = hmup;
592  t2->hmdown = hmdown;
593  t2->Psum = Psum;
594  t2->dP = dP;
595  n->nb->cd->s[si].from = t2;
596 }
597 
598 
600  calcstopped = 1;
601 }
602 STRONGcalc::STRONGcalc(OSM* o, int N, char* filename,Track***results){
603  // saves STRONG calculation
604  this->o = o;
605  strcpy(this->filename,filename);
606  runmode = RMsave;
607  this->N = N;
608  this->trck = results;
609 }
610 void STRONGcalc::save_crossdata(KOO *k, FILE* f){
611  if(k != NULL){
612  if(k->cd != NULL && k->cd->s != NULL){
613  fwrite(&(k->id),sizeof(qint64),1,f);
614  for(int i = 0; i < N; i++)
615  if(k->cd->s[i].from != NULL){
616  fwrite(&(k->cd->s[i].via->brthr->nb->id),sizeof(qint64),1,f);
617  fwrite(&(k->cd->s[i].via->way->id),sizeof(qint64),1,f);
618  int sindex = (STRONG*)k->cd->s[i].from
619  - &(k->cd->s[i].via->brthr->nb->cd->s[0]);
620  fwrite(&(sindex),sizeof(int),1,f);
621  }
622  else{
623  qint64 buf64 = -1;
624  int bufint = -1;
625  fwrite(&(buf64),sizeof(qint64),1,f);
626  fwrite(&(buf64),sizeof(qint64),1,f);
627  fwrite(&(bufint),sizeof(int),1,f);
628  }
629  }
630  save_crossdata(k->l,f);
631  save_crossdata(k->r,f);
632  }
633 }
635  qint64 kid,wid;
636  int sindex;
637  fread(&(kid),sizeof(qint64),1,f);
638  KOO* k = o->search(kid,o->get_first_KOO());
639  if(k != NULL && k->cd != NULL){
640  counter++;
641  for(int i = 0; i < N; i++){
642  fread(&(kid),sizeof(qint64),1,f);
643  fread(&(wid),sizeof(qint64),1,f);
644  fread(&(sindex),sizeof(int),1,f);
645 
646  Neighbour* nb = k->cd->neighbours;
647  while(nb != NULL && (nb->nb->id != kid || nb->way->id != wid))
648  nb = nb->next;
649  if(nb != NULL){
650  k->cd->s[i].via = nb->brthr;
651  k->cd->s[i].from = &(nb->nb->cd->s[sindex]);
652  }
653  else{
654  k->cd->s[i].via = dummy;
655  k->cd->s[i].from = NULL;
656  }
657  }
658  }
659  else
660  fseek(f,N*(2*sizeof(qint64)+sizeof(int)),SEEK_CUR);
661 }
662 
663 STRONGcalc::STRONGcalc(OSM* o, int*N, char* filename,Track*** results){
664  // loads STRONG calculation
665  this->o = o;
666  strcpy(this->filename,filename);
667  runmode = RMload;
668  Nout = N;
669  this->trck = results;
670 }
672  // loads STRONG calculation
673  qint64 kid;
674  FILE* f = fopen(filename,"rb");
675  if(f != NULL){
676  fread(Nout,sizeof(int),1,f);
677  N = *Nout;
678  s = e = NULL;
679  STRONGsetting hst;
680  hs = &hst;
681  init_Strong();
682  counter = 0;
683  int crosscount;
684  fread(&(crosscount),sizeof(int),1,f);
685  for(int i = 0; i < crosscount; i++)
686  load_crossdata(f);
687  *trck = new Track*[N];
688  for(int i = 0; i < N; i++){
689  fread(&(kid),sizeof(qint64),1,f);
690  KOO* k = o->search(kid,o->get_first_KOO());
691  if(k != NULL && k->cd != NULL){
692  e = k;
693  STRONG_to_trck(i);
694  }
695  else
696  (*trck)[i] = NULL;
697  }
698  fclose(f);
699  delete this->f;
700  delete mind;
701  delete mindSTRONG;
702  foundSTRONG = 1;
703  }
704  else
705  foundSTRONG = 0;
706 }
708  FILE* f = fopen(filename,"wb");
709  if(f != NULL){
710  this->N = N;
711  fwrite(&(N),sizeof(int),1,f);
712  int crosscount = o->count_STRONG(o->get_first_KOO());
713  fwrite(&(crosscount),sizeof(int),1,f);
715  for(int i = 0; i < N; i++)
716  if((*trck)[i] != NULL)
717  fwrite(&((*trck)[i]->get_last_KOO()->id),sizeof(qint64),1,f);
718  else{
719  qint64 buf64 = -1;
720  fwrite(&(buf64),sizeof(qint64),1,f);
721  }
722  foundSTRONG = 1;
723  fclose(f);
724  }
725  else
726  foundSTRONG = 0;
727 
728 }
double hmperkm
hmmax=max(hmmax,radius*hmperkm)
Definition: DataTyps.h:294
void calc(FibunacciHeap< T > **f)
core function of the algorithm
Definition: strongcalc.cpp:83
double * mind
Definition: strongcalc.h:148
void setSTRONG(KOO *k)
Definition: strongcalc.cpp:336
Neighbour * via
connection to reach this STRONG
Definition: DataTyps.h:258
Track *** trck
intermediate results of iterations
Definition: strongcalc.h:135
void extract_neighbourlist(STRONG *s, STRONG *e, Neighbour ***nl, long int *nc)
reconstructs link between start STRONG and end STRONG
Definition: strongcalc.cpp:546
void STRONG_to_trck(int i)
Definition: strongcalc.cpp:356
Way * way
Neighbour lives uses this Way.
Definition: DataTyps.h:53
FibunacciHeap< STRONGClimbfib > ** fclimb
Definition: strongcalc.h:146
FibunacciHeap element to store STRONG data with climb restrictions.
Definition: DataTyps.h:270
int hmmax
finalization criterium absolute
Definition: DataTyps.h:293
void refresh_progress(int step)
emitted if iteration step has finished
char filename[999]
for save and load
Definition: strongcalc.h:130
STRONGsetting * hs
major settings of the calculation
Definition: strongcalc.h:134
float minP
defines climb: min. difficulty
Definition: DataTyps.h:297
KOO * get_first_KOO()
returns root of node-AVL tree
Definition: osm.cpp:1692
container struct to hold data of a coordinate
Definition: DataTyps.h:82
void init_Strong()
Definition: strongcalc.cpp:161
int count_STRONG(KOO *k)
counts STRONG data recursivly
Definition: osm.cpp:803
STRONG * from
pointer to related STRONG struct
Definition: DataTyps.h:265
int extract_STRONGPlus_restriciton(Neighbour *n)
checks if STRONG can expand concerning restrictions
Definition: strongcalc.cpp:425
double lat
Definition: DataTyps.h:86
float hmdown
Definition: strongcalc.h:153
KOO * nb
Definition: DataTyps.h:54
float downtoupmax
defines climb: allowed down Hm
Definition: DataTyps.h:296
FibunacciHeap element to store STRONG data.
Definition: DataTyps.h:261
KOO * s
start point
Definition: strongcalc.h:131
void reset_Hm(KOO *k)
resets Neighbour Hm to ascenting vertical meters
Definition: osm.cpp:2710
routing container struct, connects cross via Way with each other
Definition: DataTyps.h:47
int hmstep
Additional criteria for STRONGPlus defining climb.
Definition: DataTyps.h:292
STRONGcalc(OSM *o, KOO *s, KOO *e, char max, char min, STRONGsetting *hs, Track ***trck, int *N, bool Hmonly)
STRONG calculation.
Definition: strongcalc.cpp:3
int extract_STRONGClimb_restriciton(Neighbour *n)
checks if STRONG can expand concerning restrictions
Definition: strongcalc.cpp:475
void init_AreaStrongClimb(KOO *k)
Definition: strongcalc.cpp:316
Neighbour * next
next Neighbour, set to NULL if last
Definition: DataTyps.h:63
KOO * e
end point
Definition: strongcalc.h:132
void load_STRONG()
executes the loading of a STRONG network from file filename
Definition: strongcalc.cpp:671
float hmup
Definition: strongcalc.h:153
FibunacciHeap element to store STRONG data with climb analysis.
Definition: DataTyps.h:280
bool noSTRONGPlus
dont apply climb restrictions
Definition: DataTyps.h:298
void init_AreaStrongPlus(KOO *k)
Definition: strongcalc.cpp:299
float hmup
Hm ascenting since last big descent section.
Definition: DataTyps.h:273
STRONG * s
memory for routing algorithms
Definition: DataTyps.h:75
qint64 id
OSM way id
Definition: DataTyps.h:123
RunMode runmode
type of STRONGcalc to be executed
Definition: strongcalc.h:128
qint64 id
id inherited from OSM data
Definition: DataTyps.h:83
void points_Hm(KOO *k)
accumulates section difficulties instead of vertical meters in Neighbour relation ...
Definition: osm.cpp:2733
void load_crossdata(FILE *f)
low level load routine of load_STRONG
Definition: strongcalc.cpp:634
official representation of Track in BTP3
Definition: track.h:14
readdirection rd
Definition: DataTyps.h:52
FibunacciHeap< STRONGfib > ** f
Definition: strongcalc.h:144
char type
classification
Definition: DataTyps.h:129
void save_STRONG()
executes the save of a STRONG network to file filename
Definition: strongcalc.cpp:707
float d
current distance at STRONG
Definition: DataTyps.h:263
void finished(int succesful)
returns succes if a track was extracted from the STRONG network
char min
restrictions on Neighbour Way type
Definition: strongcalc.h:133
void init_AreaStrong(KOO *k)
Definition: strongcalc.cpp:284
double rfac
Area restricitions of STRONG routing.
Definition: DataTyps.h:290
float hm
Definition: strongcalc.h:153
Neighbour * via
connection to STRONG
Definition: DataTyps.h:267
void stop_calculations()
sets STRONGcalc::calcstopped and stops algorithm in next iteration
Definition: strongcalc.cpp:599
KOO * search(qint64 id, KOO *s)
Definition: osm.cpp:105
void * from
&lt; pointer to STRONG or FibunacciHeap
Definition: DataTyps.h:257
STRONG ** mindSTRONG
end point array of shortest track at specific strong index
Definition: strongcalc.h:150
short traceback(STRONG *s, Neighbour *n)
reconstructs track and checks if Neighbour n was already used
Definition: strongcalc.cpp:385
float hmdown
Hm descenting since last big descenting section.
Definition: DataTyps.h:277
KOO * k
current KOO
Definition: DataTyps.h:266
int index_STRONG(STRONGfib *t, Neighbour *n)
Definition: strongcalc.cpp:398
FibunacciHeap< STRONGPlusfib > ** fplus
Definition: strongcalc.h:145
float d
distance
Definition: DataTyps.h:58
Neighbour * dummy
Definition: strongcalc.h:141
void init_StrongClimb()
Definition: strongcalc.cpp:241
float Psum
Definition: strongcalc.h:153
int tpc
count of trackpoint
Definition: DataTyps.h:60
Neighbour * neighbours
neigbours to link to other cross
Definition: DataTyps.h:74
BTP3 database, created from OpenStreetMap data.
Definition: osm.h:34
void store_STRONG(STRONGfib *t, Neighbour *n, int si, int i)
Definition: strongcalc.cpp:563
float hm
current Hm at STRONG
Definition: DataTyps.h:264
OSM * o
dataset to operate on
Definition: strongcalc.h:129
float hm
total height meter, for routing
Definition: DataTyps.h:57
short dhmin
defines climb: min. Hm
Definition: DataTyps.h:295
trackpoint * tp
heighdata of this Neighbour
Definition: DataTyps.h:62
short foundSTRONG
if 1 return succes when finished
Definition: strongcalc.h:140
float radius
data ellipse radius calculated from STRONGsetting and start/ end point
Definition: strongcalc.h:139
float dP
Definition: strongcalc.h:153
void save_crossdata(KOO *k, FILE *f)
low level save routine of save_STRONG
Definition: strongcalc.cpp:610
void init_StrongPlus()
Definition: strongcalc.cpp:200
Neighbour * brthr
related Neighbour with opposite read direction supposed to store brthr
Definition: DataTyps.h:56
main struct for routing purpose
Definition: DataTyps.h:255