Skip to content
Snippets Groups Projects
Select Git revision
  • 29d6120e813a04eff64ab4955f8dbcbd09105a1c
  • bing_issues#190_tf2
  • bing_tf2_convert
  • bing_issue#189_train_modular
  • simon_#172_integrate_weatherbench
  • develop
  • bing_issue#188_restructure_ambs
  • yan_issue#100_extract_prcp_data
  • bing_issue#170_data_preprocess_training_tf1
  • Gong2022_temperature_forecasts
  • bing_issue#186_clean_GMD1_tag
  • yan_issue#179_integrate_GZAWS_data_onfly
  • bing_issue#178_runscript_bug_postprocess
  • michael_issue#187_bugfix_setup_runscript_template
  • bing_issue#180_bugs_postprpocess_meta_postprocess
  • yan_issue#177_repo_for_CLGAN_gmd
  • bing_issue#176_integrate_weather_bench
  • michael_issue#181_eval_era5_forecasts
  • michael_issue#182_eval_subdomain
  • michael_issue#119_warmup_Horovod
  • bing_issue#160_test_zam347
  • ambs_v1
  • ambs_gmd_nowcasting_v1.0
  • GMD1
  • modular_booster_20210203
  • new_structure_20201004_v1.0
  • old_structure_20200930
27 results

DataPreprocess_to_tf.sh

Blame
  • RoutingEngine.cpp 3.32 KiB
    /**
     * \file        RoutingEngine.cpp
     * \date        Jan 10, 2013
     * \version     v0.6
     * \copyright   <2009-2014> Forschungszentrum Jülich GmbH. All rights reserved.
     *
     * \section License
     * This file is part of JuPedSim.
     *
     * JuPedSim is free software: you can redistribute it and/or modify
     * it under the terms of the GNU Lesser General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * any later version.
     *
     * JuPedSim is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU Lesser General Public License
     * along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
     *
     * \section Description
     *
     *
     **/
    
    
    #include "RoutingEngine.h"
    #include "../pedestrian/Pedestrian.h"
    
    using namespace std;
    
    
    RoutingEngine::RoutingEngine()
    {
    
    }
    
    RoutingEngine::~RoutingEngine()
    {
         for(unsigned int r=0; r<_routersCollection.size(); r++) {
              delete _routersCollection[r];
         }
         _routersCollection.clear();
    }
    
    void RoutingEngine::AddFinalDestinationID(int id)
    {
         for(unsigned int r=0; r<_routersCollection.size(); r++) {
              _routersCollection[r]->AddFinalDestinationID(id);
         }
    }
    
    void RoutingEngine::FindRoute(Pedestrian* ped)
    {
         ped->FindRoute();
    }
    
    void RoutingEngine::AddRouter(Router* router)
    {
         for(unsigned int r=0; r<_routersCollection.size(); r++) {
              if(_routersCollection[r]->GetStrategy()==router->GetStrategy()) {
                   Log->Write("ERROR: \tDuplicate router found with 'id' [%d].",router->GetID());
                   Log->Write("ERROR: \tDouble check your configuration files");
                   exit(EXIT_FAILURE);
              }
         }
         _routersCollection.push_back(router);
    }
    
    const vector<string>& RoutingEngine::GetTrip(int index) const
    {
         if ((index >= 0) && (index < (int) _tripsCollection.size()))
              return _tripsCollection[index];
         else {
              char tmp[CLENGTH];
              sprintf(tmp, "ERROR: \tWrong 'index' [%d] > [%d] in Routing::GetTrip()",
                      index, int(_tripsCollection.size()));
              Log->Write(tmp);
              exit(EXIT_FAILURE);
         }
    }
    
    const std::vector<Router*> RoutingEngine::GetAvailableRouters() const
    {
         return _routersCollection;
    }
    
    
    Router* RoutingEngine::GetRouter(RoutingStrategy strategy) const
    {
         for(Router* router:_routersCollection)
         {
              if(router->GetStrategy()==strategy)
                   return router;
         }
         Log->Write("ERROR: \t Could not Find any router with Strategy:  [%d].",strategy);
         return /*(Router*)*/ nullptr;
    }
    
    Router* RoutingEngine::GetRouter(int id) const
    {
         for(Router* router:_routersCollection)
         {
              if(router->GetID()==id)
                   return router;
         }
         Log->Write("ERROR: \t Could not Find any router with ID:  [%d].",id);
         return /*(Router*)*/ nullptr;
    }
    
    void RoutingEngine::AddTrip(vector<string> trip)
    {
         _tripsCollection.push_back(trip);
    }
    
    bool RoutingEngine::Init(Building* building)
    {
         bool status=true;
         for(unsigned int r=0; r<_routersCollection.size(); r++) {
              if(_routersCollection[r]->Init(building)==false)
                   status=false;
         }
         return status;
    }