aboutsummaryrefslogtreecommitdiff
path: root/src/driver/Newton.cc
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-03-02 20:19:46 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-03-02 20:19:46 +0000
commit9198f7ada91159c6e052fae5fcd0cacdeef244ad (patch)
treecb15208ca0c7ce9c6b70a3eed73adafb9cc256ec /src/driver/Newton.cc
parent6cbfd3ee8254a73d9e62e2780d1e4f4d0bc4bd40 (diff)
* make BH_diagnostics more of an object
(eg move non-member code into member fns) * handle expansion() and expansion_Jacobian() now returning full status instead of just Boolean success/failure flag git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@958 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/driver/Newton.cc')
-rw-r--r--src/driver/Newton.cc68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc
index 5283a44..6486ec6 100644
--- a/src/driver/Newton.cc
+++ b/src/driver/Newton.cc
@@ -175,6 +175,8 @@ if (hs.has_genuine_horizons())
//
for (int iteration = 1 ; ; ++iteration)
{
+ enum expansion_status status;
+
if (verbose_info.print_algorithm_debug)
then CCTK_VInfo(CCTK_THORNSTRING,
"beginning iteration %d (horizon_is_genuine=%d)",
@@ -193,13 +195,13 @@ if (hs.has_genuine_horizons())
iteration);
jtutil::norm<fp> Theta_norms;
- const bool Theta_is_ok
- = expansion(ps_ptr,
- cgi, gi,
- error_info, (iteration == 1),
- true, // yes, we want the Jacobian coeffs
- verbose_info.print_algorithm_details,
- &Theta_norms);
+ status = expansion(ps_ptr,
+ cgi, gi,
+ error_info, (iteration == 1),
+ true, // yes, we want the Jacobian coeffs
+ verbose_info.print_algorithm_details,
+ &Theta_norms);
+ const bool Theta_is_ok = (status == expansion_success);
if (verbose_info.print_algorithm_debug)
then {
CCTK_VInfo(CCTK_THORNSTRING,
@@ -287,26 +289,23 @@ if (hs.has_genuine_horizons())
rms_norm_buffer, infinity_norm_buffer);
if (found_this_horizon)
then {
- compute_BH_diagnostics(*ps_ptr, BH_diagnostics_info,
- AH_info_ptr->BH_diagnostics);
+ struct BH_diagnostics& BH_diagnostics
+ = AH_info_ptr->BH_diagnostics;
+ BH_diagnostics.compute(*ps_ptr, BH_diagnostics_info);
if (verbose_info.print_physics_details)
then {
// FIXME: see header comment -- user probably won't see
// this for my_proc != 0 in a multiprocessor run
- print_BH_diagnostics(AH_info_ptr->BH_diagnostics,
- N_horizons, hn);
+ BH_diagnostics.print(N_horizons, hn);
}
if (IO_info.output_BH_diagnostics)
then {
if (AH_info_ptr->BH_diagnostics_fileptr == NULL)
then AH_info_ptr->BH_diagnostics_fileptr
- = setup_BH_diagnostics_output_file(IO_info,
- N_horizons,
- hn);
- do_output_BH_diagnostics(AH_info_ptr->BH_diagnostics,
- IO_info,
- hn, AH_info_ptr
- ->BH_diagnostics_fileptr);
+ = BH_diagnostics.setup_output_file
+ (IO_info, N_horizons, hn);
+ BH_diagnostics.output(AH_info_ptr->BH_diagnostics_fileptr,
+ IO_info);
}
if (IO_info.output_h)
@@ -350,14 +349,14 @@ if (hs.has_genuine_horizons())
then CCTK_VInfo(CCTK_THORNSTRING,
" computing Jacobian: genuine/dummy flag %d",
int(this_horizon_needs_more_iterations));
- const bool Jacobian_is_ok
- = expansion_Jacobian(this_horizon_needs_more_iterations ? ps_ptr
- : NULL,
- this_horizon_needs_more_iterations ? Jac_ptr
- : NULL,
- cgi, gi, Jacobian_info,
- error_info, (iteration == 1),
- verbose_info.print_algorithm_details);
+ status = expansion_Jacobian(this_horizon_needs_more_iterations ? ps_ptr
+ : NULL,
+ this_horizon_needs_more_iterations ? Jac_ptr
+ : NULL,
+ cgi, gi, Jacobian_info,
+ error_info, (iteration == 1),
+ verbose_info.print_algorithm_details);
+ const bool Jacobian_is_ok = (status == expansion_success);
//
@@ -476,18 +475,19 @@ assert( my_proc < N_procs );
//
// We do the combined reduce/broadcast in a single reduction operation
// by setting up a 2-D buffer whose entries are all 0s, except that on each
-// processor the [my_proc] row hase the values we want to reduce/broadcast,
-// then doing a sum-reduction of the buffers across processors.
+// processor the [my_proc] row has the values we want to reduce/broadcast,
+// then doing a sum-reduction of the buffers across processors. Alas,
+// the input and output buffers must be distinct, so for the broadcast
+// we need two copies of the buffer on each processor.
//
-// Alas, to do everything in a single operation, all the values have to
-// be of a single datatype in a single array, so we convert hn and
-// iteration to CCTK_REAL, and encode the Boolean flags in other
-// variables' signs. Also, for purposes of the reduction we treat the
-// buffer as a 1-D array.
+// To do everything in a single reduction operation, all the values have
+// to be of a single datatype in a single array, so we convert hn and
+// iteration to CCTK_REAL, and encode the Boolean flags in some of the
+// variables' signs. Also, for simplicity we treat the buffer as a 1-D
+// array for the reduction.
//
// the buffer is actually a 2-D array; these are the column numbers
-// ... n.b. input and output buffers must be distinct!
enum {
buffer_var__hn = 0,
buffer_var__iteration,