From bb4370dffa82535b2733f1d63921104a4eabe481 Mon Sep 17 00:00:00 2001 From: tradke Date: Sun, 20 Jun 2004 12:30:39 +0000 Subject: Removed old interpolator API code. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/LocalInterp/trunk@183 df1f8a13-aa1d-4dd4-9681-27ded5b42416 --- doc/documentation.tex | 19 +--- src/Startup.c | 261 +------------------------------------------------- 2 files changed, 7 insertions(+), 273 deletions(-) diff --git a/doc/documentation.tex b/doc/documentation.tex index c932425..8d4da84 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -110,29 +110,18 @@ of interpolation points. \section{Introduction} This thorn provides processor-local interpolation, using the interpolation -operators -\begin{verbatim} - "first-order uniform cartesian" - "second-order uniform cartesian" - "third-order uniform cartesian" -\end{verbatim} -for the old Cactus interpolation API \verb|CCTK_InterpLocal()| and +operator \begin{verbatim} "uniform cartesian" \end{verbatim} -for the new Cactus interpolation API \verb|CCTK_InterpLocalUniform()|. +for the Cactus local interpolation API \verb|CCTK_InterpLocalUniform()|. (Note that the word ``{\tt cartesian}'' is in lower case here!) It supports 1, 2, and 3-dimensional interpolation. -Although the \verb|CCTK_InterpLocal()| API supports both uniform -and nonuniform grids for the input data, the present implementation -assumes a uniform grid (and silently gives wrong results for a -nonuniform grid). - See the Cactus User's Guide ``Full Description of Functions'' -appendix for a full description of the \verb|CCTK_InterpLocalUniform()| and -\verb|CCTK_InterpLocal()| APIs, and some examples of how to use it. +appendix for a full description of the \verb|CCTK_InterpLocalUniform()| API, +and some examples of how to use it. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/Startup.c b/src/Startup.c index 9facc9f..2feab08 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -15,12 +15,7 @@ @version $Header$ @@*/ -#include - #include "cctk.h" -#include "cctk_Interp.h" -#include "util_ErrorCodes.h" -#include "util_Table.h" #include "Interpolate.h" /* the rcs ID and its dummy function to use it */ @@ -33,71 +28,6 @@ CCTK_FILEVERSION(CactusBase_LocalInterp_Startup_c) ********************************************************************/ void LocalInterp_Startup(void); -/******************************************************************** - *************** Internal Routine Prototypes ******************* - ********************************************************************/ -static int InterpLocal_1stOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]); -static int InterpLocal_2ndOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]); -static int InterpLocal_3rdOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]); -static int InterpLocal_NthOrder (cGH *GH, - int order, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]); - - -/******************************************************************** - ******************** External Routines ************************ - ********************************************************************/ /*@@ @routine LocalInterp_Startup @@ -105,198 +35,13 @@ static int InterpLocal_NthOrder (cGH *GH, @author Thomas Radke @desc The startup registration routine for LocalInterp. - Registers the interpolation operators with the flesh. + Registers the "uniform cartesian" interpolation operator + with the flesh. @enddesc - @calls CCTK_InterpRegisterOperatorLocal + @calls CCTK_InterpRegisterOpLocalUniform @@*/ void LocalInterp_Startup (void) { CCTK_InterpRegisterOpLocalUniform (LocalInterp_InterpLocalUniform, "uniform cartesian", CCTK_THORNSTRING); - - CCTK_InterpRegisterOperatorLocal (InterpLocal_1stOrder, - "first-order uniform cartesian"); - CCTK_InterpRegisterOperatorLocal (InterpLocal_2ndOrder, - "second-order uniform cartesian"); - CCTK_InterpRegisterOperatorLocal (InterpLocal_3rdOrder, - "third-order uniform cartesian"); -} - - -/******************************************************************** - ******************** Internal Routines ************************ - ********************************************************************/ -/*@@ - @routine InterpLocal_NthOrder - @date Wed 14 Feb 2001 - @author Thomas Radke - @desc - LocalInterp's first/second/third order interpolation operators - which are registered with the flesh's old interpolation API. - These routines are just wrappers which translate their arguments - to call LocalInterp's interpolation operator for the new API. - @enddesc - - @returntype int - @returndesc - the return code of LocalInterp's interpolation operator - @endreturndesc - @@*/ -static int InterpLocal_1stOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]) -{ - return (InterpLocal_NthOrder (GH, 1, num_points, num_dims, - num_in_arrays, num_out_arrays, - coord_dims, coord_arrays, coord_array_types, - interp_coord_arrays, interp_coord_array_types, - in_arrays, in_array_types, - out_arrays, out_array_types)); -} - - -static int InterpLocal_2ndOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]) -{ - return (InterpLocal_NthOrder (GH, 2, num_points, num_dims, - num_in_arrays, num_out_arrays, - coord_dims, coord_arrays, coord_array_types, - interp_coord_arrays, interp_coord_array_types, - in_arrays, in_array_types, - out_arrays, out_array_types)); -} - - -static int InterpLocal_3rdOrder (cGH *GH, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]) -{ - return (InterpLocal_NthOrder (GH, 3, num_points, num_dims, - num_in_arrays, num_out_arrays, - coord_dims, coord_arrays, coord_array_types, - interp_coord_arrays, interp_coord_array_types, - in_arrays, in_array_types, - out_arrays, out_array_types)); -} - - -static int InterpLocal_NthOrder (cGH *GH, - int order, - int num_points, - int num_dims, - int num_in_arrays, - int num_out_arrays, - const int coord_dims[], - const void *const coord_arrays[], - const int coord_array_types[], - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const void *const in_arrays[], - const int in_array_types[], - void *const out_arrays[], - const int out_array_types[]) -{ - int i, table, retval; - CCTK_INT *_coord_dims, *_in_array_types, *_out_array_types; - CCTK_REAL *origin, *delta; - char string[32]; - CCTK_REAL origin1; - - - /* no information needed from the GH */ - (void) (GH + 0); - - /* need to turn int's into CCTK_INT's */ - _coord_dims = malloc ((num_dims + num_in_arrays + num_out_arrays) * - sizeof (CCTK_INT)); - _in_array_types = _coord_dims + num_dims; - _out_array_types = _in_array_types + num_in_arrays; - for (i = 0; i < num_in_arrays; i++) - { - _in_array_types[i] = in_array_types[i]; - } - for (i = 0; i < num_out_arrays; i++) - { - _out_array_types[i] = out_array_types[i]; - } - - /* for now we can only deal with coordinates of type CCTK_REAL */ - for (i = 0; i < num_dims; i++) - { - if (coord_array_types[i] != CCTK_VARIABLE_REAL) - { - CCTK_WARN (1, "Coordinates must be of type CCTK_REAL"); - return (UTIL_ERROR_BAD_INPUT); - } - if (interp_coord_array_types[i] != CCTK_VARIABLE_REAL) - { - CCTK_WARN (1, "Interpolation coordinates must be of type CCTK_REAL"); - return (UTIL_ERROR_BAD_INPUT); - } - - _coord_dims[i] = coord_dims[i]; - } - - /* get the grid spacings - this assumes a uniform cartesian grid */ - origin = malloc (2 * num_dims * sizeof (CCTK_REAL)); - delta = origin + num_dims; - for (i = 0; i < num_dims; i++) - { - origin[i] = ((const CCTK_REAL *const *) coord_arrays)[i][0]; - origin1 = ((const CCTK_REAL *const *) coord_arrays)[i][1]; - delta[i] = origin1 - origin[i]; - } - - /* create a table with the interpolation order information */ - sprintf (string, "order = %d", order); - table = Util_TableCreateFromString (string); - - /* call the interpolator function */ - retval = LocalInterp_InterpLocalUniform (num_dims, table, origin, delta, - num_points, CCTK_VARIABLE_REAL, - interp_coord_arrays, num_in_arrays, - _coord_dims, _in_array_types, - in_arrays, num_out_arrays, - _out_array_types, out_arrays); - - /* free allocated resources */ - Util_TableDestroy (table); - free (origin); - free (_coord_dims); - - return (retval); } -- cgit v1.2.3