summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorjthorn <jthorn@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-20 18:09:47 +0000
committerjthorn <jthorn@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-12-20 18:09:47 +0000
commit7030adc005b6200c70214ccb0be33738410fb09d (patch)
tree478e68d644f232b54713aaba0bd28144b40ae128 /doc
parent8c07f9aa71c72b9e344f2da3b57f70503b6eb679 (diff)
add previously-missing example for CCTK_InterpGridArrays()
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2523 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'doc')
-rw-r--r--doc/UsersGuide/FunctionReference.tex71
1 files changed, 70 insertions, 1 deletions
diff --git a/doc/UsersGuide/FunctionReference.tex b/doc/UsersGuide/FunctionReference.tex
index 41ba2cf8..341c4681 100644
--- a/doc/UsersGuide/FunctionReference.tex
+++ b/doc/UsersGuide/FunctionReference.tex
@@ -236,6 +236,12 @@ from Fortran.
[\pageref{CCTK-INFO}]
Prints an information message
+\item[CCTK\_InterpGridArrays]
+ [\pageref{CCTK-InterpLocalArrays}]
+ Performs an interpolation on a list of distributed arrays,
+ using a chosen interpolation operator (currently being implemented;
+ should be available in early 2002)
+
\item[CCTK\_InterpGV]
[\pageref{CCTK-InterpGV}]
Performs an interpolation on a list of distributed CCTK grid variables,
@@ -255,7 +261,8 @@ from Fortran.
\item[CCTK\_InterpLocalArrays]
[\pageref{CCTK-InterpLocalArrays}]
Performs an interpolation on a list of processor-local arrays,
- using a chosen interpolation operator
+ using a chosen interpolation operator (currently being implemented;
+ should be available in early 2002)
\item[CCTK\_InterpRegisterOperatorGV]
[\pageref{CCTK-InterpRegisterOperatorGV}]
@@ -1951,6 +1958,68 @@ unable to allocate memory
\begin{Error}{UTIL\_ERROR\_BAD\_HANDLE}
parameter table handle is invalid
\end{Error}
+
+\begin{Example}{C}
+Here's a simple example to do quartic interpolation of a real and
+a complex grid array in 3-D, at 1000 interpolation points.
+
+\begin{verbatim}
+#include "cctk.h"
+#include "util_Table.h"
+
+#define N_DIMS 3
+#define N_INPUT_ARRAYS 2
+#define N_INTERP_POINTS 1000
+#define N_OUTPUT_ARRAYS 2
+const cGH *GH;
+int operator_handle, coord_system_handle;
+
+/* interpolation points */
+CCTK_REAL interp_x[N_INTERP_POINTS],
+ interp_y[N_INTERP_POINTS],
+ interp_z[N_INTERP_POINTS];
+static const CCTK_INT interp_coord_type_codes[N_DIMS]
+ = { CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL };
+const void *interp_coords[N_DIMS];
+
+/* input/output arrays */
+CCTK_INT input_array_variable_indices[N_INPUT_ARRAYS];
+static const CCTK_INT output_array_type_codes[N_OUTPUT_ARRAYS]
+ = { CCTK_VARIABLE_REAL, CCTK_VARIABLE_COMPLEX };
+void *output_arrays[N_OUTPUT_ARRAYS];
+CCTK_REAL output_for_real_array [N_INTERP_POINTS];
+CCTK_COMPLEX output_for_complex_array[N_INTERP_POINTS];
+
+operator_handle = CCTK_InterpHandle("generalized polynomial");
+if (operator_handle < 0)
+ CCTK_WARN(-1, "can't get operator handle!");
+
+coord_system_handle = CCTK_CoordSystemHandle("cart3d");
+if (coord_system_handle < 0)
+ CCTK_WARN(-1, "can't get coordinate-system handle!");
+
+interp_coords[0] = (const void *) interp_x;
+interp_coords[1] = (const void *) interp_y;
+interp_coords[2] = (const void *) interp_z;
+
+input_array_variable_indices[0] = CCTK_VarIndex("my_thorn::real_array");
+input_array_variable_indices[1] = CCTK_VarIndex("my_thorn::complex_array");
+
+output_arrays[0] = (void *) output_for_real_array;
+output_arrays[1] = (void *) output_for_complex_array;
+
+if (CCTK_InterpGridArrays(GH, N_DIMS,
+ operator_handle,
+ Util_TableCreateFromString("order=4"),
+ coord_system_handle,
+ N_INTERP_POINTS, interp_coord_type_codes,
+ interp_coords,
+ N_INPUT_ARRAYS, input_array_variable_indices,
+ N_OUTPUT_ARRAYS, output_array_type_codes,
+ output_arrays) < 0)
+ CCTK_WARN(-1, "error return from interpolator!");
+\end{verbatim}
+\end{Example}
\end{FunctionDescription}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%