yakra / DataProcessing

Data Processing Scripts and Programs for Travel Mapping Project
0 stars 0 forks source link

TMArray notepad #260

Closed yakra closed 9 months ago

yakra commented 10 months ago

Just leaving this here to save some experimental code from dead branches for future reference.

yakra commented 10 months ago

Concurrency detection

switch & break

Almost used this for production, but simplifying HighwaySegment::add_concurrency outweighed the extra iteration & comparisons in concurrency_detection.cpp.

void HighwaySegment::add_concurrency(std::ofstream& concurrencyfile, Waypoint* w)
{   HighwaySegment& other = w->route->segments[w - w->route->points.data];
    switch (bool(concurrent) + bool(other.concurrent))
    {   case 0:
        concurrent = new std::list<HighwaySegment*>;
                 // deleted by ~HighwaySegment
        other.concurrent = concurrent;
        concurrent->push_back(this);
        concurrent->push_back(&other);
        concurrencyfile << "New concurrency [" << str() << "][" << other.str() << "] (2)\n";
        return;

        case 1:
        if (concurrent)
             {  other.concurrent = concurrent;
            concurrent->push_back(&other);
             }
        else {  concurrent = other.concurrent;
            other.concurrent->push_back(this);
             }
        concurrencyfile << "Extended concurrency ";
        for (HighwaySegment *x : *concurrent)
            concurrencyfile << '[' << x->str() << ']';
        concurrencyfile << " (" << concurrent->size() << ")\n";
    }
}
    if (w1->route == w2->route)
    {   s.add_concurrency(concurrencyfile, w1);
    break;
    }
}
else if (w2 == w1-1 && w1->route == w2->route)
{   s.add_concurrency(concurrencyfile, w2);
    break;
}

conc branch

yakra commented 9 months ago

RWpt NmpS NmpL Conc Intg List Hash Logs Augm Augm_Ubuntu Stat Data User Edge Graph_Linux Graph Total Total_linux ErCh SQL_crr SQL_rtes SQL_wpts SQL_seg