From 566611956aede6ede419737eefa1a9f60019a4b0 Mon Sep 17 00:00:00 2001 From: jthorn Date: Sun, 27 Jul 2003 14:25:55 +0000 Subject: get rid of template function Cactus_variable_dataptr() since it's only called twice -- just do the CCTK_VarDataPtrI() calls explicitly in the mask code --> with this change, the only templates in this thorn are in src/jtutil/ git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1151 f88db872-0e4f-0410-b76b-b9085cfa78c5 --- src/README | 3 ++- src/driver/driver.hh | 4 ---- src/driver/mask.cc | 31 +++++++++++++++++++++++++------ src/driver/misc-driver.cc | 47 ----------------------------------------------- 4 files changed, 27 insertions(+), 58 deletions(-) diff --git a/src/README b/src/README index 548d1ef..8899ce4 100644 --- a/src/README +++ b/src/README @@ -36,7 +36,8 @@ patch/ contains the basic multipatch infrastructure for storing on the surface of a 2-sphere jtutil/ contains various low-level utility routines for things like integer <--> floating-point linear maps, fuzzy - floating-point comparisons, N-dimensional arrays, etc + floating-point comparisons, N-dimensional arrays, etc; + this is the only directory containing C++ templates include/ contains common header files which don't live in any other source directory; all compile-time options for this thorn are configured here diff --git a/src/driver/driver.hh b/src/driver/driver.hh index fbe081a..dca349e 100644 --- a/src/driver/driver.hh +++ b/src/driver/driver.hh @@ -404,7 +404,3 @@ void output_Jacobians(const patch_system& ps, // misc-driver.cc int Cactus_gridfn_varindex(const char gridfn_name[]); -template - T* Cactus_gridfn_dataptr(const cGH *GH, int varindex, - const char gridfn_name[], - bool check_for_NULL = true); diff --git a/src/driver/mask.cc b/src/driver/mask.cc index e654a63..898e899 100644 --- a/src/driver/mask.cc +++ b/src/driver/mask.cc @@ -251,21 +251,40 @@ namespace { void setup_mask_dataptrs_and_bitfields(const cGH *GH, struct mask_info& mask_info) { +const int mask_time_level = 0; const int SPACEMASK_ERROR = -1; struct mask_info::old_style_mask_info& osmi = mask_info.old_style_mask_info; if (mask_info.set_old_style_mask) - then osmi.gridfn_dataptr = Cactus_gridfn_dataptr - (GH, osmi.gridfn_varindex, - osmi.gridfn_name); + then { + osmi.gridfn_dataptr = static_cast( + CCTK_VarDataPtrI(GH, mask_time_level, + osmi.gridfn_varindex) + ); + if (osmi.gridfn_dataptr == NULL) + then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, +"\n" +"setup_mask_dataptrs_and_bitfields():\n" +" couldn't get data pointer for old-style mask \"%s\"!\n" + , + osmi.gridfn_name); /*NOTREACHED*/ + } if (mask_info.set_new_style_mask) then { struct mask_info::new_style_mask_info& nsmi = mask_info.new_style_mask_info; - nsmi.gridfn_dataptr = Cactus_gridfn_dataptr - (GH, nsmi.gridfn_varindex, - nsmi.gridfn_name); + nsmi.gridfn_dataptr = static_cast( + CCTK_VarDataPtrI(GH, mask_time_level, + nsmi.gridfn_varindex) + ); + if (nsmi.gridfn_dataptr == NULL) + then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, +"\n" +"setup_mask_dataptrs_and_bitfields():\n" +" couldn't get data pointer for new-style mask \"%s\"!\n" + , + nsmi.gridfn_name); /*NOTREACHED*/ nsmi.bitfield_bitmask = SpaceMask_GetTypeBits(nsmi.bitfield_name); if (nsmi.bitfield_bitmask == SPACEMASK_ERROR) diff --git a/src/driver/misc-driver.cc b/src/driver/misc-driver.cc index 735d0f9..cc6f590 100644 --- a/src/driver/misc-driver.cc +++ b/src/driver/misc-driver.cc @@ -2,8 +2,6 @@ // $Header$ // // Cactus_gridfn_varindex - get Cactus gridfn variable index -// Cactus_gridfn_dataptr - get Cactus gridfn data pointer -// ***** template instantiations ***** // #include @@ -61,48 +59,3 @@ if (varindex < 0) return varindex; } - -//****************************************************************************** - -// -// This template function gets the Cactus data pointer for a single gridfn, -// and optionally checks to make sure this is non-NULL. -// -// Arguments: -// T = The desired CCTK_* datatype. -// GH --> The Cactus grid hierarchy. -// gridfn_name[] = The character-string name of the grid function; -// this is used only for formatting error messages. -// check_for_NULL = true ==> check to make sure the data pointer is non-NULL -// false ==> skip this check (presumably because a NULL -// pointer is ok) -// -template - T* Cactus_gridfn_dataptr(const cGH *GH, int varindex, - const char gridfn_name[], - bool check_for_NULL /* = true */) -{ -const int time_level = 0; - -T* data_ptr = static_cast( CCTK_VarDataPtrI(GH, time_level, varindex) ); - -if (check_for_NULL && (data_ptr == NULL)) - then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING, -"\n" -" Cactus_gridfn_dataptr(): got unexpected NULL data pointer\n" -" for Cactus gridfn!\n" -" name=\"%s\" varindex=%d" - , - gridfn_name, varindex); /*NOTREACHED*/ - -return data_ptr; -} - -//****************************************************************************** - -template CCTK_REAL* Cactus_gridfn_dataptr(const cGH*, int, - const char*, - bool /* = true */); -template CCTK_INT* Cactus_gridfn_dataptr(const cGH*, int, - const char*, - bool /* = true */); -- cgit v1.2.3