einsteintoolkit / CactusNumerical_SlabTest.json
xinshuo's picture
Upload folder using huggingface_hub
10a2580 verified
{
"thorn_name": "CactusNumerical/SlabTest",
"url": "https://bitbucket.org/cactuscode/cactusnumerical.git",
"configuration": "",
"interface": "# Interface definition for thorn SlabTest\n# $Header$\n\nIMPLEMENTS: SlabTest\n\nINHERITS: Slab\n\nUSES INCLUDE HEADER: Slab.h\n\n\n\nCCTK_REAL gfs TYPE=gf\n{\n gfx gfy gfz\n} \"grid functions\"\n\nCCTK_INT igfs TYPE=gf\n{\n igfx igfy igfz\n} \"integer grid functions\"\n\nCCTK_REAL a1s TYPE=array DIM=1 SIZE=10\n{\n a1x a1y a1z\n} \"1D grid arrays\"\n\nCCTK_REAL a2s TYPE=array DIM=2 SIZE=10,10\n{\n a2x a2y a2z\n} \"2D grid arrays\"\n\nCCTK_REAL a3s TYPE=array DIM=3 SIZE=10,10,10\n{\n a3x a3y a3z\n} \"3D grid arrays\"\n\n\n\nCCTK_INT success \"Indicate a successful test\"\n",
"param": "# Parameter definitions for thorn SlabTest\n# $Header$\n",
"schedule": "# Schedule definitions for thorn SlabTest\n# $Header$\n\nSTORAGE: success\n\nSCHEDULE SlabTest_Test AT initial\n{\n LANG: C\n STORAGE: gfs a1s a2s a3s igfs\n} \"Test Slab transfer routines\"\n",
"src": {
"make.code.defn": "# Main make.code.defn file for thorn SlabTest\n# $Header$\n\n# Source files in this directory\nSRCS = slabtest.c\n\n# Subdirectories containing source files\nSUBDIRS = \n\n",
"slabtest.c": "/* $Header$ */\n\n#include <assert.h>\n#include <stdio.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n\n#include \"Slab.h\"\n\n\n\nstatic const char * rcsid = \"$Header$\";\n\nCCTK_FILEVERSION(TAT_SlabTest_slabtest_c);\n \n\n\nstatic void\nruntest (CCTK_ARGUMENTS,\n\t struct xferinfo const * restrict const info)\n{\n DECLARE_CCTK_ARGUMENTS;\n \n int i, j, k;\n \n int mismatch;\n\n# define nvars 2\n const int vartypes[nvars] = {CCTK_VARIABLE_REAL, CCTK_VARIABLE_INT};\n const void *srcdataptrs[nvars] = {gfx, igfx};\n void *dstdataptrs[nvars] = {gfy, igfy};\n \n int ierr;\n \n ierr = Slab_MultiTransfer\n (cctkGH, cctk_dim, info, -1,\n nvars, vartypes, srcdataptrs, vartypes, dstdataptrs);\n assert (!ierr);\n \n mismatch = 0;\n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tif (gfy[ind] != gfz[ind]) {\n\t printf\n\t (\"Real valued mismatch at [%d,%d,%d]: should be %g, is %g\\n\",\n\t cctk_lbnd[0] + i, cctk_lbnd[1] + j, cctk_lbnd[2] + k,\n\t (double) gfz[ind], (double) gfy[ind]);\n\t mismatch = 1;\n\t}\n\tif (igfy[ind] != igfz[ind]) {\n\t printf\n\t (\"Integer valued mismatch at [%d,%d,%d]: should be %d, is %d\\n\",\n\t cctk_lbnd[0] + i, cctk_lbnd[1] + j, cctk_lbnd[2] + k,\n\t (int) igfz[ind], (int) igfy[ind]);\n\t mismatch = 1;\n\t}\n }\n }\n }\n assert (! mismatch);\n}\n\n\n\nvoid SlabTest_Test (CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS;\n \n struct xferinfo info[3];\n \n int i, j, k;\n int d;\n \n CCTK_INFO (\"Testing slabs...\");\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.gsh = cctk_gsh[d];\n info[d].src.lbnd = cctk_lbnd[d];\n info[d].src.lsh = cctk_lsh[d];\n info[d].src.ash = cctk_ash[d];\n info[d].src.lbbox = cctk_bbox[2*d];\n info[d].src.ubbox = cctk_bbox[2*d+1];\n info[d].src.nghostzones = cctk_nghostzones[d];\n info[d].dst.gsh = cctk_gsh[d];\n info[d].dst.lbnd = cctk_lbnd[d];\n info[d].dst.lsh = cctk_lsh[d];\n info[d].dst.ash = cctk_ash[d];\n info[d].dst.lbbox = cctk_bbox[2*d];\n info[d].dst.ubbox = cctk_bbox[2*d+1];\n info[d].dst.nghostzones = cctk_nghostzones[d];\n }\n \n \n \n CCTK_INFO (\" Identity\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tgfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.off = 0;\n info[d].src.len = cctk_gsh[d];\n info[d].src.str = 1;\n info[d].dst.off = 0;\n info[d].dst.len = cctk_gsh[d];\n info[d].dst.str = 1;\n info[d].xpose = d;\n info[d].flip = 0;\n }\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Invert x direction\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tgfz[ind] = igfz[ind] = 10000 * (cctk_gsh[0] - 1 - cctk_lbnd[0] - i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.off = 0;\n info[d].src.len = cctk_gsh[d];\n info[d].src.str = 1;\n info[d].dst.off = 0;\n info[d].dst.len = cctk_gsh[d];\n info[d].dst.str = 1;\n info[d].xpose = d;\n info[d].flip = d==0;\n }\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Invert all directions\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tgfz[ind] = igfz[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);\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.off = 0;\n info[d].src.len = cctk_gsh[d];\n info[d].src.str = 1;\n info[d].dst.off = 0;\n info[d].dst.len = cctk_gsh[d];\n info[d].dst.str = 1;\n info[d].xpose = d;\n info[d].flip = 1;\n }\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Transfer smaller slab\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tif (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 5\n\t && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 5\n\t && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {\n\t gfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[0] + i + 2) + 100 * (cctk_lbnd[1] + j + 1) + (cctk_lbnd[2] + k - 1);\n\t} else {\n\t gfz[ind] = gfy[ind];\n\t igfz[ind] = igfy[ind];\n\t}\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.str = 1;\n info[d].dst.str = 1;\n info[d].xpose = d;\n info[d].flip = 0;\n }\n info[0].src.off = 4;\n info[1].src.off = 4;\n info[2].src.off = 3;\n info[0].src.len = 3;\n info[1].src.len = 2;\n info[2].src.len = 2;\n info[0].dst.off = 2;\n info[1].dst.off = 3;\n info[2].dst.off = 4;\n info[0].dst.len = 3;\n info[1].dst.len = 2;\n info[2].dst.len = 2;\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Transpose x and z\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tif (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 4\n\t && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 6\n\t && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {\n\t gfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[1] + j + 2) + (cctk_lbnd[0] + i - 1);\n\t} else {\n\t gfz[ind] = gfy[ind];\n\t igfz[ind] = igfy[ind];\n\t}\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.str = 1;\n info[d].dst.str = 1;\n info[d].flip = 0;\n }\n info[0].src.off = 5;\n info[1].src.off = 5;\n info[2].src.off = 1;\n info[0].src.len = 2;\n info[1].src.len = 3;\n info[2].src.len = 2;\n info[0].dst.off = 2;\n info[1].dst.off = 3;\n info[2].dst.off = 4;\n info[0].dst.len = 2;\n info[1].dst.len = 3;\n info[2].dst.len = 2;\n info[0].xpose = 2;\n info[1].xpose = 1;\n info[2].xpose = 0;\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Transpose\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tif (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 5\n\t && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 5\n\t && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {\n\t gfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[0] + i + 3) + (cctk_lbnd[1] + j - 2);\n\t} else {\n\t gfz[ind] = gfy[ind];\n\t igfz[ind] = igfy[ind];\n\t}\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.str = 1;\n info[d].dst.str = 1;\n info[d].flip = 0;\n }\n info[0].src.off = 5;\n info[1].src.off = 5;\n info[2].src.off = 1;\n info[0].src.len = 2;\n info[1].src.len = 3;\n info[2].src.len = 2;\n info[0].dst.off = 2;\n info[1].dst.off = 3;\n info[2].dst.off = 4;\n info[0].dst.len = 3;\n info[1].dst.len = 2;\n info[2].dst.len = 2;\n info[0].xpose = 1;\n info[1].xpose = 2;\n info[2].xpose = 0;\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Transpose x and z and invert x\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tif (cctk_lbnd[0] + i >= 2 && cctk_lbnd[0] + i < 4\n\t && cctk_lbnd[1] + j >= 3 && cctk_lbnd[1] + j < 6\n\t && cctk_lbnd[2] + k >= 4 && cctk_lbnd[2] + k < 6) {\n\t gfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[2] + k + 1) + 100 * (cctk_lbnd[1] + j + 2) + (4 - cctk_lbnd[0] - i);\n\t} else {\n\t gfz[ind] = gfy[ind];\n\t igfz[ind] = igfy[ind];\n\t}\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.str = 1;\n info[d].dst.str = 1;\n info[d].flip = d==0;\n }\n info[0].src.off = 5;\n info[1].src.off = 5;\n info[2].src.off = 1;\n info[0].src.len = 2;\n info[1].src.len = 3;\n info[2].src.len = 2;\n info[0].dst.off = 2;\n info[1].dst.off = 3;\n info[2].dst.off = 4;\n info[0].dst.len = 2;\n info[1].dst.len = 3;\n info[2].dst.len = 2;\n info[0].xpose = 2;\n info[1].xpose = 1;\n info[2].xpose = 0;\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n CCTK_INFO (\" Skip every second cell along y direction\");\n \n for (k=0; k<cctk_lsh[2]; ++k) {\n for (j=0; j<cctk_lsh[1]; ++j) {\n for (i=0; i<cctk_lsh[0]; ++i) {\n\tconst int ind = CCTK_GFINDEX3D(cctkGH, i,j,k);\n\tgfx[ind] = igfx[ind] = 10000 * (cctk_lbnd[0] + i) + 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\tgfy[ind] = igfy[ind] = - (i + 3 * j + 5 * k);\n\tif (cctk_lbnd[1] + j < cctk_gsh[1] / 2) {\n\t gfz[ind] = igfz[ind] = 10000 * (cctk_lbnd[0] + i) + 2 * 100 * (cctk_lbnd[1] + j) + (cctk_lbnd[2] + k);\n\t} else {\n\t gfz[ind] = gfy[ind];\n\t igfz[ind] = igfy[ind];\n\t}\n }\n }\n }\n \n assert (cctk_dim <= 3);\n for (d=0; d<cctk_dim; ++d) {\n info[d].src.off = 0;\n info[d].src.len = d == 1 ? cctk_gsh[d] / 2 : cctk_gsh[d];\n info[d].src.str = d == 1 ? 2 : 1;\n info[d].dst.off = 0;\n info[d].dst.len = d == 1 ? cctk_gsh[d] / 2 : cctk_gsh[d];\n info[d].dst.str = 1;\n info[d].xpose = d;\n info[d].flip = 0;\n }\n \n runtest (CCTK_PASS_CTOC, info);\n \n \n \n /* TODO: more strides, into array, out of array */\n \n \n \n * success = 1;\n}\n"
},
"test": {
"slabtest.par": "# $Header$\n\ncactus::cctk_itlast = 0\n\nActiveThorns = \"CycleClock hwloc LoopControl\"\n\nActiveThorns = \"IOUtil\"\n\nIO::out_dir = $parfile\nIO::parfile_write = no\nIO::out_fileinfo = \"none\"\n\nActiveThorns = \"PUGH PUGHSlab\"\n\ndriver::global_nx = 10\ndriver::global_ny = 11\ndriver::global_nz = 12\n\nActiveThorns = \"Slab SlabTest\"\n\nActiveThorns = \"IOBasic\"\n\nIOBasic::outScalar_every = 1\nIOBasic::outScalar_vars = \"SlabTest::success\"\n",
"slabtest/success.xg": "\"success v time\n0.0000000000000\t1\n"
},
"doc": {
"documentation.tex": "% *======================================================================*\n% Cactus Thorn template for ThornGuide documentation\n% Author: Ian Kelley\n% Date: Sun Jun 02, 2002\n% $Header$ \n%\n% Thorn documentation in the latex file doc/documentation.tex \n% will be included in ThornGuides built with the Cactus make system.\n% The scripts employed by the make system automatically include \n% pages about variables, parameters and scheduling parsed from the \n% relevent thorn CCL files.\n% \n% This template contains guidelines which help to assure that your \n% documentation will be correctly added to ThornGuides. More \n% information is available in the Cactus UsersGuide.\n% \n% Guidelines:\n% - Do not change anything before the line\n% % START CACTUS THORNGUIDE\",\n% except for filling in the title, author, date etc. fields.\n% - Each of these fields should only be on ONE line.\n% - Author names should be sparated with a \\\\ or a comma\n% - You can define your own macros are OK, but they must appear after\n% the START CACTUS THORNGUIDE line, and do not redefine standard \n% latex commands.\n% - To avoid name clashes with other thorns, 'labels', 'citations', \n% 'references', and 'image' names should conform to the following \n% convention: \n% ARRANGEMENT_THORN_LABEL\n% For example, an image wave.eps in the arrangement CactusWave and \n% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps\n% - Graphics should only be included using the graphix package. \n% More specifically, with the \"includegraphics\" command. Do\n% not specify any graphic file extensions in your .tex file. This \n% will allow us (later) to create a PDF version of the ThornGuide\n% via pdflatex. |\n% - References should be included with the latex \"bibitem\" command. \n% - use \\begin{abstract}...\\end{abstract} instead of \\abstract{...}\n% - For the benefit of our Perl scripts, and for future extensions, \n% please use simple latex. \n%\n% *======================================================================* \n% \n% Example of including a graphic image:\n% \\begin{figure}[ht]\n% \t\\begin{center}\n% \t \\includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}\n% \t\\end{center}\n% \t\\caption{Illustration of this and that}\n% \t\\label{MyArrangement_MyThorn_MyLabel}\n% \\end{figure}\n%\n% Example of using a label:\n% \\label{MyArrangement_MyThorn_MyLabel}\n%\n% Example of a citation:\n% \\cite{MyArrangement_MyThorn_Author99}\n%\n% Example of including a reference\n% \\bibitem{MyArrangement_MyThorn_Author99}\n% {J. Author, {\\em The Title of the Book, Journal, or periodical}, 1 (1999), \n% 1--16. {\\tt http://www.nowhere.com/}}\n%\n% *======================================================================* \n\n% If you are using CVS use this line to give version information\n% $Header$\n\n\\documentclass{article}\n\n% Use the Cactus ThornGuide style file\n% (Automatically used from Cactus distribution, if you have a \n% thorn without the Cactus Flesh download this from the Cactus\n% homepage at www.cactuscode.org)\n\\usepackage{../../../../doc/latex/cactus}\n\n\\begin{document}\n\n% The author of the documentation\n\\author{Erik Schnetter $<$schnetter@uni-tuebingen.de$>$}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{Testing the Slab thorn}\n\n% the date your document was last changed, if your document is in CVS, \n% please use:\n\\date{$ $Date$ $}\n\n\\maketitle\n\n% Do not delete next line\n% START CACTUS THORNGUIDE\n\n% Add all definitions used in this documentation here \n% \\def\\mydef etc\n\n% Add an abstract for this thorn's documentation\n\\begin{abstract}\nSlatTest tests the Slab thorn.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Introduction}\n\n\\section{Physical System}\n\n\\section{Numerical Implementation}\n\n\\section{Using This Thorn}\n\n\\subsection{Obtaining This Thorn}\n\n\\subsection{Basic Usage}\n\n\\subsection{Special Behaviour}\n\n\\subsection{Interaction With Other Thorns}\n\n\\subsection{Support and Feedback}\n\n\\section{History}\n\n\\subsection{Thorn Source Code}\n\n\\subsection{Thorn Documentation}\n\n\\subsection{Acknowledgements}\n\n\n\\begin{thebibliography}{9}\n\n\\end{thebibliography}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
}
}