refactored data loading code
This commit is contained in:
parent
6f6df97af8
commit
1067c6a514
8 changed files with 74 additions and 128 deletions
|
|
@ -1,5 +1,4 @@
|
|||
use fapra_osm_2::gridgraph::GridGraph;
|
||||
use std::fs::File;
|
||||
use fapra_osm_2::utils::load_graph;
|
||||
use clap::Parser;
|
||||
use std::process::exit;
|
||||
use rand::seq::SliceRandom;
|
||||
|
|
@ -21,21 +20,7 @@ struct Args {
|
|||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let file = match File::open(args.graph.clone()) {
|
||||
Ok(f) => f,
|
||||
Err(e) => {
|
||||
println!("Error while opening the file {}: {}", args.graph, e);
|
||||
exit(1)
|
||||
}
|
||||
};
|
||||
|
||||
let graph = match GridGraph::from_fmi_file(file) {
|
||||
Ok(g) => g,
|
||||
Err(e) => {
|
||||
println!("Error while reading the graph: {:?}", e);
|
||||
exit(1);
|
||||
}
|
||||
};
|
||||
let graph = load_graph(&args.graph);
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue