// announce.cc -- annnounce apparent horizon info to other thorns // $Header$ // // <<>> // AHFinderDirect_announce - top-level driver for announce stuff // #include #include #include #include "util_Table.h" #include "cctk.h" #include "cctk_Arguments.h" #include "config.h" #include "stdc.h" #include "../jtutil/util.hh" #include "../jtutil/array.hh" #include "../jtutil/cpm_map.hh" #include "../jtutil/linear_map.hh" #include "../patch/coords.hh" #include "../patch/grid.hh" #include "../patch/fd_grid.hh" #include "../patch/patch.hh" #include "../patch/patch_edge.hh" #include "../patch/patch_interp.hh" #include "../patch/ghost_zone.hh" #include "../patch/patch_system.hh" #include "../elliptic/Jacobian.hh" #include "../gr/gfns.hh" #include "../gr/gr.hh" #include "horizon_sequence.hh" #include "BH_diagnostics.hh" #include "driver.hh" // all the code in this file is inside this namespace namespace AHFinderDirect { using jtutil::error_exit; //****************************************************************************** // // ***** access to persistent data ***** // extern struct state state; //****************************************************************************** // // This function is called by the Cactus scheduler, to announce any // desired apparent horizon info to any other thorns that may be interested. // At present the only info we announce is the centroid position of a // single selected apparent horizon; if the SetAHCentroid() aliased // function has been defined then we announce by calling that. // extern "C" void AHFinderDirect_announce(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS 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)) 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 *** // 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) 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", hn, double(xx), double(yy), double(zz)); SetDriftCorrectPosition(cctkGH, xx, yy, zz); } } //****************************************************************************** } // namespace AHFinderDirect