From 42b1d44bc566358580daa20a9080a3d091e96642 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 11 Dec 2002 15:39:39 +0000 Subject: No important changes, just tidying up before adding the new global interpolator API. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@32 1c20744c-e24a-42ec-9533-f5004cb800e5 --- src/Startup.c | 181 +++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 108 insertions(+), 73 deletions(-) diff --git a/src/Startup.c b/src/Startup.c index 5e60877..4ff970d 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -19,18 +19,84 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGHInterp_Startup_c) -/* prototypes of routines defined in this source file */ +/******************************************************************** + ******************** External Routines ************************ + ********************************************************************/ void PUGHInterp_Startup (void); + + +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ #ifdef CCTK_MPI -static void *PUGHInterp_SetupGH (tFleshConfig *config, - int convergence_level, - cGH *GH); +static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH); #endif +static int InterpGV_1stOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]); +static int InterpGV_2ndOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]); +static int InterpGV_3rdOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]); + + + /*@@ + @routine PUGHInterp_Startup + @date Sun Jul 04 1999 + @author Thomas Radke + @desc + The startup registration routine for PUGHInterp. + Registers the PUGHInterp GH extensions setup routine + and the interpolation operators with the flesh. + @enddesc + @calls CCTK_RegisterGHExtensionSetupGH + CCTK_InterpRegisterOperatorGV +@@*/ +void PUGHInterp_Startup (void) +{ +#ifdef CCTK_MPI + CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("PUGHInterp"), + SetupGH); +#endif + + CCTK_InterpRegisterOperatorGV (InterpGV_1stOrder, + "first-order uniform cartesian"); + CCTK_InterpRegisterOperatorGV (InterpGV_2ndOrder, + "second-order uniform cartesian"); + CCTK_InterpRegisterOperatorGV (InterpGV_3rdOrder, + "third-order uniform cartesian"); +} +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ #ifdef CCTK_MPI /*@@ - @routine PUGHInterp_SetupGH + @routine SetupGH @date Sun Jul 04 1999 @author Thomas Radke @desc @@ -45,28 +111,26 @@ static void *PUGHInterp_SetupGH (tFleshConfig *config, pointer to the allocated GH extension structure @endreturndesc @@*/ -static void *PUGHInterp_SetupGH (tFleshConfig *config, - int convergence_level, - cGH *GH) +static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { int nprocs; pughInterpGH *myGH; /* suppress compiler warnings about unused variables */ - config = config; - convergence_level = convergence_level; + (void) (config + 0); + (void) (convergence_level + 0); - myGH = (pughInterpGH *) malloc (sizeof (pughInterpGH)); + myGH = malloc (sizeof (pughInterpGH)); /* allocate once for all fields of same type */ nprocs = CCTK_nProcs (GH); - myGH->send_count = (int *) malloc (4 * nprocs * sizeof (int)); + myGH->send_count = malloc (4 * nprocs * sizeof (int)); myGH->send_displ = myGH->send_count + nprocs; myGH->recv_count = myGH->send_displ + nprocs; myGH->recv_displ = myGH->recv_count + nprocs; - myGH->num_points_from = (CCTK_INT *) malloc (2 * nprocs * sizeof (CCTK_INT)); + myGH->num_points_from = malloc (2 * nprocs * sizeof (CCTK_INT)); myGH->num_points_to = myGH->num_points_from + nprocs; return (myGH); @@ -75,7 +139,7 @@ static void *PUGHInterp_SetupGH (tFleshConfig *config, /*@@ - @routine PUGHInterp_InterpGV_NthOrder + @routine InterpGV_NthOrder @date Wed 14 Feb 2001 @author Thomas Radke @desc @@ -90,16 +154,16 @@ static void *PUGHInterp_SetupGH (tFleshConfig *config, the return code of the common interpolation routine @endreturndesc @@*/ -static int PUGHInterp_InterpGV_1stOrder (cGH *GH, - const char *coord_system, - int num_points, - int num_in_array_indices, - int num_out_arrays, - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const int in_array_indices[], - void *const out_arrays[], - const int out_array_types[]) +static int InterpGV_1stOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]) { return (PUGHInterp_InterpGV (GH, 1, coord_system, num_points, num_in_array_indices, num_out_arrays, @@ -108,16 +172,16 @@ static int PUGHInterp_InterpGV_1stOrder (cGH *GH, } -static int PUGHInterp_InterpGV_2ndOrder (cGH *GH, - const char *coord_system, - int num_points, - int num_in_array_indices, - int num_out_arrays, - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const int in_array_indices[], - void *const out_arrays[], - const int out_array_types[]) +static int InterpGV_2ndOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]) { return (PUGHInterp_InterpGV (GH, 2, coord_system, num_points, num_in_array_indices, num_out_arrays, @@ -126,48 +190,19 @@ static int PUGHInterp_InterpGV_2ndOrder (cGH *GH, } -static int PUGHInterp_InterpGV_3rdOrder (cGH *GH, - const char *coord_system, - int num_points, - int num_in_array_indices, - int num_out_arrays, - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const int in_array_indices[], - void *const out_arrays[], - const int out_array_types[]) +static int InterpGV_3rdOrder (cGH *GH, + const char *coord_system, + int num_points, + int num_in_array_indices, + int num_out_arrays, + const void *const interp_coord_arrays[], + const int interp_coord_array_types[], + const int in_array_indices[], + void *const out_arrays[], + const int out_array_types[]) { return (PUGHInterp_InterpGV (GH, 3, coord_system, num_points, num_in_array_indices, num_out_arrays, interp_coord_arrays, interp_coord_array_types, in_array_indices, out_arrays, out_array_types)); } - - - /*@@ - @routine PUGHInterp_Startup - @date Sun Jul 04 1999 - @author Thomas Radke - @desc - The startup registration routine for PUGHInterp. - Registers the PUGHInterp GH extensions setup routine - and the interpolation operators with the flesh. - @enddesc - @calls CCTK_RegisterGHExtensionSetupGH - CCTK_InterpRegisterOperatorGV - CCTK_InterpRegisterOperatorLocal -@@*/ -void PUGHInterp_Startup (void) -{ -#ifdef CCTK_MPI - CCTK_RegisterGHExtensionSetupGH (CCTK_RegisterGHExtension ("PUGHInterp"), - PUGHInterp_SetupGH); -#endif - - CCTK_InterpRegisterOperatorGV (PUGHInterp_InterpGV_1stOrder, - "first-order uniform cartesian"); - CCTK_InterpRegisterOperatorGV (PUGHInterp_InterpGV_2ndOrder, - "second-order uniform cartesian"); - CCTK_InterpRegisterOperatorGV (PUGHInterp_InterpGV_3rdOrder, - "third-order uniform cartesian"); -} -- cgit v1.2.3