diff options
Diffstat (limited to 'src/driver/announce.cc')
-rw-r--r-- | src/driver/announce.cc | 119 |
1 files changed, 106 insertions, 13 deletions
diff --git a/src/driver/announce.cc b/src/driver/announce.cc index 54b8972..5c0b62b 100644 --- a/src/driver/announce.cc +++ b/src/driver/announce.cc @@ -12,6 +12,7 @@ #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" +#include "cctk_Parameters.h" #include "config.h" #include "stdc.h" @@ -19,6 +20,7 @@ #include "../jtutil/array.hh" #include "../jtutil/cpm_map.hh" #include "../jtutil/linear_map.hh" +using jtutil::error_exit; #include "../patch/coords.hh" #include "../patch/grid.hh" @@ -41,7 +43,6 @@ // all the code in this file is inside this namespace namespace AHFinderDirect { -using jtutil::error_exit; //****************************************************************************** @@ -63,35 +64,42 @@ 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 -if (! state.find_now(cctk_iteration)) +// which horizon to announce? +const int hn = which_horizon_to_announce_centroid; +if (hn == 0) then return; // *** NO-OP RETURN *** -// 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; +assert(state.AH_data_array[hn] != NULL); +const struct AH_data& AH_data = *state.AH_data_array[hn]; + +// only try to announce AH info if we've found AHs at this time level +if (! AH_data.search_flag) + then return; // *** NO-OP RETURN *** // did we actually *find* this horizon? -if (state.AH_data_array[hn] == NULL) +if (! AH_data.found_flag) then return; // *** NO-OP RETURN *** // is there anyone to announce it to? if (CCTK_IsFunctionAliased("SetDriftCorrectPosition")) then { - assert(state.AH_data_array[hn] != NULL); - const struct AH_data& AH_data = *state.AH_data_array[hn]; - const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; const CCTK_REAL xx = BH_diagnostics.centroid_x; const CCTK_REAL yy = BH_diagnostics.centroid_y; const CCTK_REAL zz = BH_diagnostics.centroid_z; - if (verbose_info.print_physics_details) then CCTK_VInfo(CCTK_THORNSTRING, "horizon %d centroid (%g,%g,%g) --> DriftCorrect", @@ -102,4 +110,89 @@ if (CCTK_IsFunctionAliased("SetDriftCorrectPosition")) //****************************************************************************** +// +// This function is called by the Cactus scheduler, to copy any +// desired apparent horizon info to Cactus variables. +// +extern "C" + void AHFinderDirect_store(CCTK_ARGUMENTS) +{ +DECLARE_CCTK_ARGUMENTS +DECLARE_CCTK_PARAMETERS + +for (int hn = 1; hn <= N_horizons; ++ hn) + { + + // Store in spherical surface + const int sn = which_surface_to_store_info[hn]; + if (sn == -1) + then continue; + + if (sn < 0 || sn >= nsurfaces) + then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, +"\n" +" AHFinderDirect_store():\n" +" invalid surface number %d for horizon number %d\n" +" (valid range is [0,nsurfaces-1=%d])!\n" + , + sn, hn, + int(nsurfaces-1)); /*NOTREACHED*/ + + const struct AH_data& AH_data = *state.AH_data_array[hn]; + const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; + BH_diagnostics.store(cctkGH, hn, sn); + + } +} + +//****************************************************************************** + +// +// This function is called by the Cactus scheduler, to copy any +// desired apparent horizon info to Cactus variables. +// +extern "C" + void AHFinderDirect_save(CCTK_ARGUMENTS) +{ +DECLARE_CCTK_ARGUMENTS +DECLARE_CCTK_PARAMETERS + +for (int hn = 1; hn <= N_horizons; ++ hn) + { + + const struct AH_data& AH_data = *state.AH_data_array[hn]; + const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; + + // Save in grid array + BH_diagnostics.save(cctkGH, hn); + + } +} + +//****************************************************************************** + +// +// This function is called by the Cactus scheduler, to copy any +// desired apparent horizon info from Cactus variables. +// +extern "C" + void AHFinderDirect_recover(CCTK_ARGUMENTS) +{ +DECLARE_CCTK_ARGUMENTS +DECLARE_CCTK_PARAMETERS + +for (int hn = 1; hn <= N_horizons; ++ hn) + { + + struct AH_data& AH_data = *state.AH_data_array[hn]; + struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; + + // Load from grid array + BH_diagnostics.load(cctkGH, hn); + + } +} + +//****************************************************************************** + } // namespace AHFinderDirect |