@@ -344,7 +344,7 @@ Simulation::get_file_handle( const Topography & topography, OutputQuantity outpu
344344
345345void Simulation::compute_topography_thickness ()
346346{
347- // Compute the thickness by substracting the initial topography and correcting for the thickening parametr
347+ // Compute the thickness by subtracting the initial topography and correcting for the thickening parametr
348348 topography_thickness = topography;
349349 topography_thickness.no_data_value = DEFAULT_NO_DATA_VALUE_THICKNESS;
350350 topography_thickness.height_data -= topography_initial.height_data ;
@@ -369,6 +369,34 @@ void Simulation::write_thickness_if_necessary( int n_lobes_processed )
369369 }
370370}
371371
372+ void Simulation::save_post_run_output ()
373+ {
374+ // Save initial topography to asc file
375+ auto file_initial = get_file_handle ( topography_initial, OutputQuantity::Height );
376+ file_initial->save ( input.output_folder / fmt::format ( " {}_DEM" , input.run_name ) );
377+
378+ // Save final topography to asc file
379+ if ( input.save_final_dem )
380+ {
381+ auto file_final = get_file_handle ( topography, OutputQuantity::Height );
382+ file_final->save ( input.output_folder / fmt::format ( " {}_DEM_final" , input.run_name ) );
383+ }
384+
385+ // Save full thickness to asc file
386+ compute_topography_thickness ();
387+ auto file_thick = get_file_handle ( topography_thickness, OutputQuantity::Height );
388+ file_thick->save ( input.output_folder / fmt::format ( " {}_thickness_full" , input.run_name ) );
389+
390+ // Save the full hazard map
391+ if ( input.save_hazard_data )
392+ {
393+ auto file_hazard = get_file_handle ( topography, OutputQuantity::Hazard );
394+ file_hazard->save ( input.output_folder / fmt::format ( " {}_hazard_full" , input.run_name ) );
395+ }
396+
397+ write_avg_thickness_file ();
398+ }
399+
372400void Simulation::run ()
373401{
374402 int n_lobes_processed = 0 ;
@@ -527,30 +555,7 @@ void Simulation::run()
527555
528556 fmt::print ( " Used RNG seed: {}\n " , rng_seed );
529557
530- // Save initial topography to asc file
531- auto file_initial = get_file_handle ( topography_initial, OutputQuantity::Height );
532- file_initial->save ( input.output_folder / fmt::format ( " {}_DEM" , input.run_name ) );
533-
534- // Save final topography to asc file
535- if ( input.save_final_dem )
536- {
537- auto file_final = get_file_handle ( topography, OutputQuantity::Height );
538- file_final->save ( input.output_folder / fmt::format ( " {}_DEM_final" , input.run_name ) );
539- }
540-
541- // Save full thickness to asc file
542- compute_topography_thickness ();
543- auto file_thick = get_file_handle ( topography_thickness, OutputQuantity::Height );
544- file_thick->save ( input.output_folder / fmt::format ( " {}_thickness_full" , input.run_name ) );
545-
546- // Save the full hazard map
547- if ( input.save_hazard_data )
548- {
549- auto file_hazard = get_file_handle ( topography, OutputQuantity::Hazard );
550- file_hazard->save ( input.output_folder / fmt::format ( " {}_hazard_full" , input.run_name ) );
551- }
552-
553- write_avg_thickness_file ();
558+ save_post_run_output ();
554559}
555560
556561} // namespace Flowy
0 commit comments