From c6e36a0baef1389f868d84e2c23a0b749348e3d9 Mon Sep 17 00:00:00 2001 From: jthorn Date: Tue, 14 Jun 2005 13:13:57 +0000 Subject: implement verbose_level = "physics highlights" git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1421 f88db872-0e4f-0410-b76b-b9085cfa78c5 --- src/driver/find_horizons.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc index a4d2b65..1079bcb 100644 --- a/src/driver/find_horizons.cc +++ b/src/driver/find_horizons.cc @@ -6,6 +6,8 @@ // AHFinderDirect_find_horizons - top-level driver to find apparent horizons /// /// find_horizon - find a horizon +/// print_summary_of_which_horizons_found +/// /// do_evaluate_expansions /// do_test_expansion_Jacobian /// @@ -14,7 +16,7 @@ #include #include -#include "util_Table.h" +#include "util_String.h" #include "cctk.h" #include "cctk_Arguments.h" @@ -61,6 +63,8 @@ extern struct state state; // ***** prototypes for functions local to this file // namespace { +void print_summary_of_which_horizons_found + (int N_horizons, const struct AH_data* const* AH_data_array); void do_evaluate_expansions(int my_proc, int N_horizons, horizon_sequence& hs, struct AH_data* const AH_data_array[], @@ -194,6 +198,10 @@ case method__find_horizons: state.isb); if (state.timer_handle >= 0) then CCTK_TimerStopI(state.timer_handle); + if (verbose_info.print_physics_highlights + && !verbose_info.print_physics_details) + then print_summary_of_which_horizons_found(N_horizons, + state.AH_data_array); break; } @@ -214,6 +222,53 @@ if (state.timer_handle >= 0) } } +//****************************************************************************** + +// +// This function prints (using CCTK_VInfo()) a 1-line summary of +// which AHs were / were not found. +// +namespace { +void print_summary_of_which_horizons_found + (int N_horizons, const struct AH_data* const* AH_data_array) +{ +const int hn_buffer_size = 10; // buffer for single "%d" for hn +char hn_buffer[hn_buffer_size]; +const int msg_buffer_size = 200; // buffer for the entire line +char msg_buffer[msg_buffer_size]; + +msg_buffer[0] = '\0'; +Util_Strlcpy(msg_buffer, "found horizon(s) ", msg_buffer_size);; + +bool already_found_flag = false; // running inclusive-or of found_flag + for (int hn = 1 ; hn <= N_horizons ; ++hn) + { + assert(AH_data_array[hn] != NULL); + bool found_flag = AH_data_array[hn]->found_flag; + if (found_flag) + then { + if (already_found_flag) + then Util_Strlcat(msg_buffer, ",", msg_buffer_size); + already_found_flag = true; + snprintf(hn_buffer, hn_buffer_size, "%d", hn); + Util_Strlcat(msg_buffer, hn_buffer, msg_buffer_size); + } + } + +if (already_found_flag) + then { + // we found one or more horizons + Util_Strlcat(msg_buffer, " of ", msg_buffer_size); + + snprintf(hn_buffer, hn_buffer_size, "%d", N_horizons); + Util_Strlcat(msg_buffer, hn_buffer, msg_buffer_size); + } + else Util_Strlcpy(msg_buffer, "no horizons found", msg_buffer_size); + +CCTK_VInfo(CCTK_THORNSTRING, msg_buffer); +} + } + //****************************************************************************** //****************************************************************************** //****************************************************************************** -- cgit v1.2.3