aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2005-06-14 13:13:57 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2005-06-14 13:13:57 +0000
commitc6e36a0baef1389f868d84e2c23a0b749348e3d9 (patch)
tree597911cf022f9af7489bcb19643876d60a681307
parentd3cdc1a8c60f30003b981631f8da2b6836f7a01f (diff)
implement verbose_level = "physics highlights"
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1421 f88db872-0e4f-0410-b76b-b9085cfa78c5
-rw-r--r--doc/documentation.tex7
-rw-r--r--param.ccl3
-rw-r--r--src/driver/find_horizons.cc57
3 files changed, 60 insertions, 7 deletions
diff --git a/doc/documentation.tex b/doc/documentation.tex
index 6cf6183..7b62027 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -435,10 +435,9 @@ section~\ref{AHFinderDirect/sect-examples} should make this clear.
\begin{description}
\item[\code{"physics highlights"}]
\mbox{}\\
- Print only a line or two each time
- \thorn{AHFinderDirect} runs, giving the
- number of horizons found and their irreducible masses.
- (This isn't implemented yet.)
+ Print only a single line each time
+ \thorn{AHFinderDirect} runs, giving which
+ horizons were found.
\item[\code{"physics details"}]
\mbox{}\\
Print two lines for each horizon found, giving
diff --git a/param.ccl b/param.ccl
index 57b0b94..ac30220 100644
--- a/param.ccl
+++ b/param.ccl
@@ -165,8 +165,7 @@ Boolean always_broadcast_horizon_shape \
keyword verbose_level \
"controls which (how many) messages to print describing AH finding"
{
-# 1 line each time step giving number of horizons found and their masses
-# ... this doesn't work yet :(
+# 1 line each time step giving which horizons were found
"physics highlights" :: "just a few physics messages"
# 1 line for each horizon giving position/mass/area, + a summary line or two
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 <assert.h>
#include <math.h>
-#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;
}
@@ -215,6 +223,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);
+}
+ }
+
+//******************************************************************************
//******************************************************************************
//******************************************************************************