From 1637e18d3e12c531179926430f49c439d818568f Mon Sep 17 00:00:00 2001 From: tradke Date: Sun, 20 Jun 2004 12:31:17 +0000 Subject: Removed old interpolator API code. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHInterp/trunk@79 1c20744c-e24a-42ec-9533-f5004cb800e5 --- doc/documentation.tex | 52 ------------- src/Startup.c | 198 +------------------------------------------------- 2 files changed, 2 insertions(+), 248 deletions(-) diff --git a/doc/documentation.tex b/doc/documentation.tex index 8d682fe..cb5bdb5 100644 --- a/doc/documentation.tex +++ b/doc/documentation.tex @@ -54,12 +54,6 @@ and reuse them for all grid arrays. Please refer to the {\it Cactus UsersGuide} for a complete function description of \InterpGridArrays\ and {\tt CCTK\_InterpLocalUniform()}.\\ -\PUGHInterp\ also implements the old Cactus interpolation API {\tt -CCTK\_InterpGV()}. Application thorns should not make use of this depricated API -anymore and rather switch to the new, more general API \InterpGridArrays. -A brief description of \PUGHInterp's implementation of {\tt CCTK\_InterpGV()} is -given in section \ref{PUGHInterp_old_API}. - \section{\PUGHInterp's Implementation of \InterpGridArrays} @@ -239,52 +233,6 @@ of gathering all the status information back to the originating processors.) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{\PUGHInterp\ and the old Cactus Interpolation API} -\label{PUGHInterp_old_API} - -Currently, \PUGHInterp\ also implements the old Cactus interpolation API -for grid arrays {\tt CCTK\_InterpGV()}. -For that purpose, it registers different {\tt CCTK\_InterpGV()} operators -under the name {\tt "uniform cartesian"} prepended by the interpolation order, -i.e.\ {\tt "second-order uniform cartesian"}). Currently there are -first, second, and third-order interpolation implemented. - -Each operator takes care of the necessary interprocessor communication, and -also does the actual interpolation itself (as opposed to the new API -\InterpGridArrays\ where an external local interpolator is invoked). - -\subsection{Implementation Notes} -The interpolation operators registered for different orders are mapped -via wrappers (in {\tt Startup.c}) onto a single routine (in {\tt Operator.c}) -just passing the order as an additional argument. - -The routine for distributed arrays will then map all points to interpolate -at to the processors which own those points, and communicate the points' -coordinates and corresponding input arrays ({\tt MPI\_Alltoall()} is used -for this global communication). - -Then the interpolation takes place in parallel on every processor, calling -a core interpolation routine (located in {\tt Interpolate.c}). This one -takes a list of input arrays and points and interpolates these to a -list of output arrays (one output value per interpolation point). -Again, for distributed arrays, the interpolation results for remote points -are sent back to the requesting processors. - -\subsection{Implementation Restrictions} -Current limitations of the core interpolation routine's implementation are: -\begin{itemize} - \item arrays up to three ({\bf MAXDIM}) dimensions only can be handled - \item interpolation orders up to three ({\bf MAXORDER}) only are supported - \item coordinates must be given as {\bf CCTK\_REAL} types - \item input and output array types must be the same - (no type casting of interpolation results supported) -\end{itemize} - -Despite of these limitations, the code it was programmed almost generic -in that it can easily be extended to support higher-dimensional arrays -or more interpolation orders. Please see the NOTES in this source file -for details. - \section{Comments} For more information on how to invoke interpolation operators please refer to the flesh documentation. diff --git a/src/Startup.c b/src/Startup.c index 69be436..f1849e0 100644 --- a/src/Startup.c +++ b/src/Startup.c @@ -32,48 +32,6 @@ void PUGHInterp_Startup (void); #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[]); -static int PUGHInterp_InterpGV (cGH *GH, - int order, - const char *local_interpolator, - const char *coord_system_name, - int N_points, - int N_input_arrays, - int N_output_arrays, - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const int input_array_indices[], - void *const output_arrays[], - const int output_array_types[]); /*@@ @@ -82,12 +40,11 @@ static int PUGHInterp_InterpGV (cGH *GH, @author Thomas Radke @desc The startup registration routine for PUGHInterp. - Registers the PUGHInterp GH extensions setup routine - and the interpolation operators with the flesh. + Registers the PUGHInterp GH extensions setup routine with the + flesh and overloads the CCTK_InterpGridArrays() routine. @enddesc @calls CCTK_OverloadInterpGridArrays CCTK_RegisterGHExtensionSetupGH - CCTK_InterpRegisterOperatorGV @@*/ void PUGHInterp_Startup (void) { @@ -97,13 +54,6 @@ void PUGHInterp_Startup (void) 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"); } @@ -152,147 +102,3 @@ static void *SetupGH (tFleshConfig *config, int convergence_level, cGH *GH) 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, "first-order uniform cartesian", - 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, "second-order uniform cartesian", - 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, "third-order uniform cartesian", - 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 PUGHInterp_InterpGV (cGH *GH, - int order, - const char *local_interpolator, - const char *coord_system_name, - int N_points, - int N_input_arrays, - int N_output_arrays, - const void *const interp_coord_arrays[], - const int interp_coord_array_types[], - const int input_array_indices[], - void *const output_arrays[], - const int output_array_types[]) -{ - int i, N_dims, retval; - int local_interp_handle, param_table_handle, coord_system_handle; - char table_string[64]; - CCTK_INT *_input_array_indices, *_output_array_types; - union - { - const cGH *const_GH; - cGH *non_const_GH; - } _GH; - - - _GH.non_const_GH = GH; - - /* get dimensionality of the coordinate system */ - N_dims = CCTK_CoordSystemDim (coord_system_name); - if (N_dims <= 0) - { - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Cannot get dimensions of coordinate system '%s'", - coord_system_name); - return (-1); - } - coord_system_handle = CCTK_CoordSystemHandle (coord_system_name); - local_interp_handle = CCTK_InterpHandle (local_interpolator); - - /* turn native datatype arrays into CCTK_ datatypes */ - _input_array_indices = malloc (2 * N_dims * sizeof (CCTK_INT)); - _output_array_types = _input_array_indices + N_dims; - for (i = 0; i < N_dims; i++) - { - _input_array_indices[i] = input_array_indices[i]; - _output_array_types[i] = output_array_types[i]; - } - - /* set up the parameter table (only supported option is "order") */ - sprintf (table_string, "order = %d", order); - param_table_handle = Util_TableCreateFromString (table_string); - - retval = PUGHInterp_InterpGridArrays (_GH.const_GH, N_dims, - local_interp_handle, param_table_handle, - coord_system_handle, - N_points, - interp_coord_array_types[0], - interp_coord_arrays, - N_input_arrays, - _input_array_indices, - N_output_arrays, - _output_array_types, - output_arrays); - - /* release resources */ - Util_TableDestroy (param_table_handle); - free (_input_array_indices); - - return (retval); -} -- cgit v1.2.3