/*@@ @file Startup.c @date Sun Jul 04 1999 @author Thomas Radke @desc Startup routines for PUGHInterp @enddesc @version $Id$ @@*/ #include #include "cctk.h" #include "cctk_Interp.h" #include "pughInterpGH.h" /* the rcs ID and its dummy function to use it */ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusPUGH_PUGHInterp_Startup_c) /******************************************************************** ******************** External Routines ************************ ********************************************************************/ void PUGHInterp_Startup (void); /******************************************************************** ******************** Internal Routines ************************ ********************************************************************/ #ifdef CCTK_MPI 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_OverloadInterpGridArrays CCTK_RegisterGHExtensionSetupGH CCTK_InterpRegisterOperatorGV @@*/ void PUGHInterp_Startup (void) { CCTK_OverloadInterpGridArrays (PUGHInterp_InterpGridArrays); #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 SetupGH @date Sun Jul 04 1999 @author Thomas Radke @desc Allocates the GH extension structure and - for the MPI case - the count/displacement buffers used in MPI_Alltoall() and MPI_Alltoallv() @enddesc @calls CCTK_nProcs @returntype void * @returndesc pointer to the allocated GH extension structure @endreturndesc @@*/ static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) { int nprocs; pughInterpGH *myGH; /* suppress compiler warnings about unused variables */ (void) (config + 0); (void) (convergence_level + 0); myGH = malloc (sizeof (pughInterpGH)); /* allocate once for all fields of same type */ nprocs = CCTK_nProcs (GH); myGH->sendcnt = malloc (4 * nprocs * sizeof (int)); myGH->senddispl = myGH->sendcnt + nprocs; myGH->recvcnt = myGH->senddispl + nprocs; myGH->recvdispl = myGH->recvcnt + nprocs; myGH->N_points_from = malloc (2 * nprocs * sizeof (CCTK_INT)); myGH->N_points_to = myGH->N_points_from + nprocs; return (myGH); } #endif /* CCTK_MPI */ /*@@ @routine InterpGV_NthOrder @date Wed 14 Feb 2001 @author Thomas Radke @desc Wrappers for the different interpolation operators registered for first/second/third order interpolation. These wrappers just call the common interpolation routine passing all arguments plus the interpolation order. @enddesc @returntype int @returndesc the return code of the common interpolation routine @endreturndesc @@*/ 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, interp_coord_arrays, interp_coord_array_types, in_array_indices, out_arrays, 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, interp_coord_arrays, interp_coord_array_types, in_array_indices, out_arrays, 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)); }