aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2004-05-05 16:17:01 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2004-05-05 16:17:01 +0000
commit8ee1095e896b9b230b8f61caed0d93dcc51e4563 (patch)
tree90871f619deee442165462d0d00cae5b54445185 /src
parent1a667c92ddac098cc8d83b973578ed23155b953e (diff)
* copy Cactus parameters to our local data structures,
then use these copies, rather than looking at the "global variable" Cactus parameters all over the place * given the above change, drop most #include "cctk_Parameters.h" and DECLARE_CCTK_PARAMETERS git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1320 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/driver/BH_diagnostics.cc1
-rw-r--r--src/driver/README8
-rw-r--r--src/driver/aliased_functions.cc1
-rw-r--r--src/driver/announce.cc20
-rw-r--r--src/driver/driver.hh16
-rw-r--r--src/driver/find_horizons.cc15
-rw-r--r--src/driver/initial_guess.cc1
-rw-r--r--src/driver/io.cc1
-rw-r--r--src/driver/mask.cc2
-rw-r--r--src/driver/misc-driver.cc1
-rw-r--r--src/driver/setup.cc28
-rw-r--r--src/driver/state.cc1
12 files changed, 60 insertions, 35 deletions
diff --git a/src/driver/BH_diagnostics.cc b/src/driver/BH_diagnostics.cc
index d0bb322..a641dde 100644
--- a/src/driver/BH_diagnostics.cc
+++ b/src/driver/BH_diagnostics.cc
@@ -21,7 +21,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
diff --git a/src/driver/README b/src/driver/README
index e5bb082..66712cd 100644
--- a/src/driver/README
+++ b/src/driver/README
@@ -16,18 +16,18 @@ state.cc
setup.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
this is called from the scheduler to setup our data structures
-find_horizons.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
+find_horizons.cc # sees CCTK_ARGUMENTS
this is called from the scheduler to find the apparent horizon(s)
in a slice
-mask.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
+mask.cc # sees CCTK_ARGUMENTS
this is called from the scheduler to set an excision mask or masks
-announce.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
+announce.cc # sees CCTK_ARGUMENTS
this is called from the scheduler to announce apparent horizon
info to other thorns
-aliased_functions.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS, CCTK_FUNCTIONS
+aliased_functions.cc # sees CCTK_ARGUMENTS, CCTK_FUNCTIONS
this is called from other thorns via the flesh aliased-function
interface, for the other thorns to find out about apparent horizons
diff --git a/src/driver/aliased_functions.cc b/src/driver/aliased_functions.cc
index b647198..986fa41 100644
--- a/src/driver/aliased_functions.cc
+++ b/src/driver/aliased_functions.cc
@@ -14,7 +14,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "cctk_Functions.h"
#include "config.h"
diff --git a/src/driver/announce.cc b/src/driver/announce.cc
index 5cd0fb5..f604d1c 100644
--- a/src/driver/announce.cc
+++ b/src/driver/announce.cc
@@ -12,7 +12,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -64,28 +63,19 @@ extern "C"
void AHFinderDirect_announce(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
const struct verbose_info& verbose_info = state.verbose_info;
// only try to announce AH info if we've found AHs at this time level
-// ==> only try every find_every time steps
-if ((cctk_iteration % find_every) != 0)
+if (! state.find_now(cctk_iteration))
then return; // *** NO-OP RETURN ***
-// which horizon to announce?
-const int hn = which_horizon_to_announce_centroid;
-if (hn == 0)
+// only try to anounce AH info if we've been asked to do so
+if (! state.announce_centroid_flag)
then return; // *** NO-OP RETURN ***
-if (! ((hn >= 1) && (hn <= N_horizons)) )
- then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" AHFinderDirect_announce():\n"
-" invalid horizon number %d to announce\n"
-" (valid range is [1,N_horizons=%d])!\n"
- ,
- hn, int(N_horizons)); /*NOTREACHED*/
+// which horizon to announce?
+const int hn = state.which_horizon_to_announce_centroid;
// did we actually *find* this horizon?
if (state.AH_data_array[hn] == NULL)
diff --git a/src/driver/driver.hh b/src/driver/driver.hh
index dc73f84..65cb95b 100644
--- a/src/driver/driver.hh
+++ b/src/driver/driver.hh
@@ -321,9 +321,21 @@ struct AH_data
//
struct state
{
+ int find_every;
+ bool find_now(int cctk_iteration_in) const
+ {
+ return (find_every != 0)
+ && ((cctk_iteration_in % find_every) == 0);
+ }
+
enum method method;
+
struct error_info error_info;
struct verbose_info verbose_info;
+
+ // copies of other thorn's parameters
+ const char* metric_type; // ADMBase::metric_type
+
int timer_handle;
int N_procs; // total number of processors
int my_proc; // processor number of this processor
@@ -337,6 +349,7 @@ struct state
struct cactus_grid_info cgi;
struct geometry_info gi;
+ bool test_all_Jacobian_compute_methods;
struct Jacobian_info Jac_info;
struct solver_info solver_info;
struct IO_info IO_info;
@@ -344,6 +357,9 @@ struct state
struct BH_diagnostics_info BH_diagnostics_info;
struct mask_info mask_info;
+ bool announce_centroid_flag; // should we announce horizon centroid?
+ int which_horizon_to_announce_centroid; // if so, which horizon?
+
// interprocessor-communication buffers for broadcasting
// Newton-iteration status from active processors to all processors
struct iteration_status_buffers isb;
diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc
index 8975341..24caa8c 100644
--- a/src/driver/find_horizons.cc
+++ b/src/driver/find_horizons.cc
@@ -17,7 +17,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -93,16 +92,16 @@ extern "C"
void AHFinderDirect_find_horizons(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
// only try to find horizons every find_every time steps
-if ((cctk_iteration % find_every) != 0)
+if (! state.find_now(cctk_iteration))
then return; // *** NO-OP RETURN ***
if (state.timer_handle >= 0)
then CCTK_TimerResetI(state.timer_handle);
const int my_proc = state.my_proc;
+const int N_horizons = state.N_horizons;
horizon_sequence& hs = *state.my_hs;
const bool active_flag = hs.has_genuine_horizons();
const bool broadcast_horizon_shape = state.mask_info.set_mask_for_any_horizon;
@@ -116,13 +115,13 @@ const struct verbose_info& verbose_info = state.verbose_info;
// what are the semantics of the Cactus gxx variables? (these may
// change from one call to another, so we have to re-check each time)
-if (CCTK_Equals(metric_type, "physical"))
+if (CCTK_Equals(state.metric_type, "physical"))
then cgi.use_Cactus_conformal_metric = false;
-else if (CCTK_Equals(metric_type, "static conformal"))
+else if (CCTK_Equals(state.metric_type, "static conformal"))
then cgi.use_Cactus_conformal_metric = (conformal_state > 0);
else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"AHFinderDirect_find_horizons(): unknown metric_type=\"%s\"!",
- metric_type); /*NOTREACHED*/
+"AHFinderDirect_find_horizons(): unknown ADMBase::metric_type=\"%s\"!",
+ state.metric_type); /*NOTREACHED*/
// get the Cactus time step and decide if we want to output h and/or Theta now
IO_info.time_iteration = cctk_iteration;
@@ -174,7 +173,7 @@ case method__test_expansion_Jacobians:
do_test_expansion_Jacobians(my_proc, N_horizons,
state.AH_data_array,
cgi, gi, Jac_info,
- (test_all_Jacobian_compute_methods != 0),
+ state.test_all_Jacobian_compute_methods,
IO_info, error_info, verbose_info,
state.timer_handle);
break;
diff --git a/src/driver/initial_guess.cc b/src/driver/initial_guess.cc
index 71eab86..e6483f8 100644
--- a/src/driver/initial_guess.cc
+++ b/src/driver/initial_guess.cc
@@ -17,7 +17,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
diff --git a/src/driver/io.cc b/src/driver/io.cc
index 1e1eb93..c358fd9 100644
--- a/src/driver/io.cc
+++ b/src/driver/io.cc
@@ -21,7 +21,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
diff --git a/src/driver/mask.cc b/src/driver/mask.cc
index baa08d4..34ebef0 100644
--- a/src/driver/mask.cc
+++ b/src/driver/mask.cc
@@ -21,7 +21,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "SpaceMask.h" // from thorn SpaceMask
@@ -171,7 +170,6 @@ extern "C"
void AHFinderDirect_maybe_do_masks(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
const struct verbose_info& verbose_info = state.verbose_info;
struct mask_info& mask_info = state.mask_info;
diff --git a/src/driver/misc-driver.cc b/src/driver/misc-driver.cc
index e3cc6b0..55cc6f5 100644
--- a/src/driver/misc-driver.cc
+++ b/src/driver/misc-driver.cc
@@ -11,7 +11,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index edf52f3..3ec6ca1 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -97,6 +97,9 @@ extern struct state state;
// This function is called by the Cactus scheduler to set up all our
// persistent data structures. (These are stored in struct state .)
//
+// This function is the only one in this thorn which looks directly at
+// the Cactus parameters.
+//
extern "C"
void AHFinderDirect_setup(CCTK_ARGUMENTS)
{
@@ -110,6 +113,7 @@ CCTK_VInfo(CCTK_THORNSTRING,
//
// basic setup
//
+state.find_every = find_every;
state.method = decode_method(method);
state.error_info.warn_level__point_outside__initial
@@ -138,6 +142,8 @@ verbose_info.print_algorithm_details
verbose_info.print_algorithm_debug
= (state.verbose_info.verbose_level >= verbose_level__algorithm_debug);
+state.metric_type = /* ADMBase:: */ metric_type;
+
state.timer_handle = (print_timing_stats != 0) ? CCTK_TimerCreateI() : -1;
state.N_procs = CCTK_nProcs(cctkGH);
@@ -214,6 +220,9 @@ gi.check_that_geometry_is_finite = (check_that_geometry_is_finite != 0);
//
// Jacobian info
//
+state.test_all_Jacobian_compute_methods
+ = (test_all_Jacobian_compute_methods != 0);
+
struct Jacobian_info& Jac_info = state.Jac_info;
Jac_info.Jacobian_compute_method
= decode_Jacobian_compute_method(Jacobian_compute_method);
@@ -352,6 +361,25 @@ if (mask_info.set_mask_for_any_horizon)
}
+state.announce_centroid_flag = (which_horizon_to_announce_centroid != 0);
+if (state.announce_centroid_flag)
+ then {
+ state.which_horizon_to_announce_centroid
+ = which_horizon_to_announce_centroid;
+ if ( (state.which_horizon_to_announce_centroid < 1)
+ || (state.which_horizon_to_announce_centroid > state.N_horizons) )
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" AHFinderDirect_setup():\n"
+" invalid which_horizon_to_announce_centroid = %d!\n"
+" (valid range is [1,N_horizons=%d])!\n"
+ ,
+ state.which_horizon_to_announce_centroid,
+ state.N_horizons); /*NOTREACHED*/
+ }
+ else state.which_horizon_to_announce_centroid = 0; // dummy value; unused
+
+
//
// (genuine) horizon sequence for this processor
//
diff --git a/src/driver/state.cc b/src/driver/state.cc
index 9d495be..2da734b 100644
--- a/src/driver/state.cc
+++ b/src/driver/state.cc
@@ -8,7 +8,6 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"