aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@732e31d2-b375-409b-9bd3-699c3b2c9da5>2002-10-22 14:59:28 +0000
committerschnetter <schnetter@732e31d2-b375-409b-9bd3-699c3b2c9da5>2002-10-22 14:59:28 +0000
commit7882dfdbfcdf6f97e6e9bb6cf69c33bc07e149d2 (patch)
tree5a88a399350c6ef108a3375c8a708b22b1646d1a
parent736e86a468c333e9f288d453079a9aeb82434ad4 (diff)
Testing the Slab thorn.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/SlabTest/trunk@2 732e31d2-b375-409b-9bd3-699c3b2c9da5
-rw-r--r--README10
-rw-r--r--doc/documentation.tex140
-rw-r--r--interface.ccl30
-rw-r--r--par/slabtest.par11
-rw-r--r--param.ccl2
-rw-r--r--schedule.ccl8
-rw-r--r--src/make.code.defn9
-rw-r--r--src/slabtest.c348
8 files changed, 558 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..3f456b5
--- /dev/null
+++ b/README
@@ -0,0 +1,10 @@
+CVS info : $Header$
+
+Cactus Code Thorn SlabTest
+Thorn Author(s) : Erik Schnetter <schnetter@uni-tuebingen.de>
+Thorn Maintainer(s) : Erik Schnetter <schnetter@uni-tuebingen.de>
+--------------------------------------------------------------------------
+
+Purpose of the thorn:
+
+This thorn tests the slab transfer routines of the thorn Slab.
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100644
index 0000000..7ab6c41
--- /dev/null
+++ b/doc/documentation.tex
@@ -0,0 +1,140 @@
+% *======================================================================*
+% Cactus Thorn template for ThornGuide documentation
+% Author: Ian Kelley
+% Date: Sun Jun 02, 2002
+% $Header$
+%
+% Thorn documentation in the latex file doc/documentation.tex
+% will be included in ThornGuides built with the Cactus make system.
+% The scripts employed by the make system automatically include
+% pages about variables, parameters and scheduling parsed from the
+% relevent thorn CCL files.
+%
+% This template contains guidelines which help to assure that your
+% documentation will be correctly added to ThornGuides. More
+% information is available in the Cactus UsersGuide.
+%
+% Guidelines:
+% - Do not change anything before the line
+% % START CACTUS THORNGUIDE",
+% except for filling in the title, author, date etc. fields.
+% - Each of these fields should only be on ONE line.
+% - Author names should be sparated with a \\ or a comma
+% - You can define your own macros are OK, but they must appear after
+% the START CACTUS THORNGUIDE line, and do not redefine standard
+% latex commands.
+% - To avoid name clashes with other thorns, 'labels', 'citations',
+% 'references', and 'image' names should conform to the following
+% convention:
+% ARRANGEMENT_THORN_LABEL
+% For example, an image wave.eps in the arrangement CactusWave and
+% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps
+% - Graphics should only be included using the graphix package.
+% More specifically, with the "includegraphics" command. Do
+% not specify any graphic file extensions in your .tex file. This
+% will allow us (later) to create a PDF version of the ThornGuide
+% via pdflatex. |
+% - References should be included with the latex "bibitem" command.
+% - use \begin{abstract}...\end{abstract} instead of \abstract{...}
+% - For the benefit of our Perl scripts, and for future extensions,
+% please use simple latex.
+%
+% *======================================================================*
+%
+% Example of including a graphic image:
+% \begin{figure}[ht]
+% \begin{center}
+% \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}
+% \end{center}
+% \caption{Illustration of this and that}
+% \label{MyArrangement_MyThorn_MyLabel}
+% \end{figure}
+%
+% Example of using a label:
+% \label{MyArrangement_MyThorn_MyLabel}
+%
+% Example of a citation:
+% \cite{MyArrangement_MyThorn_Author99}
+%
+% Example of including a reference
+% \bibitem{MyArrangement_MyThorn_Author99}
+% {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999),
+% 1--16. {\tt http://www.nowhere.com/}}
+%
+% *======================================================================*
+
+% If you are using CVS use this line to give version information
+% $Header$
+
+\documentclass{article}
+
+% Use the Cactus ThornGuide style file
+% (Automatically used from Cactus distribution, if you have a
+% thorn without the Cactus Flesh download this from the Cactus
+% homepage at www.cactuscode.org)
+\usepackage{../../../../doc/ThornGuide/cactus}
+
+\begin{document}
+
+% The author of the documentation
+\author{Erik Schnetter $<$schnetter@uni-tuebingen.de$>$}
+
+% The title of the document (not necessarily the name of the Thorn)
+\title{}
+
+% the date your document was last changed, if your document is in CVS,
+% please use:
+% \date{$ $Date$ $}
+\date{October 16 2002}
+
+\maketitle
+
+% Do not delete next line
+% START CACTUS THORNGUIDE
+
+% Add all definitions used in this documentation here
+% \def\mydef etc
+
+% Add an abstract for this thorn's documentation
+\begin{abstract}
+
+\end{abstract}
+
+% The following sections are suggestive only.
+% Remove them or add your own.
+
+\section{Introduction}
+
+\section{Physical System}
+
+\section{Numerical Implementation}
+
+\section{Using This Thorn}
+
+\subsection{Obtaining This Thorn}
+
+\subsection{Basic Usage}
+
+\subsection{Special Behaviour}
+
+\subsection{Interaction With Other Thorns}
+
+\subsection{Support and Feedback}
+
+\section{History}
+
+\subsection{Thorn Source Code}
+
+\subsection{Thorn Documentation}
+
+\subsection{Acknowledgements}
+
+
+\begin{thebibliography}{9}
+
+\end{thebibliography}
+
+% Do not delete next line
+% END CACTUS THORNGUIDE
+
+\end{document}
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..ac13f1e
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,30 @@
+# Interface definition for thorn SlabTest
+# $Header$
+
+IMPLEMENTS: SlabTest
+
+INHERITS: Slab
+
+USES INCLUDE HEADER: Slab.h
+
+
+
+CCTK_REAL gfs TYPE=gf
+{
+ gfx gfy gfz
+} "grid functions"
+
+CCTK_REAL a1s TYPE=array DIM=1 SIZE=10
+{
+ a1x a1y a1z
+} "1D grid arrays"
+
+CCTK_REAL a2s TYPE=array DIM=2 SIZE=10,10
+{
+ a2x a2y a2z
+} "2D grid arrays"
+
+CCTK_REAL a3s TYPE=array DIM=3 SIZE=10,10,10
+{
+ a3x a3y a3z
+} "3D grid arrays"
diff --git a/par/slabtest.par b/par/slabtest.par
new file mode 100644
index 0000000..9709567
--- /dev/null
+++ b/par/slabtest.par
@@ -0,0 +1,11 @@
+# $Header$
+
+cactus::cctk_itlast = 0
+
+ActiveThorns = "PUGH"
+
+driver::global_nx = 10
+driver::global_ny = 11
+driver::global_nz = 12
+
+ActiveThorns = "Slab SlabTest"
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..3c3265a
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,2 @@
+# Parameter definitions for thorn SlabTest
+# $Header$
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..03253a7
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,8 @@
+# Schedule definitions for thorn SlabTest
+# $Header$
+
+SCHEDULE SlabTest_Test AT initial
+{
+ LANG: C
+ STORAGE: gfs a1s a2s a3s
+} "Test Slab transfer routines"
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..802e911
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,9 @@
+# Main make.code.defn file for thorn SlabTest
+# $Header$
+
+# Source files in this directory
+SRCS = slabtest.c
+
+# Subdirectories containing source files
+SUBDIRS =
+
diff --git a/src/slabtest.c b/src/slabtest.c
new file mode 100644
index 0000000..93fc4ff
--- /dev/null
+++ b/src/slabtest.c
@@ -0,0 +1,348 @@
+/* $Header$ */
+
+#include <assert.h>
+#include <stdio.h>
+
+#include "cctk.h"
+#include "cctk_Arguments.h"
+
+#include "Slab.h"
+
+
+
+static const char * rcsid = "$Header$";
+
+CCTK_FILEVERSION(TAT_SlabTest_slabtest_c);
+
+
+
+static void runtest (CCTK_ARGUMENTS, struct xferinfo const * const info)
+{
+ DECLARE_CCTK_ARGUMENTS;
+
+ int i, j, k;
+
+ int mismatch;
+
+ int ierr;
+
+ ierr = Slab_Transfer
+ (cctkGH, cctk_dim, info, CCTK_VARIABLE_REAL, gfx, CCTK_VARIABLE_REAL, gfy);
+ assert (!ierr);
+
+ mismatch = 0;
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ if (gfy[ind] != gfz[ind]) {
+ printf
+ ("Mismatch at [%d,%d,%d]: should %g, is %g\n",
+ cctk_lbnd[0] + i, cctk_lbnd[1] + j, cctk_lbnd[2] + k,
+ gfz[ind], gfy[ind]);
+ mismatch = 1;
+ }
+ }
+ }
+ }
+ assert (! mismatch);
+}
+
+
+
+void SlabTest_Test (CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+
+ struct xferinfo info[3];
+
+ int i, j, k;
+ int d;
+
+ CCTK_INFO ("Testing slabs...");
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.gsh = cctk_gsh[d];
+ info[d].src.lbnd = cctk_lbnd[d];
+ info[d].src.lsh = cctk_lsh[d];
+ info[d].src.lbbox = cctk_bbox[2*d];
+ info[d].src.ubbox = cctk_bbox[2*d+1];
+ info[d].src.nghostzones = cctk_nghostzones[d];
+ info[d].dst.gsh = cctk_gsh[d];
+ info[d].dst.lbnd = cctk_lbnd[d];
+ info[d].dst.lsh = cctk_lsh[d];
+ info[d].dst.lbbox = cctk_bbox[2*d];
+ info[d].dst.ubbox = cctk_bbox[2*d+1];
+ info[d].dst.nghostzones = cctk_nghostzones[d];
+ }
+
+
+
+ CCTK_INFO (" Identity");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ gfz[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.off = 0;
+ info[d].src.len = cctk_gsh[d];
+ info[d].src.str = 1;
+ info[d].dst.off = 0;
+ info[d].dst.len = cctk_gsh[d];
+ info[d].dst.str = 1;
+ info[d].xpose = d;
+ info[d].flip = 0;
+ }
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Invert x direction");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ gfz[ind] = 10000 * (cctk_gsh[0] - 1 - cctk_lbnd[0] - i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.off = 0;
+ info[d].src.len = cctk_gsh[d];
+ info[d].src.str = 1;
+ info[d].dst.off = 0;
+ info[d].dst.len = cctk_gsh[d];
+ info[d].dst.str = 1;
+ info[d].xpose = d;
+ info[d].flip = d==0;
+ }
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Invert all directions");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ gfz[ind] = 10000 * (cctk_gsh[0] - 1 - cctk_lbnd[0] - i) + 100 * (cctk_gsh[1] - 1 - cctk_lbnd[1] - j) + (cctk_gsh[2] - 1 - cctk_lbnd[2] - k);
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.off = 0;
+ info[d].src.len = cctk_gsh[d];
+ info[d].src.str = 1;
+ info[d].dst.off = 0;
+ info[d].dst.len = cctk_gsh[d];
+ info[d].dst.str = 1;
+ info[d].xpose = d;
+ info[d].flip = 1;
+ }
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Transfer smaller slab");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ if (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 5
+ && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 5
+ && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {
+ gfz[ind] = 10000 * (cctk_lbnd[0] + i + 2) + 100 * (cctk_lbnd[1] + j + 1) + (cctk_lbnd[2] + k - 1);
+ } else {
+ gfz[ind] = gfy[ind];
+ }
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.str = 1;
+ info[d].dst.str = 1;
+ info[d].xpose = d;
+ info[d].flip = 0;
+ }
+ info[0].src.off = 4;
+ info[1].src.off = 4;
+ info[2].src.off = 3;
+ info[0].src.len = 3;
+ info[1].src.len = 2;
+ info[2].src.len = 2;
+ info[0].dst.off = 2;
+ info[1].dst.off = 3;
+ info[2].dst.off = 4;
+ info[0].dst.len = 3;
+ info[1].dst.len = 2;
+ info[2].dst.len = 2;
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Transpose x and z");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ if (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 4
+ && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 6
+ && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {
+ gfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[1] + j + 2) + (cctk_lbnd[0] + i - 1);
+ } else {
+ gfz[ind] = gfy[ind];
+ }
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.str = 1;
+ info[d].dst.str = 1;
+ info[d].flip = 0;
+ }
+ info[0].src.off = 5;
+ info[1].src.off = 5;
+ info[2].src.off = 1;
+ info[0].src.len = 2;
+ info[1].src.len = 3;
+ info[2].src.len = 2;
+ info[0].dst.off = 2;
+ info[1].dst.off = 3;
+ info[2].dst.off = 4;
+ info[0].dst.len = 2;
+ info[1].dst.len = 3;
+ info[2].dst.len = 2;
+ info[0].xpose = 2;
+ info[1].xpose = 1;
+ info[2].xpose = 0;
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Transpose");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ if (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 5
+ && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 5
+ && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {
+ gfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[0] + i + 3) + (cctk_lbnd[1] + j - 2);
+ } else {
+ gfz[ind] = gfy[ind];
+ }
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.str = 1;
+ info[d].dst.str = 1;
+ info[d].flip = 0;
+ }
+ info[0].src.off = 5;
+ info[1].src.off = 5;
+ info[2].src.off = 1;
+ info[0].src.len = 2;
+ info[1].src.len = 3;
+ info[2].src.len = 2;
+ info[0].dst.off = 2;
+ info[1].dst.off = 3;
+ info[2].dst.off = 4;
+ info[0].dst.len = 3;
+ info[1].dst.len = 2;
+ info[2].dst.len = 2;
+ info[0].xpose = 1;
+ info[1].xpose = 2;
+ info[2].xpose = 0;
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ CCTK_INFO (" Transpose x and z and invert x");
+
+ for (k=0; k<cctk_lsh[2]; ++k) {
+ for (j=0; j<cctk_lsh[1]; ++j) {
+ for (i=0; i<cctk_lsh[0]; ++i) {
+ const int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);
+ gfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);
+ gfy[ind] = - (i + 3 * j + 5 * k);
+ if (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 4
+ && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 6
+ && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {
+ gfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[1] + j + 2) + (4 - cctk_lbnd[0] - i);
+ } else {
+ gfz[ind] = gfy[ind];
+ }
+ }
+ }
+ }
+
+ assert (cctk_dim <= 3);
+ for (d=0; d<cctk_dim; ++d) {
+ info[d].src.str = 1;
+ info[d].dst.str = 1;
+ info[d].flip = d==0;
+ }
+ info[0].src.off = 5;
+ info[1].src.off = 5;
+ info[2].src.off = 1;
+ info[0].src.len = 2;
+ info[1].src.len = 3;
+ info[2].src.len = 2;
+ info[0].dst.off = 2;
+ info[1].dst.off = 3;
+ info[2].dst.off = 4;
+ info[0].dst.len = 2;
+ info[1].dst.len = 3;
+ info[2].dst.len = 2;
+ info[0].xpose = 2;
+ info[1].xpose = 1;
+ info[2].xpose = 0;
+
+ runtest (CCTK_PASS_CTOC, info);
+
+
+
+ /* TODO: strides, into array, out of array */
+}