aboutsummaryrefslogtreecommitdiff
path: root/src/driver/find_horizons.cc
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-01-17 11:57:41 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-01-17 11:57:41 +0000
commit64e9063e97a60d26f672166b61e390e9b8eb3680 (patch)
treec25d1ed0fcd09b9fce2e6b2ea025fd7dce6538ea /src/driver/find_horizons.cc
parentfa83ade88caec7419e665eaab96622790b527bd7 (diff)
change so that only processor #0 writes data files
(other processors still do all the computations, but writes are supressed) git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@922 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/driver/find_horizons.cc')
-rw-r--r--src/driver/find_horizons.cc108
1 files changed, 60 insertions, 48 deletions
diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc
index b5db69d..e721041 100644
--- a/src/driver/find_horizons.cc
+++ b/src/driver/find_horizons.cc
@@ -73,7 +73,7 @@ bool do_evaluate_expansion
struct IO_info& IO_info, bool output_h, bool output_Theta,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps,
- int hn, int N_horizons);
+ bool active_flag, int hn, int N_horizons);
bool do_test_expansion_Jacobian
(const struct verbose_info& verbose_info, int timer_handle,
struct IO_info& IO_info,
@@ -81,7 +81,7 @@ bool do_test_expansion_Jacobian
struct Jacobian_info& Jac_info,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps, Jacobian* Jac_ptr,
- int hn, int N_horizons);
+ bool active_flag, int hn, int N_horizons);
bool do_find_horizon
(const struct verbose_info& verbose_info, int timer_handle,
struct IO_info& IO_info, bool output_h, bool output_Theta,
@@ -89,7 +89,7 @@ bool do_find_horizon
const struct Jacobian_info& Jac_info,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps, Jacobian* Jac_ptr,
- int hn, int N_horizons);
+ bool active_flag, int hn, int N_horizons);
void compute_BH_diagnostics
(const patch_system& ps,
@@ -112,12 +112,6 @@ extern "C"
DECLARE_CCTK_ARGUMENTS
DECLARE_CCTK_PARAMETERS
-#if 0
-// this thorn is a no-op on all processors *except* a specified one
-if (CCTK_MyProc(cctkGH) != processor_number)
- then return;
-#endif
-
const struct verbose_info& verbose_info = state.verbose_info;
struct IO_info& IO_info = state.IO_info;
const struct solver_info& solver_info = state.solver_info;
@@ -135,6 +129,9 @@ else CCTK_VWarn(-1, __LINE__, __FILE__, CCTK_THORNSTRING,
"AHFinderDirect_find_horizons(): unknown metric_type=\"%s\"!",
metric_type); /*NOTREACHED*/
+// only processor #0 is "active"
+const bool active_flag = (state.my_proc == 0);
+
// get the Cactus time step and decide if we want to output [hH] now
IO_info.time_iteration = cctk_iteration;
IO_info.time = cctk_time;
@@ -175,7 +172,7 @@ if (state.gi.geometry_method == geometry__local_interp_from_Cactus_grid)
AH_info.initial_guess_info,
IO_info,
hn, state.N_horizons, verbose_info);
- if (IO_info.output_initial_guess)
+ if (active_flag && IO_info.output_initial_guess)
then output_gridfn(ps, gfns::gfn__h,
IO_info, IO_info.h_base_file_name,
hn, verbose_info
@@ -190,7 +187,7 @@ if (state.gi.geometry_method == geometry__local_interp_from_Cactus_grid)
IO_info, output_h, output_Theta,
state.cgi, state.gi,
ps,
- hn, state.N_horizons);
+ active_flag, hn, state.N_horizons);
break;
case method__test_expansion_Jacobian:
@@ -199,7 +196,7 @@ if (state.gi.geometry_method == geometry__local_interp_from_Cactus_grid)
test_all_Jacobian_methods,
state.Jac_info, state.cgi, state.gi,
ps, AH_info.Jac_ptr,
- hn, state.N_horizons);
+ active_flag, hn, state.N_horizons);
break;
case method__find_horizon:
@@ -209,20 +206,18 @@ if (state.gi.geometry_method == geometry__local_interp_from_Cactus_grid)
solver_info, initial_find_flag,
state.Jac_info, state.cgi, state.gi,
ps, AH_info.Jac_ptr,
- hn, state.N_horizons);
+ active_flag, hn, state.N_horizons);
// store found flag in Cactus array variable
AH_found[hn] = AH_info.AH_found;
if (AH_info.AH_found)
then {
- // compute BH diagnostics
- compute_BH_diagnostics(ps,
- state.BH_diagnostics_info,
- verbose_info,
- AH_info.BH_diagnostics);
- const struct BH_diagnostics& BH_diagnostics
- = AH_info.BH_diagnostics;
+// compute BH diagnostics
+compute_BH_diagnostics(ps,
+ state.BH_diagnostics_info,
+ verbose_info, AH_info.BH_diagnostics);
+const struct BH_diagnostics& BH_diagnostics = AH_info.BH_diagnostics;
// print BH diagnostics?
if (verbose_info.print_physics_details)
@@ -241,19 +236,24 @@ if (verbose_info.print_physics_details)
double(BH_diagnostics.m_irreducible));
}
- // store BH diagnostics in Cactus array variables
- centroid_x[hn] = BH_diagnostics.centroid_x;
- centroid_y[hn] = BH_diagnostics.centroid_y;
- centroid_z[hn] = BH_diagnostics.centroid_z;
- area[hn] = BH_diagnostics.area;
- m_irreducible[hn] = BH_diagnostics.m_irreducible;
-
- // output BH diagnostics?
- if (IO_info.output_BH_diagnostics)
- then output_BH_diagnostics_fn
- (BH_diagnostics,
- IO_info, hn,
- AH_info.BH_diagnostics_fileptr);
+// store BH diagnostics in Cactus array variables
+centroid_x[hn] = BH_diagnostics.centroid_x;
+centroid_y[hn] = BH_diagnostics.centroid_y;
+centroid_z[hn] = BH_diagnostics.centroid_z;
+area[hn] = BH_diagnostics.area;
+m_irreducible[hn] = BH_diagnostics.m_irreducible;
+
+// output BH diagnostics?
+if (active_flag && IO_info.output_BH_diagnostics)
+ then {
+ if (AH_info.BH_diagnostics_fileptr == NULL)
+ then AH_info.BH_diagnostics_fileptr
+ = setup_BH_diagnostics_output_file(IO_info,
+ hn, state.N_horizons);
+ output_BH_diagnostics_fn(BH_diagnostics,
+ IO_info, hn,
+ AH_info.BH_diagnostics_fileptr);
+ }
}
else {
if (verbose_info.print_physics_details)
@@ -369,6 +369,10 @@ return data_ptr;
// apparent horizon process, or -ve to skip this
// (we only time the computation, not the file I/O)
// output_[hH] = flags to control whether or not we should output [hH]
+// active_flag = Controls whether this processor is "active":
+// true ==> Normal operation.
+// false ==> We evaluate Theta(h) as usual, but don't write
+// any output files.
// hn = the horizon number (used only in naming output files)
// N_horizons = the total number of horizon(s) being searched for number
// (used only in formatting info messages)
@@ -383,7 +387,7 @@ bool do_evaluate_expansion
struct IO_info& IO_info, bool output_h, bool output_Theta,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps,
- int hn, int N_horizons)
+ bool active_flag, int hn, int N_horizons)
{
jtutil::norm<fp> Theta_norms;
@@ -400,11 +404,11 @@ if (Theta_norms.is_nonempty()) // might be empty if Theta(h) eval failed
" Theta(h) rms-norm %.2e, infinity-norm %.2e",
Theta_norms.rms_norm(), Theta_norms.infinity_norm());
-if (output_h)
+if (active_flag && output_h)
then output_gridfn(ps, gfns::gfn__h,
IO_info, IO_info.h_base_file_name,
hn, verbose_info.print_algorithm_details);
-if (output_Theta)
+if (active_flag && output_Theta)
then output_gridfn(ps, gfns::gfn__Theta,
IO_info, IO_info.Theta_base_file_name,
hn, verbose_info.print_algorithm_details);
@@ -435,6 +439,10 @@ return true; // *** NORMAL RETURN ***
// perturbation calculation. (This
// may be useful if one or more of
// the other methods is broken.)
+// active_flag = Controls whether this processor is "active":
+// true ==> Normal operation.
+// false ==> We compute the Jacobian(s) as usual, but don't
+// write any output files.
// hn = the horizon number (used only in naming output files)
// N_horizons = the total number of horizon(s) being searched for number
// (used only in formatting info messages)
@@ -451,7 +459,7 @@ bool do_test_expansion_Jacobian
struct Jacobian_info& Jac_info,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps, Jacobian* Jac_ptr,
- int hn, int N_horizons)
+ bool active_flag, int hn, int N_horizons)
{
// numerical perturbation
Jacobian* Jac_NP_ptr = Jac_ptr;
@@ -477,10 +485,11 @@ if (test_all_Jacobian_methods)
then return false; // *** ERROR RETURN ***
}
-print_Jacobians(ps,
- Jac_NP_ptr, Jac_SD_FDdr_ptr,
- IO_info, IO_info.Jacobian_base_file_name,
- hn, true);
+if (active_flag)
+ then print_Jacobians(ps,
+ Jac_NP_ptr, Jac_SD_FDdr_ptr,
+ IO_info, IO_info.Jacobian_base_file_name,
+ hn, true);
return true; // *** NORMAL RETURN ***
}
@@ -506,6 +515,10 @@ return true; // *** NORMAL RETURN ***
// previous attempt. Thus we should use
// "subsequent" parameters for the Newton
// iteration.
+// active_flag = Controls whether this processor is "active":
+// true ==> Normal operation.
+// false ==> We find the horizon as usual, but don't write
+// any output files.
// hn = the horizon number (used only in naming output files)
// N_horizons = the total number of horizon(s) being searched for number
// (used only in formatting info messages)
@@ -522,7 +535,7 @@ bool do_find_horizon
const struct Jacobian_info& Jac_info,
struct cactus_grid_info& cgi, struct geometry_info& gi,
patch_system& ps, Jacobian* Jac_ptr,
- int hn, int N_horizons)
+ bool active_flag, int hn, int N_horizons)
{
Jacobian& Jac = *Jac_ptr;
@@ -534,20 +547,19 @@ if (verbose_info.print_algorithm_highlights)
if (timer_handle >= 0)
then CCTK_TimerStartI(timer_handle);
const bool status = Newton_solve(ps, Jac,
- cgi, gi,
- Jac_info,
- solver_info, initial_find_flag,
- IO_info, hn, verbose_info);
+ cgi, gi, Jac_info,
+ solver_info, initial_find_flag, IO_info,
+ active_flag, hn, verbose_info);
if (timer_handle >= 0)
then CCTK_TimerStopI(timer_handle);
if (! status)
then return false; // *** ERROR RETURN ***
-if (output_h)
+if (active_flag && output_h)
then output_gridfn(ps, gfns::gfn__h,
IO_info, IO_info.h_base_file_name,
hn, verbose_info.print_algorithm_details);
-if (output_Theta)
+if (active_flag && output_Theta)
then output_gridfn(ps, gfns::gfn__Theta,
IO_info, IO_info.Theta_base_file_name,
hn, verbose_info.print_algorithm_details);