void reference_integration() { DEBUG_OUTPUT(2, "Make a copy of ensemble for reference ensemble" ); reference_ens = initial_ens.clone(); DEBUG_OUTPUT(1, "Reference integration" ); prepare_integrator(); integ->set_ensemble( reference_ens ); integ->integrate(); }
void run_integration(){ if(!validate_configuration(cfg) ) ERROR( "Invalid configuration" ); load_generate_ensemble(); DEBUG_OUTPUT(2, "Make a copy of ensemble for energy conservation test" ); current_ens = initial_ens.clone(); prepare_integrator(); double integration_time = watch_time ( cfg.valid("interval") ? stability_test : generic_integrate ); save_ensemble(); INFO_OUTPUT( 1, "Integration time: " << integration_time << " ms " << std::endl); }
void output_test() { if(!validate_configuration(cfg) ) ERROR( "Invalid configuration" ); if(!read_input_file(initial_ens, cfg) ) { ERROR("you should have a tested input file"); } DEBUG_OUTPUT(2, "Make a copy of ensemble for energy conservation test" ); current_ens = initial_ens.clone(); prepare_integrator(); double integration_time = watch_time ( cfg.valid("interval") ? stability_test : generic_integrate ); if(read_output_file(reference_ens,cfg)){ // Compare with reneference ensemble for integrator verification double pos_diff = 0, vel_diff = 0, time_diff = 0; bool comparison = compare_ensembles( current_ens, reference_ens , pos_diff, vel_diff, time_diff ); INFO_OUTPUT(1,"\tPosition difference: " << pos_diff << endl << "\tVelocity difference: " << vel_diff << endl << "\tTime difference: " << time_diff << endl ); if( !comparison || pos_diff > pos_threshold || vel_diff > vel_threshold || time_diff > time_threshold ){ INFO_OUTPUT(0, "Test failed" << endl); exit(1); }else { INFO_OUTPUT(0, "Test success" << endl); } }else{ ERROR("You should provide a test output file"); } INFO_OUTPUT( 1, "Integration time: " << integration_time << " ms " << std::endl); }
void benchmark_item(const string& param, const string& value) { //outputConfigSummary(std::cout,cfg); if(!validate_configuration(cfg) ) ERROR( "Invalid configuration" ); if(param == "input" || param == "nsys" || param == "nbod" || cfg.count("reinitialize")) load_generate_ensemble(); DEBUG_OUTPUT(2, "Make a copy of ensemble for energy conservation test" ); current_ens = initial_ens.clone(); double init_time = watch_time( prepare_integrator ); double integration_time = watch_time( generic_integrate ); double max_deltaE = find_max_energy_conservation_error(current_ens, initial_ens ); // Compare with reneference ensemble for integrator verification double pos_diff = 0, vel_diff = 0, time_diff = 0; bool comparison = compare_ensembles( current_ens, reference_ens , pos_diff, vel_diff, time_diff ); /// CSV output for use in spreadsheet software std::cout << param << ", " << value << ", " << current_ens.time_ranges() << ", " << max_deltaE << ", " << pos_diff << ", " << vel_diff << ", " << time_diff << ", " << integration_time << ", " << init_time << std::endl; if( !comparison || pos_diff > pos_threshold || vel_diff > vel_threshold || time_diff > time_threshold ){ fail_verify(); } }