diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2006-09-25 15:54:52 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2006-09-25 15:54:52 +0000 |
commit | 7b550b2a3dea1016d3f6632a01edf221cdb6eaf9 (patch) | |
tree | d74ed7e33cfe30dbb0e4032de6d85408f032fe91 /src | |
parent | 6418e5fed1eb56e6f949c76d7cf4a32fee2228dd (diff) |
add a new aliased function
HorizonCentroid()
so other thorns can query the horizon centroid
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1469 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r-- | src/driver/aliased_functions.cc | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/src/driver/aliased_functions.cc b/src/driver/aliased_functions.cc index 50da3dd..03d49ed 100644 --- a/src/driver/aliased_functions.cc +++ b/src/driver/aliased_functions.cc @@ -4,6 +4,7 @@ // <<<access to persistent data>>> // AHFinderDirect_local_coordinate_origin - provide our local coordinate origin // AHFinderDirect_horizon_was_found - query if a given horizon was found +// AHFinderDirect_horizon_centroid - query horizon centroid & if it was found // AHFinderDirect_radius_in_direction - provide r(angle) function // @@ -62,7 +63,7 @@ extern struct state state; // Arguments: // horizon_number = (in) The horizon to inquire about; must be in the range // 1 to N_horizons inclusive. -// *origin_[xyz]_ptr = (out) The local coordinate origin is stored here. +// *p_origin_[xyz] = (out) The local coordinate origin is stored here. // // Results: // This function returns 0 for ok, or -1 if the horizon number is invalid. @@ -70,7 +71,7 @@ extern struct state state; extern "C" CCTK_INT AHFinderDirect_local_coordinate_origin (CCTK_INT horizon_number, - CCTK_REAL* origin_x_ptr, CCTK_REAL* origin_y_ptr, CCTK_REAL* origin_z_ptr) + CCTK_REAL* p_origin_x, CCTK_REAL* p_origin_y, CCTK_REAL* p_origin_z) { const struct verbose_info& verbose_info = state.verbose_info; @@ -90,9 +91,12 @@ const struct AH_data& AH_data = *state.AH_data_array[horizon_number]; assert(AH_data.ps_ptr != NULL); const patch_system& ps = *AH_data.ps_ptr; -*origin_x_ptr = ps.origin_x(); -*origin_y_ptr = ps.origin_y(); -*origin_z_ptr = ps.origin_z(); +assert(p_origin_x != NULL); +assert(p_origin_y != NULL); +assert(p_origin_z != NULL); +*p_origin_x = ps.origin_x(); +*p_origin_y = ps.origin_y(); +*p_origin_z = ps.origin_z(); return 0; // *** NORMAL RETURN *** } @@ -139,6 +143,51 @@ return AH_data.found_flag ? 1 : 0; // // This function is called (via the Cactus flesh function-aliasing mechanism) +// by other thorns to query whether or not the specified horizon was found +// the last time we searched for it, and if so, to determine the horizon +// centroid. +// +// Results: +// This function returns: +// 1 if the horizon was found; in this case *centroid_[xyz]_ptr +// are set to the centroid position +// 0 if the horizon was not found; in this case *centroid_[xyz]_ptr +// set to zeros +// negative for an error +// +extern "C" + CCTK_INT AHFinderDirect_horizon_centroid + (CCTK_INT horizon_number, + CCTK_REAL* p_centroid_x, CCTK_REAL* p_centroid_y, CCTK_REAL* p_centroid_z) +{ +const struct verbose_info& verbose_info = state.verbose_info; + +if (! ((horizon_number >= 1) && (horizon_number <= state.N_horizons)) ) + then { + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, +"AHFinderDirect_horizon_centroid():\n" +" horizon_number=%d must be in the range [1,N_horizons=%d]!\n" + , + int(horizon_number), state.N_horizons); + return -1; // *** ERROR RETURN *** + } + +assert(state.AH_data_array[horizon_number] != NULL); +const struct AH_data& AH_data = *state.AH_data_array[horizon_number]; +const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics; + +assert(p_centroid_x != NULL); +assert(p_centroid_y != NULL); +assert(p_centroid_z != NULL); +*p_centroid_x = BH_diagnostics.centroid_x; +*p_centroid_y = BH_diagnostics.centroid_y; +*p_centroid_z = BH_diagnostics.centroid_z; +} + +//****************************************************************************** + +// +// This function is called (via the Cactus flesh function-aliasing mechanism) // by other thorns to find out a given AH's radius in the direction from // its local coordinate origin to a given (x,y,z) coordinate or coordinates. // |