Upload folder using huggingface_hub
Browse files- EinsteinBase_ADMCoupling.json +16 -0
- EinsteinBase_ADMMacros.json +0 -0
- ExternalLibraries_BLAS.json +16 -0
- ExternalLibraries_FFTW3.json +18 -0
- ExternalLibraries_GSL.json +18 -0
- ExternalLibraries_HDF5.json +23 -0
- ExternalLibraries_LAPACK.json +16 -0
- ExternalLibraries_LORENE.json +18 -0
- ExternalLibraries_MPI.json +20 -0
- ExternalLibraries_OpenSSL.json +15 -0
- ExternalLibraries_PAPI.json +27 -0
- ExternalLibraries_hwloc.json +22 -0
- ExternalLibraries_libjpeg.json +15 -0
- ExternalLibraries_pthreads.json +16 -0
- ExternalLibraries_zlib.json +15 -0
- Llama_ADMDerivatives.json +18 -0
- Llama_Coordinates.json +0 -0
- Llama_CoordinatesSymmetry.json +16 -0
- Llama_GlobalDerivative.json +0 -0
- Llama_Interpolate2.json +20 -0
- Llama_LlamaWaveToy.json +0 -0
- Llama_WaveExtractL.json +0 -0
EinsteinBase_ADMCoupling.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "EinsteinBase/ADMCoupling",
|
| 3 |
+
"url": "https://bitbucket.org/einsteintoolkit/einsteinbase.git",
|
| 4 |
+
"configuration": "",
|
| 5 |
+
"interface": "# Interface definition for thorn ADMCoupling\n# $Header$\n\nimplements: ADMCoupling\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn ADMCoupling\n# $Header$\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn ADMCoupling\n# $Header$\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n\n"
|
| 10 |
+
},
|
| 11 |
+
"test": {},
|
| 12 |
+
"doc": {
|
| 13 |
+
"documentation.tex": "\\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\\title{ADMCoupling}\n\\author{Ian Hawke, David Rideout}\n\\date{$ $Date$ $}\n\n\\maketitle\n\n% Do not delete next line\n% START CACTUS THORNGUIDE\n\n\\begin{abstract}\nThis thorn allows seamless coupling of evolution and analysis thorns\nto any thorns which contribute matter terms to the stress energy\ntensor $T_{ab}$.\n\\end{abstract} \n\n\\section{Purpose}\n\nThis thorn is completely trivial (there's already more words in the\ndocumentation than in the code). The point is to allow clean coupling\nof matter thorns and spacetime evolution thorns. By making a spacetime\nthorn (such as BSSN) a friend of \\texttt{ADMCoupling} it can know about the\nvariables of the matter thorns (such as Whisky) as long as they are\nalso friends of \\texttt{ADMCoupling}, and then the appropriate stress energy\ntensor terms can be included through the {\\tt CalcTmunu} interface.\nThis avoids explicit dependencies between the spacetime and matter\nevolution thorns. Note that we need to do the same for certain\nanalysis thorns, such as \\texttt{ADMConstraints}.\n\n\\section{CalcTmunu}\n\n\\subsection{Background}\nSo what is this ``\\texttt{CalcTmunu}'', anyway?\n\\texttt{CalcTmunu} is a general interface which allows any thorn to\n`declare' that it contains matter variables, by adding terms to the\ncomponents of the stress energy tensor. This is done using the Cactus\ninclude file mechanism, which allows thorns to contribute code to\ninclude files, which can then be included by any thorn which wishes to\nuse them.\nFor \\texttt{CalcTmunu} there are two include files\\footnote{There used\nto be a third, \\texttt{CalcTmunu\\_rfr.inc}, which was a Cactus 3 legacy\nhaving to do with the rfr scheduling mechanism. You may safely delete\nany reference to this file.},\n\\texttt{CalcTmunu.inc} and \\texttt{CalcTmunu\\_temps.inc}. \n%The name ``temps'' is not so great, it would be better to have the\n%one ``source'' and the other ``declarations'', or something.\n\nIn \\texttt{CalcTmunu.inc}, one can place code of the form\n\\begin{verbatim}\n\tTtt = Ttt + ...\n\tTtx = Ttx + ...\n\tTty = Tty + ...\n\tTtz = Ttz + ...\n\tTxx = Txx + ...\n\tTxy = Txy + ...\n\tTxz = Txz + ...\n\tTyy = Tyy + ...\n\tTyz = Tyz + ...\n\tTzz = Tzz + ...\n\\end{verbatim}\nto add terms to the components $T_{\\mu\\nu}$. Each of these variables\nis of type \\texttt{CCTK\\_REAL}. (If you omit the\n\\texttt{Ttt \\nolinebreak+}, \\texttt{Ttx \\nolinebreak+}, etc. from the right hand sides of\nthese assignment statements then you will be assuming that your thorn\nis the only one which provides matter degrees of freedom, and\nexcluding contributions from other matter thorns which may be\nactivated.)\nThis code will be\nexecuted for each point on the grid, whose indices will be stored in\nthe integers \\texttt{i}, \\texttt{j}, and \\texttt{k}. Currently it must be \n`fixed form' Fortran code.\n\n\\texttt{CalcTmunu\\_temps.inc} will be\nincluded in the variable declaration section for the block of code\nwhich contains the\n\\nopagebreak\n\\begin{verbatim}\n#include \"CalcTmunu.inc\"\n\\end{verbatim}\nOne can put local temporary variable declarations needed for the code\nabove into this file. The \\texttt{Ttt}, \\texttt{Ttx}, etc.~will be\ndeclared within a macro from \\texttt{ADMMacros}.\n\n\\subsection{For matter thorns}\nTo make use of the {\\tt CalcTmunu} interface, simply place the lines\n\\begin{verbatim}\nINCLUDES HEADER: <MyThorn_CalcTmunu_temps.inc> in CalcTmunu_temps.inc\nINCLUDES SOURCE: <MyThorn_CalcTmunu.inc> in CalcTmunu.inc\n\\end{verbatim}\nin your thorn's \\texttt{interface.ccl} file, and declare your thorn to\nbe friends with \\texttt{ADMCoupling}. Then provide the files\n\\texttt{<MyThorn\\_CalcTmunu\\_temps.inc>} and\n\\texttt{<MyThorn\\_CalcTmunu.inc>} somewhere in your thorn's source\ncode.\nWe expect to add a sample matter thorn to \\texttt{CactusEinstein}\nsoon, which will illustrate the use of this.\n\n\\subsection{For thorns which need the stress energy tensor}\nSpacetime evolution thorns and various analysis thorns (e.g. one which\ncomputes the constraints) may need to\nknow the value of the stress-energy tensor.\nSee thorn \\texttt{CactusEinstein/ADM} for an example the former.\n%of a thorn which\n%uses the code inserted into the \\texttt{CalcTmunu} include files.\nThere the macro \\texttt{KSOURCES} (see \\texttt{KSOURCES\\_declare.h}\nand \\texttt{KSOURCES\\_guts.h}) is called from the various time\nintegration source files \\texttt{DoubleLeap.F},\n\\texttt{IterativeCN.F}, etc., which in turn include the\n\\texttt{CalcTmunu\\_temps.inc} and \\texttt{CalcTmunu.inc} files. In\nthis example, the\n$T_{\\mu\\nu}$ temporary variables are provided by including\n\\texttt{CactusEinstein/ADMMacros/src/macro/TRT\\_declare.h}.\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n% LocalWords: ADMCoupling Hawke Whisky CalcTmunu ADMConstraints Ttt Ttx ccl\n% LocalWords: ADMMacros MyThorn KSOURCES DoubleLeap IterativeCN rfr CCTK\n",
|
| 14 |
+
"auto/documentation.el": "(TeX-add-style-hook \"documentation\"\n (function\n (lambda ()\n (LaTeX-add-labels\n \"sec:aux\")\n (TeX-run-style-hooks\n \"latex2e\"\n \"art10\"\n \"article\"\n \"interface\"\n \"param\"\n \"schedule\"))))\n\n"
|
| 15 |
+
}
|
| 16 |
+
}
|
EinsteinBase_ADMMacros.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ExternalLibraries_BLAS.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/BLAS",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn BLAS\n\nPROVIDES BLAS\n{\n SCRIPT configure.sh\n LANG bash\n OPTIONS BLAS_DIR BLAS_INSTALL_DIR BLAS_LIBS\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn BLAS\n\nIMPLEMENTS: BLAS\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn BLAS\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn BLAS\n\n# Source files in this directory\nSRCS = blas.F90\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 10 |
+
"blas.F90": "module blas\n implicit none\n \n integer, parameter :: izero = 0\n integer, parameter :: blas_integer_kind = kind(izero)\n \n interface gemm\n SUBROUTINE SGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)\n IMPLICIT NONE\n REAL ALPHA,BETA\n INTEGER K,LDA,LDB,LDC,M,N\n CHARACTER TRANSA,TRANSB\n REAL A(LDA,*),B(LDB,*),C(LDC,*)\n END SUBROUTINE SGEMM\n \n SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)\n IMPLICIT NONE\n DOUBLE PRECISION ALPHA,BETA\n INTEGER K,LDA,LDB,LDC,M,N\n CHARACTER TRANSA,TRANSB\n DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*)\n END SUBROUTINE DGEMM\n \n SUBROUTINE CGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)\n IMPLICIT NONE\n COMPLEX ALPHA,BETA\n INTEGER K,LDA,LDB,LDC,M,N\n CHARACTER TRANSA,TRANSB\n COMPLEX A(LDA,*),B(LDB,*),C(LDC,*)\n END SUBROUTINE CGEMM\n \n SUBROUTINE ZGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)\n COMPLEX*16 ALPHA,BETA\n INTEGER K,LDA,LDB,LDC,M,N\n CHARACTER TRANSA,TRANSB\n COMPLEX*16 A(LDA,*),B(LDB,*),C(LDC,*)\n END SUBROUTINE ZGEMM\n end interface gemm\n \nend module blas\n"
|
| 11 |
+
},
|
| 12 |
+
"test": {},
|
| 13 |
+
"doc": {
|
| 14 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{BLAS}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the BLAS library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 15 |
+
}
|
| 16 |
+
}
|
ExternalLibraries_FFTW3.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/FFTW3",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn FFTW3\n\nPROVIDES FFTW3\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS FFTW3_DIR FFTW3_INSTALL_DIR FFTW3_LIBS FFTW3_INC_DIRS FFTW3_LIB_DIRS\n}\n\n# Pass configuration options to build script\nREQUIRES FFTW3\n",
|
| 5 |
+
"interface": "# Interface definition for thorn FFTW3\n\nIMPLEMENTS: FFTW3\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn FFTW3\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn FFTW3\n\nexport FFTW3_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(FFTW3_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.code.defn": "# Main make.code.defn file for thorn FFTW3\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 11 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Build\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n# Set locations\nTHORN=FFTW3\nNAME=fftw-3.3.3\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${FFTW3_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing FFTW3 into ${FFTW3_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${FFTW3_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nFFTW3_DIR=${INSTALL_DIR}\n\n# Set up environment\nexport CPPFLAGS=\"${CPPFLAGS} $(echo $(for dir in ${SYS_INC_DIRS}; do echo '' -I${dir}; done))\"\nexport LDFLAGS=\"${LDFLAGS} $(echo $(for dir in ${LIBDIRS}; do echo '' -L${dir} -Wl,-rpath,${dir}; done))\"\nexport LIBS='-lm'\nunset RPATH\nif echo '' ${ARFLAGS} | grep 64 >/dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\n\necho \"FFTW3: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\necho \"FFTW3: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\n\necho \"FFTW3: Configuring...\"\ncd ${NAME}\n# force libdir so that it does not change from lib to lib64 and we can refer to\n# it in detect.sh\n./configure --prefix=${FFTW3_DIR} --libdir=${FFTW3_DIR}/lib\n\necho \"FFTW3: Building...\"\n${MAKE}\n\necho \"FFTW3: Installing...\"\n${MAKE} install\npopd\n\necho \"FFTW3: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"FFTW3: Done.\"\n",
|
| 12 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n################################################################################\n# Search\n################################################################################\n\nif [ -z \"${FFTW3_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"FFTW3 selected, but FFTW3_DIR not set. Checking some places...\"\n echo \"END MESSAGE\"\n\n DIRS=\"/usr /usr/local /usr/local/packages /usr/local/apps /opt/local ${HOME} c:/packages\"\n for dir in $DIRS; do\n DIRS=\"$DIRS $dir/fftw3\"\n done\n for dir in $DIRS; do\n # libraries might have different file extensions\n for libext in a dll dll.a dylib lib so; do\n # libraries can be in lib or lib64 (or libx32?)\n for libdir in lib64 lib/x86_64-linux-gnu lib lib/i386-linux-gnu lib/arm-linux-gnueabihf; do\n FILES=\"include/fftw3.h $libdir/libfftw3.$libext\"\n # assume this is the one and check all needed files\n FFTW3_DIR=\"$dir\"\n for file in $FILES; do\n # discard this directory if one file was not found\n if [ ! -r \"$dir/$file\" ]; then\n unset FFTW3_DIR\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$FFTW3_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$FFTW3_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$FFTW3_DIR\" ]; then\n break\n fi\n done\n\n if [ -z \"$FFTW3_DIR\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"FFTW3 not found\"\n echo \"END MESSAGE\"\n else\n echo \"BEGIN MESSAGE\"\n echo \"Found FFTW3 in ${FFTW3_DIR}\"\n echo \"END MESSAGE\"\n fi\nfi\n\nTHORN=FFTW3\n\n\n\n################################################################################\n# Build\n################################################################################\n\nif [ -z \"${FFTW3_DIR}\" \\\n -o \"$(echo \"${FFTW3_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]\nthen\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled FFTW3...\"\n echo \"END MESSAGE\"\n \n # Check for required tools. Do this here so that we don't require\n # them when using the system library.\n if [ \"x$TAR\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find tar command.'\n echo 'Please make sure that the (GNU) tar command is present,'\n echo 'and that the TAR variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n if [ \"x$PATCH\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find patch command.'\n echo 'Please make sure that the patch command is present,'\n echo 'and that the PATCH variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n\n # Set locations\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${FFTW3_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing FFTW3 into ${FFTW3_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${FFTW3_INSTALL_DIR}\n fi\n FFTW3_BUILD=1\n FFTW3_DIR=${INSTALL_DIR}\nelse\n FFTW3_BUILD=\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\nfi\n\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"FFTW3_BUILD = ${FFTW3_BUILD}\"\necho \"FFTW3_INSTALL_DIR = ${FFTW3_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\n# Set options\nif [ \"${FFTW3_DIR}\" != 'NO_BUILD' ]; then\n : ${FFTW3_INC_DIRS=\"${FFTW3_DIR}/include\"}\n : ${FFTW3_LIB_DIRS=\"${FFTW3_DIR}/lib\"}\nfi\n: ${FFTW3_LIBS='fftw3'}\n\nFFTW3_INC_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${FFTW3_INC_DIRS})\"\nFFTW3_LIB_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${FFTW3_LIB_DIRS})\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"FFTW3_DIR = ${FFTW3_DIR}\"\necho \"FFTW3_INC_DIRS = ${FFTW3_INC_DIRS}\"\necho \"FFTW3_LIB_DIRS = ${FFTW3_LIB_DIRS}\"\necho \"FFTW3_LIBS = ${FFTW3_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(FFTW3_INC_DIRS)'\necho 'INCLUDE_DIRECTORY_FORTRAN $(FFTW3_INC_DIRS) /usr/include'\necho 'LIBRARY_DIRECTORY $(FFTW3_LIB_DIRS)'\necho 'LIBRARY $(FFTW3_LIBS)'\n"
|
| 13 |
+
},
|
| 14 |
+
"test": {},
|
| 15 |
+
"doc": {
|
| 16 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{FFTW3}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the FFTW3 library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 17 |
+
}
|
| 18 |
+
}
|
ExternalLibraries_GSL.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/GSL",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn GSL\n\nPROVIDES GSL\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS GSL_DIR GSL_INSTALL_DIR GSL_LIBS\n}\n\n# Pass configuration options to build script\nREQUIRES GSL\n",
|
| 5 |
+
"interface": "# Interface definition for thorn GSL\n\nIMPLEMENTS: GSL\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn GSL\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn GSL\n\nexport GSL_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(GSL_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.code.defn": "# Main make.code.defn file for thorn GSL\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 11 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Build\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n# Set locations\nTHORN=GSL\nNAME=gsl-1.16\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${GSL_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing GSL into ${GSL_INSTALL_DIR} \"\n echo \"END MESSAGE\"\n INSTALL_DIR=${GSL_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nGSL_DIR=${INSTALL_DIR}\n\n# Set up environment\nunset LIBS\nif echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\n\necho \"GSL: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\necho \"GSL: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\npushd ${NAME}\n${PATCH?} -p1 < ${SRCDIR}/../dist/stdarg.patch\n# Some (ancient but still used) versions of patch don't support the\n# patch format used here but also don't report an error using the exit\n# code. So we use this patch to test for this\n${PATCH?} -p1 < ${SRCDIR}/../dist/patchtest.patch\nif [ ! -e .patch_tmp ]; then\n echo 'BEGIN ERROR'\n echo 'The version of patch is too old to understand this patch format.'\n echo 'Please set the PATCH environment variable to a more recent '\n echo 'version of the patch command.'\n echo 'END ERROR'\n exit 1\nfi\nrm -f .patch_tmp\npopd\n\necho \"GSL: Configuring...\"\ncd ${NAME}\n./configure --prefix=${GSL_DIR} --enable-shared=no\n\necho \"GSL: Building...\"\n${MAKE}\n\necho \"GSL: Installing...\"\n${MAKE} install\npopd\n\necho \"GSL: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"GSL: Done.\"\n",
|
| 12 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n. $CCTK_HOME/lib/make/bash_utils.sh\n\n# Take care of requests to build the library in any case\nGSL_DIR_INPUT=$GSL_DIR\nif [ \"$(echo \"${GSL_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]; then\n GSL_BUILD=yes\n GSL_DIR=\nelse\n GSL_BUILD=\nfi\n\n# Try to find the library if build isn't explicitly requested\nif [ -z \"${GSL_BUILD}\" ]; then\n find_lib GSL gsl 1 1.0 \"gsl\" \"gsl/gsl_version.h\" \"$GSL_DIR\"\nfi\n\nTHORN=GSL\n\n################################################################################\n# Build\n################################################################################\n\nif [ -n \"$GSL_BUILD\" -o -z \"${GSL_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled GSL...\"\n echo \"END MESSAGE\"\n \n check_tools \"tar patch\"\n\n # Set locations\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${GSL_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing GSL into ${GSL_INSTALL_DIR} \"\n echo \"END MESSAGE\"\n INSTALL_DIR=${GSL_INSTALL_DIR}\n fi\n GSL_BUILD=1\n GSL_DIR=${INSTALL_DIR}\n GSL_INC_DIRS=\"$GSL_DIR/include\"\n GSL_LIB_DIRS=\"$GSL_DIR/lib\"\n GSL_LIBS=\"gsl gslcblas\"\nelse\n GSL_BUILD=\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\nfi\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"GSL_BUILD = ${GSL_BUILD}\"\necho \"GSL_INSTALL_DIR = ${GSL_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\n# Set options\nif [ -x ${GSL_DIR}/bin/gsl-config ]; then\n inc_dirs=\"$(${GSL_DIR}/bin/gsl-config --cflags)\"\n lib_dirs=\"$(${GSL_DIR}/bin/gsl-config --libs)\"\n libs=\"$(${GSL_DIR}/bin/gsl-config --libs)\"\n # Translate option flags into Cactus options:\n # - for INC_DIRS, remove -I prefix from flags\n # - for LIB_DIRS, remove all -l flags, and remove -L prefix from flags\n # - for LIBS, keep only -l flags, and remove -l prefix from flags\n GSL_INC_DIRS=\"$(echo '' $(for flag in $inc_dirs; do echo '' $flag; done | sed -e 's/^ -I//'))\"\n GSL_LIB_DIRS=\"$(echo '' $(for flag in $lib_dirs; do echo '' $flag; done | grep -v '^ -l' | sed -e 's/^ -L//'))\"\n GSL_LIBS=\"$(echo '' $(for flag in $libs; do echo '' $flag; done | grep '^ -l' | sed -e 's/^ -l//'))\"\nfi\n\nset_make_vars \"GSL\" \"$GSL_LIBS\" \"$GSL_LIB_DIRS\" \"$GSL_INC_DIRS\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"GSL_DIR = ${GSL_DIR}\"\necho \"GSL_INC_DIRS = ${GSL_INC_DIRS}\"\necho \"GSL_LIB_DIRS = ${GSL_LIB_DIRS}\"\necho \"GSL_LIBS = ${GSL_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(GSL_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(GSL_LIB_DIRS)'\necho 'LIBRARY $(GSL_LIBS)'\n"
|
| 13 |
+
},
|
| 14 |
+
"test": {},
|
| 15 |
+
"doc": {
|
| 16 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{GSL}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the GSL library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 17 |
+
}
|
| 18 |
+
}
|
ExternalLibraries_HDF5.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/HDF5",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn HDF5\n\nPROVIDES HDF5\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS HDF5 HDF5_DIR HDF5_INSTALL_DIR HDF5_ENABLE_CXX HDF5_ENABLE_FORTRAN ZLIB_DIR LIBSZ_DIR LIBZ_DIR HDF5_INC_DIRS HDF5_LIB_DIRS HDF5_LIBS\n}\n\n# Pass configuration options to build script\nREQUIRES HDF5\n\nREQUIRES zlib\n\n# HDF5 might require MPI\nOPTIONAL MPI\n{\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn HDF5\n\nIMPLEMENTS: HDF5\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn HDF5\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn HDF5\n\nexport ZLIB_DIR ZLIB_INC_DIRS ZLIB_LIB_DIRS ZLIB_LIBS\n\nexport HDF5_ENABLE_CXX HDF5_ENABLE_FORTRAN\nexport LIBSZ_DIR LIBZ_DIR\nexport HDF5_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(HDF5_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.configuration.defn": "# make.configuration.defn file for thorn HDF5\n\n# Define standard HDF5 utilities and install those that we could build/that are\n# present in the system\n#\n# Ignore some of the utilities that we don't use, e.g. the compiler\n# wrappers:\n# h5c++ h5cc h5fc\nSTD_HDF5_UTILS = gif2h5 h52gif h5check h5copy h5debug h5diff h5dump h5import h5jam h5ls h5mkgrp h5perf_serial h5redeploy h5repack h5repart h5stat h5unjam\nHDF5_UTILS := $(shell cd $(HDF5_DIR)/bin 2>/dev/null && ls $(STD_HDF5_UTILS:%=%*) 2>/dev/null)\nALL_UTILS += $(HDF5_UTILS)\n\n# add custom utils not provided by libhdf5, these must not be added to HDF5_UTILS\nALL_UTILS += hdf5_merge hdf5_extract hdf5_double_to_single\n",
|
| 11 |
+
"make.code.defn": "# Main make.code.defn file for thorn HDF5\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 12 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Build\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n# Set locations\nTHORN=HDF5\nNAME=hdf5-1.12.0\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${HDF5_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing HDF5 into ${HDF5_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${HDF5_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nHDF5_DIR=${INSTALL_DIR}\n\n# Set up environment\nif [[ ${F90} == none ]]; then\n echo 'BEGIN MESSAGE'\n echo 'No Fortran 90 compiler available. Building HDF5 library without Fortran support.'\n echo 'END MESSAGE'\n unset FC\n unset FCFLAGS\nelse\n export FC=\"${F90}\"\n export FCFLAGS=\"${F90FLAGS}\"\nfi\nfor dir in $SYS_INC_DIRS; do\n CPPFLAGS=\"$CPPFLAGS -I$dir\"\ndone\nexport CPPFLAGS\nexport LDFLAGS\nunset CPP\nunset LIBS\nunset RPATH\nif echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\n\necho \"HDF5: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\n# Build core library\necho \"HDF5: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\n\necho \"HDF5: Configuring...\"\ncd ${NAME}\n# Do not build C++ API if it has been disabled.\n: ${HDF5_ENABLE_CXX:=yes}\n# Do not build Fortran API if it has been disabled, or if there is no\n# Fortran 90 compiler.\nif [[ -n ${FC} ]]; then\n : ${HDF5_ENABLE_FORTRAN:=yes}\nelse\n HDF5_ENABLE_FORTRAN=no\nfi\n./configure --prefix=${HDF5_DIR} --with-zlib=${ZLIB_DIR} --enable-cxx=${HDF5_ENABLE_CXX} --enable-fortran=${HDF5_ENABLE_FORTRAN} --enable-fortran2003=${HDF5_ENABLE_FORTRAN} --disable-shared --enable-static-exec\n\necho \"HDF5: Building...\"\n${MAKE}\n\necho \"HDF5: Installing...\"\n${MAKE} install\npopd\n\n# Build checker\necho \"HDF5: Unpacking checker archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/h5check_2_0.tar.gz\n\necho \"HDF5: Applying checker patches...\"\npushd h5check_2_0\n${PATCH?} -p1 < ${SRCDIR}/../dist/common.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/error_t.patch\n# Some (ancient but still used) versions of patch don't support the\n# patch format used here but also don't report an error using the exit\n# code. So we use this patch to test for this\n${PATCH?} -p1 < ${SRCDIR}/../dist/patchtest.patch\nif [ ! -e .patch_tmp ]; then\n echo 'BEGIN ERROR'\n echo 'The version of patch is too old to understand this patch format.'\n echo 'Please set the PATCH environment variable to a more recent '\n echo 'version of the patch command.'\n echo 'END ERROR'\n exit 1\nfi\nrm -f .patch_tmp\npopd\n\necho \"HDF5: Configuring checker...\"\ncd h5check_2_0\n# Point the checker to the just-installed library\nexport CPPFLAGS=\"${CPPFLAGS} -I${HDF5_DIR}/include\"\nexport LDFLAGS=\"${LDFLAGS} ${LIBDIR_PREFIX}${HDF5_DIR}/lib ${RUNDIR_PREFIX}${HDF5_DIR}/lib\"\nexport H5CC=\"${CC}\"\nexport H5CC_PP=\"${CPP}\"\nexport H5FC=\"${FC}\"\nexport H5FC_PP=\"${FPP}\"\nexport H5CPP=\"${CXX}\"\n./configure --prefix=${HDF5_DIR} --with-zlib=${ZLIB_DIR}\n\necho \"HDF5: Building checker...\"\n#${MAKE}\n(cd src && ${MAKE})\n(cd tool && ${MAKE})\n\necho \"HDF5: Installing checker...\"\n# The build fails in the \"test\" subdirectory, because\n# /usr/include/hdf5.h (if it exists) is used instead of the the one we\n# just installed. We therefore skip the build in the \"test\"\n# subdirectory.\n#${MAKE} install\n(cd src && ${MAKE} install)\n(cd tool && ${MAKE} install)\npopd\n\necho \"HDF5: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"HDF5: Done.\"\n",
|
| 13 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n. $CCTK_HOME/lib/make/bash_utils.sh\n\n################################################################################\n# Check for old mechanism\n################################################################################\nif [ -n \"${HDF5}\" ]; then\n echo 'BEGIN ERROR'\n echo \"Setting the option \\\"HDF5\\\" is incompatible with the HDF5 thorn. Please remove the option HDF5=${HDF5}.\"\n echo 'END ERROR'\n exit 1\nfi\n\n# Take care of requests to build the library in any case\nHDF5_DIR_INPUT=$HDF5_DIR\nif [ \"$(echo \"${HDF5_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]; then\n HDF5_BUILD=1\n HDF5_DIR=\nelse\n HDF5_BUILD=\nfi\n\n################################################################################\n# Decide which libraries to link with\n################################################################################\n\n# Set up names of the libraries based on configuration variables. Also\n# assign default values to variables.\nHDF5_C_LIBS='hdf5_hl hdf5'\nif [ \"${HDF5_ENABLE_CXX:=no}\" = 'yes' ]; then\n HDF5_CXX_LIBS='hdf5_hl_cpp hdf5_cpp'\n HDF5_REQ='C++'\nfi\nif [ \"${HDF5_ENABLE_FORTRAN:=yes}\" = 'yes' ]; then\n if [ \"${F90}\" != \"none\" ]; then\n HDF5_FORTRAN_LIBS='hdf5hl_fortran hdf5_fortran'\n HDF5_REQ=\"$HDF5_REQ Fortran\"\n fi\nfi\nif [ -n \"$HDF5_REQ\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"Additional requested language support: $HDF5_REQ\"\n echo \"END MESSAGE\"\nfi\nHDF5_REQ_LIBS=\"${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}\"\n\n# Try to find the library if build isn't explicitly requested\nif [ -z \"${HDF5_BUILD}\" -a -z \"${HDF5_INC_DIRS}\" -a -z \"${HDF5_LIB_DIRS}\" -a -z \"${HDF5_LIBS}\" ]; then\n find_lib HDF5 hdf5 1 1.0 \"$HDF5_REQ_LIBS\" \"hdf5.h\" \"$HDF5_DIR\"\n\n # Sadly, pkg-config for HDF5 is good for paths, but bad for the list of\n # available (and necessary) library names, so we have to fix things\n if [ -n \"$PKG_CONFIG_SUCCESS\" ]; then\n HDF5_LIBS=\"hdf5_hl $HDF5_LIBS\"\n if ! find_libs \"$HDF5_LIB_DIRS\" \"hdf5_hl\"; then\n echo 'BEGIN ERROR'\n echo 'Detected problem with HDF5 libary at'\n echo \" $HDF5_DIR ($HDF5_LIB_DIRS)\"\n echo 'Library hdf5_hl not found.'\n echo 'END ERROR'\n exit 1\n fi\n if [ \"${HDF5_ENABLE_CXX:=no}\" = 'yes' ]; then\n HDF5_LIBS=\"hdf5_hl_cpp hdf5_cpp $HDF5_LIBS\"\n if ! find_libs \"$HDF5_LIB_DIRS\" \"hdf5_hl_cpp hdf5_cpp\"; then\n echo 'BEGIN ERROR'\n echo 'HDF5 Installation found at '\n echo \" $HDF5_DIR ($HDF5_LIB_DIRS)\"\n echo ' does not provide requested C++ support. Either specify the '\n echo ' location of a different HDF5 installation, or do not '\n echo ' require the HDF5 C++ interface if you do not need it '\n echo ' (set HDF5_ENABLE_CXX to \"no\").'\n echo 'END ERROR'\n exit 1\n fi\n fi\n if [ \"${HDF5_ENABLE_FORTRAN:=yes}\" = 'yes' ]; then\n HDF5_LIBS=\"hdf5hl_fortran hdf5_fortran $HDF5_LIBS\"\n if ! find_libs \"$HDF5_LIB_DIRS\" \"hdf5hl_fortran hdf5_fortran\"; then\n echo 'BEGIN ERROR'\n echo 'HDF5 Installation found at '\n echo \" $HDF5_DIR ($HDF5_LIB_DIRS)\"\n echo ' does not provide requested Fortran support. Either specify '\n echo ' location of a different HDF5 installation, or do not '\n echo ' require the HDF5 Fortran interface if you do not need it '\n echo ' (set HDF5_ENABLE_FORTRAN to \"no\").'\n echo 'END ERROR'\n exit 1\n fi\n fi\n fi\nfi\n\nTHORN=HDF5\n\n# configure library if build was requested or is needed (no usable\n# library found)\nif [ -n \"$HDF5_BUILD\" -o -z \"${HDF5_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled HDF5...\"\n echo \"END MESSAGE\"\n HDF5_BUILD=1\n\n check_tools \"tar patch\"\n \n # Set locations\n NAME=hdf5-1.10.5\n SRCDIR=\"$(dirname $0)\"\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${HDF5_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing HDF5 into ${HDF5_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${HDF5_INSTALL_DIR}\n fi\n HDF5_DIR=${INSTALL_DIR}\n # Fortran modules may be located in the lib directory\n HDF5_INC_DIRS=\"${HDF5_DIR}/include ${HDF5_DIR}/lib\"\n HDF5_LIB_DIRS=\"${HDF5_DIR}/lib\"\n HDF5_LIBS=\"${HDF5_CXX_LIBS} ${HDF5_FORTRAN_LIBS} ${HDF5_C_LIBS}\"\nelse\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\nfi\n\nif [ -n \"$HDF5_DIR\" ]; then\n : ${HDF5_RAW_LIB_DIRS:=\"$HDF5_LIB_DIRS\"}\n # Fortran modules may be located in the lib directory\n HDF5_INC_DIRS=\"$HDF5_RAW_LIB_DIRS $HDF5_INC_DIRS\"\n # We need the un-scrubbed inc dirs to look for a header file below.\n : ${HDF5_RAW_INC_DIRS:=\"$HDF5_INC_DIRS\"}\nelse\n echo 'BEGIN ERROR'\n echo 'ERROR in HDF5 configuration: Could neither find nor build library.'\n echo 'END ERROR'\n exit 1\nfi\n\n################################################################################\n# Check for additional libraries\n################################################################################\n\n\n# Check whether we are running on Windows\nif perl -we 'exit (`uname` =~ /^CYGWIN/)'; then\n is_windows=0\nelse\n is_windows=1\nfi\n\n# check installed library, assume that everything is fine if we build\nif [ -z \"$HDF5_BUILD\" -a -n \"${HDF5_DIR}\" ]; then\n # find public include file\n H5PUBCONFFILES=\"H5pubconf.h H5pubconf-64.h H5pubconf-32.h\"\n for dir in $HDF5_RAW_INC_DIRS; do\n for file in $H5PUBCONFFILES ; do\n if [ -r \"$dir/$file\" ]; then\n H5PUBCONF=\"$H5PUBCONF $dir/$file\"\n break\n fi\n done\n done\n if [ -z \"$H5PUBCONF\" ]; then\n echo 'BEGIN MESSAGE'\n echo 'WARNING in HDF5 configuration: '\n echo \"None of $H5PUBCONFFILES found in $HDF5_RAW_INC_DIRS\"\n echo \"Automatic detection of szip/zlib compression not possible\"\n echo 'END MESSAGE'\n else\n\n # Check whether we have to link with libsz.a\n if grep -qe '#define H5_HAVE_LIBSZ 1' $H5PUBCONF 2> /dev/null; then\n test_szlib=0\n else\n test_szlib=1\n fi\n if [ $test_szlib -eq 0 ]; then\n HDF5_LIB_DIRS=\"$HDF5_LIB_DIRS $LIBSZ_DIR\"\n HDF5_LIBS=\"$HDF5_LIBS sz\"\n fi\n\n # Check whether we have to link with libz.a\n if grep -qe '#define H5_HAVE_LIBZ 1' $H5PUBCONF 2> /dev/null; then\n test_zlib=0\n else\n test_zlib=1\n fi\n if [ $test_zlib -eq 0 ]; then\n HDF5_LIB_DIRS=\"$HDF5_LIB_DIRS $LIBZ_DIR\"\n HDF5_LIBS=\"$HDF5_LIBS z\"\n fi\n\n # Check whether we have to link with MPI\n if grep -qe '#define H5_HAVE_PARALLEL 1' $H5PUBCONF 2> /dev/null; then\n test_mpi=0\n else\n test_mpi=1\n fi\n if [ $test_mpi -eq 0 ]; then\n HDF5_LIB_DIRS=\"$HDF5_LIB_DIRS $MPI_LIB_DIRS\"\n HDF5_INC_DIRS=\"$HDF5_INC_DIRS $MPI_INC_DIRS\"\n HDF5_LIBS=\"$HDF5_LIBS $MPI_LIBS\"\n fi\n fi\nfi\n\n# Add the math library which might not be linked by default\nif [ $is_windows -eq 0 ]; then\n HDF5_LIBS=\"$HDF5_LIBS m\"\nfi\n\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"HDF5_BUILD = ${HDF5_BUILD}\"\necho \"HDF5_ENABLE_CXX = ${HDF5_ENABLE_CXX}\"\necho \"HDF5_ENABLE_FORTRAN = ${HDF5_ENABLE_FORTRAN}\"\necho \"LIBSZ_DIR = ${LIBSZ_DIR}\"\necho \"LIBZ_DIR = ${LIBZ_DIR}\"\necho \"HDF5_INSTALL_DIR = ${HDF5_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"HDF5_DIR = ${HDF5_DIR}\"\necho \"HDF5_ENABLE_CXX = ${HDF5_ENABLE_CXX}\"\necho \"HDF5_ENABLE_FORTRAN = ${HDF5_ENABLE_FORTRAN}\"\necho \"HDF5_INC_DIRS = ${HDF5_INC_DIRS} ${ZLIB_INC_DIRS}\"\necho \"HDF5_LIB_DIRS = ${HDF5_LIB_DIRS} ${ZLIB_LIB_DIRS}\"\necho \"HDF5_LIBS = ${HDF5_LIBS} ${ZLIB_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(HDF5_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(HDF5_LIB_DIRS)'\necho 'LIBRARY $(HDF5_LIBS)'\n",
|
| 14 |
+
"make.configuration.deps": "# make.configuration.deps file for thorn HDF5\n\n# Standard HDF5 utilities are copied from the install directory\n\n$(patsubst %,$(UTIL_DIR)/%,$(HDF5_UTILS)): $(UTIL_DIR)/%: $(HDF5_DIR)/bin/%\n\t@echo \"Copying $* from $< to $(UTIL_DIR)\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null\n\tcp $< $@\n\n\n\n# Cactus HDF5 utilities are built\n\nHDF5_BUILD_DIR = $(BUILD_DIR)/HDF5\nHDF5_SRC_DIR = $(PACKAGE_DIR)/ExternalLibraries/HDF5/src/util\n\nHDF5_CFLAGS = $(CPPFLAGS) -DCCODE -I$(CONFIG) -I$(BINDINGS_DIR)/include -I$(BINDINGS_DIR)/include/HDF5 -I$(FLESH_DIR)/include $(HDF5_INC_DIRS:%=-I%) $(MPI_INC_DIRS:%=-I%) $(CFLAGS)\nHDF5_LDFLAGS = $(DEBUG_LD) $(LDFLAGS) $(CXXFLAGS) $(EXTRAFLAGS) $(GENERAL_LIBRARIES)\n\n\n\n# Compile\n$(HDF5_BUILD_DIR)/%.o: $(HDF5_SRC_DIR)/%.c\n\t@echo \"Compiling $<\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(HDF5_BUILD_DIR) 2> /dev/null\n\t$(CC) $< $(HDF5_CFLAGS) -DTHORN_IS_HDF5 -c -o $@\n\n# Link\n$(UTIL_DIR)/%: $(HDF5_BUILD_DIR)/%.o\n\t@echo \"Creating $* in $(UTIL_DIR) from $<\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null\n\t$(LD) $< -o $@ $(HDF5_LDFLAGS)\n",
|
| 15 |
+
"util/hdf5_merge.c": "/*@@\n @file hdf5_merge.c\n @date Thu 10 Jan 2002\n @author Thomas Radke\n @desc\n This utility program takes a list of Cactus HDF5 datafiles,\n merges them at the group hierarchy level and dumps the resulting\n tree to a new HDF5 file.\n @enddesc\n @version $Id: hdf5_merge.c,v 1.3 2009/09/29 14:38:14 schnetter Exp $\n@@*/\n\n#include \"cctk.h\"\n\n#define H5_USE_16_API 1\n#include <hdf5.h>\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/* the rcs ID and its dummy function to use it */\nstatic const char *rcsid =\n \"$Header: /cactusdevcvs/CactusExternal/HDF5/src/util/hdf5_merge.c,v 1.3 \"\n \"2009/09/29 14:38:14 schnetter Exp $\";\nCCTK_FILEVERSION(CactusExternal_HDF5_util_hdf5_merge_c)\n\n/*****************************************************************************/\n/* macro definitions */\n/*****************************************************************************/\n/* macro to do an HDF5 call, check its return code, and print a warning\n in case of an error */\n#define CHECK_ERROR(hdf5_call) \\\n do { \\\n hid_t _error_code = hdf5_call; \\\n \\\n if (_error_code < 0) { \\\n fprintf(stderr, \"WARNING: line %d: HDF5 call '%s' returned \" \\\n \"error code %d\\n\", \\\n __LINE__, #hdf5_call, (int)_error_code); \\\n nerrors++; \\\n } \\\n } while (0)\n\n/*****************************************************************************/\n/* global variables */\n/*****************************************************************************/\n/* NOTE: although it isn't good programming practice\n we make these variables global for convenience\n since they are accessed from recursively or\n indirectly called routines which only get passed\n a single user-supplied argument */\nstatic char *pathname = NULL; /* pathname of the current object */\nstatic unsigned int nerrors = 0; /* global error counter */\n\n/*****************************************************************************/\n/* local function prototypes */\n/*****************************************************************************/\nstatic herr_t CopyObject(hid_t copy_from, const char *objectname, void *arg);\nstatic herr_t CopyAttribute(hid_t src, const char *attr_name, void *arg);\n\n/*@@\n @routine main\n @date Sat 24 Feb 2001\n @author Thomas Radke\n @desc\n Main routine of the HDF5 file merger\n @enddesc\n\n @calls CopyObject\n\n @var argc\n @vdesc number of command line arguments\n @vtype int\n @vio in\n @endvar\n @var argv\n @vdesc command line arguments\n @vtype char *[]\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 for success, negative return values indicate an error\n @endreturndesc\n@@*/\nint main(int argc, char *argv[]) {\n int i;\n hid_t infile, outfile;\n\n /* give some help if called with incorrect number of parameters */\n if (argc < 3) {\n fprintf(stderr, \"Usage: %s <infile1> [<infile2> ...] <outfile>\\n\", argv[0]);\n fprintf(stderr, \" eg, %s alp.time*.h5 alp.h5\"\n \"\\n\\n\",\n argv[0]);\n return (0);\n }\n\n H5E_BEGIN_TRY {\n /* open the input files as early test that this works */\n for (i = 0; i < argc - 2; i++) {\n infile = H5Fopen(argv[i + 1], H5F_ACC_RDONLY, H5P_DEFAULT);\n if (infile < 0) {\n fprintf(stderr, \"ERROR: Cannot open HDF5 input file '%s' !\\n\\n\",\n argv[i + 1]);\n return (-1);\n }\n /* close them again, or we might have too many open files and fail */\n H5Fclose(infile);\n }\n\n /* try to open an existing outfile file in append mode,\n if this fails create it as a new file */\n outfile = H5Fopen(argv[argc - 1], H5F_ACC_RDWR, H5P_DEFAULT);\n if (outfile < 0) {\n outfile =\n H5Fcreate(argv[argc - 1], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);\n }\n if (outfile < 0) {\n fprintf(stderr, \"ERROR: Cannot open HDF5 output file '%s' !\\n\\n\",\n argv[argc - 1]);\n return (-1);\n }\n }\n H5E_END_TRY\n\n printf(\"\\n -------------------------\\n\"\n \" Cactus 4 HDF5 File Merger\\n\"\n \" -------------------------\\n\");\n\n /* do the copying by iterating over all objects */\n for (i = 0; i < argc - 2; i++) {\n printf(\"\\n Merging objects from input file '%s' into output file '%s'\\n\",\n argv[i + 1], argv[argc - 1]);\n pathname = \"\";\n H5E_BEGIN_TRY {\n infile = H5Fopen(argv[i + 1], H5F_ACC_RDONLY, H5P_DEFAULT);\n if (infile < 0) {\n fprintf(stderr, \"ERROR: Cannot open HDF5 input file '%s' !\\n\\n\",\n argv[i + 1]);\n return (-1);\n }\n }\n H5E_END_TRY\n CHECK_ERROR(H5Giterate(infile, \"/\", NULL, CopyObject, &outfile));\n CHECK_ERROR(H5Fclose(infile));\n }\n\n CHECK_ERROR(H5Fclose(outfile));\n\n /* report status */\n if (nerrors == 0) {\n printf(\"\\n\\n *** All input files successfully merged. ***\\n\\n\");\n } else {\n fprintf(stderr, \"\\n\\n *** WARNING: %u errors occured during \"\n \"file merging. ***\\n\\n\",\n nerrors);\n }\n\n return (0);\n}\n\n/*****************************************************************************/\n/* local routines */\n/*****************************************************************************/\n/*@@\n @routine CopyObject\n @date Sat 24 Feb 2001\n @author Thomas Radke\n @desc\n Iterator recursively called by H5Giterate() for every object\n in the input file\n It copies the current object to the output file if it didn't\n already exist there.\n @enddesc\n\n @calls CopyAttribute\n\n @var from\n @vdesc identifier for the group the current object belongs to\n @vtype hid_t\n @vio in\n @endvar\n @var objectname\n @vdesc name of the current object\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc user-supplied argument indicating the output object identifier\n @vtype hid_t\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 - continue the iteration for following group objects\n 1 - short-curcuit, no further iteration of this group\n @endreturndesc\n@@*/\nstatic herr_t CopyObject(hid_t from, const char *objectname, void *_to) {\n int i;\n hid_t to, datatype, dataspace;\n H5G_stat_t objectinfo;\n char *current_pathname;\n size_t objectsize;\n void *data;\n\n /* get the output object identifier */\n to = *(hid_t *)_to;\n\n /* check whether an object by that name already exists */\n H5E_BEGIN_TRY { i = H5Gget_objinfo(to, objectname, 0, &objectinfo) >= 0; }\n H5E_END_TRY\n if (i) {\n printf(\" object '%s/%s' will not be copied (already exists)\\n\", pathname,\n objectname);\n return (0);\n }\n\n /* build the full pathname for the current to object to process */\n current_pathname = pathname;\n pathname = (char *)malloc(strlen(current_pathname) + strlen(objectname) + 2);\n sprintf(pathname, \"%s/%s\", current_pathname, objectname);\n\n /* check the type of the current object */\n CHECK_ERROR(H5Gget_objinfo(from, objectname, 0, &objectinfo));\n if (objectinfo.type == H5G_GROUP) {\n printf(\" copying group '%s'\\n\", pathname);\n\n CHECK_ERROR(from = H5Gopen(from, objectname));\n CHECK_ERROR(to = H5Gcreate(to, objectname, 0));\n /* iterate over all objects in the (first) input file */\n CHECK_ERROR(H5Giterate(from, \".\", NULL, CopyObject, &to));\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Gclose(to));\n CHECK_ERROR(H5Gclose(from));\n } else if (objectinfo.type == H5G_DATASET) {\n printf(\" copying dataset '%s'\\n\", pathname);\n\n CHECK_ERROR(from = H5Dopen(from, objectname));\n CHECK_ERROR(datatype = H5Dget_type(from));\n CHECK_ERROR(dataspace = H5Dget_space(from));\n CHECK_ERROR(\n to = H5Dcreate(to, objectname, datatype, dataspace, H5P_DEFAULT));\n objectsize = H5Sget_select_npoints(dataspace) * H5Tget_size(datatype);\n if (objectsize > 0) {\n data = malloc(objectsize);\n if (data == NULL) {\n fprintf(stderr, \"failled to allocate %d bytes of memory, giving up\\n\",\n (int)objectsize);\n exit(-1);\n }\n CHECK_ERROR(H5Dread(from, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n CHECK_ERROR(H5Dwrite(to, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n free(data);\n }\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Dclose(to));\n CHECK_ERROR(H5Dclose(from));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n } else {\n fprintf(stderr, \"WARNING: Found object '%s' which is not neither a \"\n \"group nor a dataset ! Object will not be copied.\\n\",\n pathname);\n nerrors++;\n }\n\n /* reset the pathname */\n free(pathname);\n pathname = current_pathname;\n\n return (0);\n}\n\n/*@@\n @routine CopyAttribute\n @date Sat 24 Feb 2001\n @author Thomas Radke\n @desc\n Iterator recursively called by H5Aiterate() for every attribute\n of an object (dataset or group)\n @enddesc\n\n @var from\n @vdesc identifier for the group or dataset to read the attribute from\n @vtype hid_t\n @vio in\n @endvar\n @var attrname\n @vdesc name of the current attribute\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc user-supplied argument indicating the group or dataset\n to copy the attribute to\n @vtype hid_t\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 - continue the iteration for following attributes\n @endreturndesc\n@@*/\nstatic herr_t CopyAttribute(hid_t from, const char *attrname, void *_to) {\n hid_t attr, datatype, dataspace, to;\n size_t attrsize;\n void *value;\n\n /* get the target group/dataset identifier */\n to = *(hid_t *)_to;\n\n /* open the attribute given by its name, get type, dataspace, and value\n and just copy it */\n CHECK_ERROR(attr = H5Aopen_name(from, attrname));\n CHECK_ERROR(datatype = H5Aget_type(attr));\n CHECK_ERROR(dataspace = H5Aget_space(attr));\n attrsize = H5Tget_size(datatype);\n if (H5Sis_simple(dataspace) > 0) {\n attrsize *= H5Sget_simple_extent_npoints(dataspace);\n }\n if (attrsize > 0) {\n value = malloc(attrsize);\n CHECK_ERROR(H5Aread(attr, datatype, value));\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(attr =\n H5Acreate(to, attrname, datatype, dataspace, H5P_DEFAULT));\n CHECK_ERROR(H5Awrite(attr, datatype, value));\n free(value);\n }\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n\n return (0);\n}\n",
|
| 16 |
+
"util/hdf5_extract.c": "/*@@\n @file hdf5_extract.c\n @date Thu 19 Feb 2002\n @author Thomas Radke\n @desc\n This utility program extracts objects from an HDF5 file and writes\n them into a new one.\n @enddesc\n @version $Id: hdf5_extract.c,v 1.3 2009/09/29 14:38:14 schnetter Exp $\n@@*/\n\n#include \"cctk.h\"\n\n#define H5_USE_16_API 1\n#include <hdf5.h>\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/* the rcs ID and its dummy function to use it */\nstatic const char *rcsid =\n \"$Header: /cactusdevcvs/CactusExternal/HDF5/src/util/hdf5_extract.c,v 1.3 \"\n \"2009/09/29 14:38:14 schnetter Exp $\";\nCCTK_FILEVERSION(CactusExternal_HDF5_util_hdf5_extract_c)\n\n/*****************************************************************************/\n/* macro definitions */\n/*****************************************************************************/\n/* macro to do an HDF5 call, check its return code, and print a warning\n in case of an error */\n#define CHECK_ERROR(hdf5_call) \\\n do { \\\n hid_t _error_code = hdf5_call; \\\n \\\n if (_error_code < 0) { \\\n fprintf(stderr, \"WARNING: line %d: HDF5 call '%s' returned \" \\\n \"error code %d\\n\", \\\n __LINE__, #hdf5_call, (int)_error_code); \\\n nerrors++; \\\n } \\\n } while (0)\n\n/*****************************************************************************/\n/* global variables */\n/*****************************************************************************/\n/* NOTE: although it isn't good programming practice\n we make these variables global for convenience\n since they are accessed from recursively or\n indirectly called routines which only get passed\n a single user-supplied argument */\nstatic char *pathname = NULL; /* pathname of the current object */\nstatic unsigned int nerrors = 0; /* global error counter */\nstatic unsigned int check_parents = 0; /* flag to check for parent groups */\n\n/*****************************************************************************/\n/* local function prototypes */\n/*****************************************************************************/\nstatic herr_t CopyObject(hid_t from, const char *objectname, void *_to);\nstatic herr_t CopyAttribute(hid_t src, const char *attr_name, void *arg);\n\n/*@@\n @routine main\n @date Thu 19 Feb 2002\n @author Thomas Radke\n @desc\n Main routine of the HDF5 file extractor\n @enddesc\n\n @calls CopyObject\n\n @var argc\n @vdesc number of command line arguments\n @vtype int\n @vio in\n @endvar\n @var argv\n @vdesc command line arguments\n @vtype char *[]\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 for success, negative return values indicate an error\n @endreturndesc\n@@*/\nint main(int argc, char *argv[]) {\n char objectname[256];\n FILE *listfile;\n hid_t infile, outfile;\n\n /* give some help if called with incorrect number of parameters */\n if (argc != 4) {\n fprintf(stderr, \"Usage: %s <listfile> <infile> <outfile>\\n\", argv[0]);\n fprintf(stderr, \" where <listfile> can be created from the output of \"\n \"the h5ls command\\n\\n\");\n fprintf(\n stderr,\n \" eg, h5ls alp.h5 > listfile\\n\"\n \" # now edit listfile to select all datasets to be extracted\\n\"\n \" # (don't forget to remove backslashes and the trailing \"\n \"'Dataset {...}')\\n\"\n \" %s extract_list alp.h5 alp_extract.h5\\n\\n\",\n argv[0]);\n\n return (0);\n }\n\n /* open the list file */\n listfile = fopen(argv[1], \"r\");\n if (listfile == NULL) {\n fprintf(stderr, \"ERROR: Cannot open list file '%s' !\\n\\n\", argv[1]);\n return (-1);\n }\n\n H5E_BEGIN_TRY {\n /* open the input file */\n infile = H5Fopen(argv[2], H5F_ACC_RDONLY, H5P_DEFAULT);\n if (infile < 0) {\n fprintf(stderr, \"ERROR: Cannot open HDF5 input file '%s' !\\n\\n\", argv[2]);\n return (-1);\n }\n\n /* try to open an existing outfile file in append mode,\n if this fails create it as a new file */\n outfile = H5Fopen(argv[3], H5F_ACC_RDWR, H5P_DEFAULT);\n if (outfile < 0) {\n outfile = H5Fcreate(argv[3], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);\n }\n if (outfile < 0) {\n fprintf(stderr, \"ERROR: Cannot create HDF5 output file '%s' !\\n\\n\",\n argv[3]);\n return (-1);\n }\n }\n H5E_END_TRY\n\n printf(\"\\n ----------------------------\\n\"\n \" Cactus 4 HDF5 File Extractor\\n\"\n \" ----------------------------\\n\");\n\n /* do the copying by iterating over all objects */\n while (fgets(objectname, sizeof(objectname), listfile)) {\n /* get rid of the trailing newline */\n objectname[strlen(objectname) - 1] = 0;\n pathname = \"\";\n\n check_parents = 1;\n CopyObject(infile, objectname, &outfile);\n }\n\n /* finally, close all open files */\n CHECK_ERROR(H5Fclose(infile));\n CHECK_ERROR(H5Fclose(outfile));\n fclose(listfile);\n\n /* report status */\n if (nerrors == 0) {\n printf(\"\\n\\n *** All objects successfully extracted. ***\\n\\n\");\n } else {\n fprintf(stderr, \"\\n\\n *** WARNING: %u errors occured during \"\n \"data extraction. ***\\n\\n\",\n nerrors);\n }\n\n return (0);\n}\n\n/*****************************************************************************/\n/* local routines */\n/*****************************************************************************/\n/*@@\n @routine CopyObject\n @date Thu 19 Feb 2002\n @author Thomas Radke\n @desc\n Copies an object with given name from the input file into the\n output file.\n @enddesc\n\n @calls CopyAttribute\n\n @var from\n @vdesc input group handle\n @vtype hid_t\n @vio in\n @endvar\n @var objectname\n @vdesc name of the object to extract\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc output group handle\n @vtype void *\n @vio in\n @endvar\n\n @returntype herr_t\n @returndesc\n 0 - continue the iteration for following group objects\n 1 - short-curcuit, no further iteration of this group\n @endreturndesc\n@@*/\nstatic herr_t CopyObject(hid_t from, const char *objectname, void *_to) {\n hid_t to, datatype, dataspace, from_group, to_group;\n H5G_stat_t objectinfo;\n char *current_pathname;\n size_t objectsize;\n herr_t result;\n char *data, *slash;\n\n /* get the output object identifier */\n to = *(hid_t *)_to;\n\n /* check whether the requested object was already extracted */\n H5E_BEGIN_TRY { result = H5Gget_objinfo(to, objectname, 0, &objectinfo); }\n H5E_END_TRY\n if (result >= 0) {\n fprintf(stderr, \"WARNING: object '%s' was already extracted\\n\", objectname);\n return (0);\n }\n\n /* check whether the requested object exists */\n H5E_BEGIN_TRY { result = H5Gget_objinfo(from, objectname, 0, &objectinfo); }\n H5E_END_TRY\n if (result < 0) {\n fprintf(stderr, \"WARNING: object '%s' will not be extracted (object \"\n \"doesn't exist)\\n\",\n objectname);\n nerrors++;\n return (0);\n }\n\n /* make sure that all parent groups exist */\n if (check_parents) {\n slash = pathname;\n /* skip leading slashes */\n while (*slash == '/') {\n slash++;\n }\n\n /* now go through all groups (separated by slashes) */\n while ((slash = strchr(slash, '/')) != NULL) {\n *slash = 0;\n\n /* try to create the group */\n H5E_BEGIN_TRY { to_group = H5Gcreate(to, pathname, 0); }\n H5E_END_TRY\n if (to_group >= 0) {\n /* copy all attributes */\n CHECK_ERROR(from_group = H5Gopen(from, pathname));\n CHECK_ERROR(H5Aiterate(from_group, NULL, CopyAttribute, &to_group));\n CHECK_ERROR(H5Gclose(from_group));\n CHECK_ERROR(H5Gclose(to_group));\n }\n *slash++ = '/';\n }\n check_parents = 0;\n }\n\n /* build the full pathname for the current to object to process */\n current_pathname = pathname;\n pathname = (char *)malloc(strlen(current_pathname) + strlen(objectname) + 2);\n sprintf(pathname, \"%s/%s\", current_pathname, objectname);\n\n /* check the type of the current object */\n if (objectinfo.type == H5G_GROUP) {\n printf(\" copying group '%s'\\n\", pathname);\n\n CHECK_ERROR(from = H5Gopen(from, objectname));\n CHECK_ERROR(to = H5Gcreate(to, objectname, 0));\n /* iterate over all objects in the (first) input file */\n CHECK_ERROR(H5Giterate(from, \".\", NULL, CopyObject, &to));\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Gclose(to));\n CHECK_ERROR(H5Gclose(from));\n } else if (objectinfo.type == H5G_DATASET) {\n CHECK_ERROR(from = H5Dopen(from, objectname));\n CHECK_ERROR(dataspace = H5Dget_space(from));\n CHECK_ERROR(datatype = H5Dget_type(from));\n\n printf(\" copying dataset '%s'\\n\", pathname);\n CHECK_ERROR(\n to = H5Dcreate(to, objectname, datatype, dataspace, H5P_DEFAULT));\n objectsize = H5Tget_size(datatype);\n if (H5Sis_simple(dataspace)) {\n objectsize *= H5Sget_simple_extent_npoints(dataspace);\n }\n if (objectsize > 0) {\n data = (char *)malloc(objectsize);\n CHECK_ERROR(H5Dread(from, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n CHECK_ERROR(H5Dwrite(to, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n free(data);\n }\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Dclose(to));\n CHECK_ERROR(H5Dclose(from));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n } else {\n fprintf(stderr, \"WARNING: Found object '%s' which is neither a group \"\n \"nor a dataset ! Object will not be copied.\\n\",\n pathname);\n nerrors++;\n }\n\n /* reset the pathname */\n free(pathname);\n pathname = current_pathname;\n\n return (0);\n}\n\n/*@@\n @routine CopyAttribute\n @date Thu 19 Feb 2002\n @author Thomas Radke\n @desc\n Iterator recursively called by H5Aiterate() for every attribute\n of an object (dataset or group)\n @enddesc\n\n @var from\n @vdesc identifier for the group or dataset to read the attribute from\n @vtype hid_t\n @vio in\n @endvar\n @var attrname\n @vdesc name of the current attribute\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc user-supplied argument indicating the group or dataset\n to copy the attribute to\n @vtype hid_t\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 - continue the iteration for following attributes\n @endreturndesc\n@@*/\nstatic herr_t CopyAttribute(hid_t from, const char *attrname, void *_to) {\n hid_t attr, datatype, dataspace, to;\n size_t attrsize;\n void *value;\n\n /* get the target group/dataset identifier */\n to = *(hid_t *)_to;\n\n /* open the attribute given by its name, get type, dataspace, and value\n and just copy it */\n CHECK_ERROR(attr = H5Aopen_name(from, attrname));\n CHECK_ERROR(datatype = H5Aget_type(attr));\n CHECK_ERROR(dataspace = H5Aget_space(attr));\n attrsize = H5Tget_size(datatype);\n if (H5Sis_simple(dataspace) > 0) {\n attrsize *= H5Sget_simple_extent_npoints(dataspace);\n }\n if (attrsize > 0) {\n value = malloc(attrsize);\n CHECK_ERROR(H5Aread(attr, datatype, value));\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(attr =\n H5Acreate(to, attrname, datatype, dataspace, H5P_DEFAULT));\n CHECK_ERROR(H5Awrite(attr, datatype, value));\n free(value);\n }\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n\n return (0);\n}\n",
|
| 17 |
+
"util/hdf5_double_to_single.c": "/*@@\n @file hdf5_double_to_single.c\n @date Thu 10 Jan 2002\n @author Thomas Radke\n @desc\n This utility program copies a Cactus HDF5 datafile reverting\n double-precision datasets into single-precision.\n @enddesc\n @version $Id: hdf5_double_to_single.c,v 1.3 2009/09/29 14:38:14 schnetter\nExp $\n@@*/\n\n#include \"cctk.h\"\n\n#define H5_USE_16_API 1\n#include <hdf5.h>\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n/* the rcs ID and its dummy function to use it */\nstatic const char *rcsid = \"$Header: \"\n \"/cactusdevcvs/CactusExternal/HDF5/src/util/\"\n \"hdf5_double_to_single.c,v 1.3 2009/09/29 14:38:14 \"\n \"schnetter Exp $\";\nCCTK_FILEVERSION(CactusExternal_HDF5_util_hdf5_double_to_single_c)\n\n/*****************************************************************************/\n/* macro definitions */\n/*****************************************************************************/\n/* macro to do an HDF5 call, check its return code, and print a warning\n in case of an error */\n#define CHECK_ERROR(hdf5_call) \\\n do { \\\n hid_t _error_code = hdf5_call; \\\n \\\n if (_error_code < 0) { \\\n fprintf(stderr, \"WARNING: line %d: HDF5 call '%s' returned \" \\\n \"error code %d\\n\", \\\n __LINE__, #hdf5_call, (int)_error_code); \\\n nerrors++; \\\n } \\\n } while (0)\n\n/*****************************************************************************/\n/* global variables */\n/*****************************************************************************/\n/* NOTE: although it isn't good programming practice\n we make these variables global for convenience\n since they are accessed from recursively or\n indirectly called routines which only get passed\n a single user-supplied argument */\nstatic char *pathname = NULL; /* pathname of the current object */\nstatic unsigned int nerrors = 0; /* global error counter */\n\n/*****************************************************************************/\n/* local function prototypes */\n/*****************************************************************************/\nstatic herr_t CopyObject(hid_t copy_from, const char *objectname, void *arg);\nstatic herr_t CopyAttribute(hid_t src, const char *attr_name, void *arg);\n\n/*@@\n @routine main\n @date Thu 10 Jan 2002\n @author Thomas Radke\n @desc\n Main routine of the HDF5 double-to-single converter\n @enddesc\n\n @calls CopyObject\n\n @var argc\n @vdesc number of command line arguments\n @vtype int\n @vio in\n @endvar\n @var argv\n @vdesc command line arguments\n @vtype char *[]\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 for success, negative return values indicate an error\n @endreturndesc\n@@*/\nint main(int argc, char *argv[]) {\n hid_t infile, outfile;\n\n /* give some help if called with incorrect number of parameters */\n if (argc != 3) {\n fprintf(stderr, \"Usage: %s <infile> <outfile>\\n\", argv[0]);\n fprintf(stderr, \" eg, %s alp.h5 alp_single.h5\\n\\n\", argv[0]);\n return (0);\n }\n\n H5E_BEGIN_TRY {\n /* open the input file */\n infile = H5Fopen(argv[1], H5F_ACC_RDONLY, H5P_DEFAULT);\n if (infile < 0) {\n fprintf(stderr, \"ERROR: Cannot open HDF5 input file '%s' !\\n\\n\", argv[1]);\n return (-1);\n }\n\n /* create output file */\n outfile = H5Fcreate(argv[2], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);\n if (outfile < 0) {\n fprintf(stderr, \"ERROR: Cannot create HDF5 output file '%s' !\\n\\n\",\n argv[2]);\n return (-1);\n }\n }\n H5E_END_TRY\n\n printf(\"\\n --------------------------------------------------\\n\"\n \" Cactus 4 HDF5 double-to-single precision Converter\\n\"\n \" --------------------------------------------------\\n\");\n\n /* do the copying by iterating over all objects */\n pathname = \"\";\n CHECK_ERROR(H5Giterate(infile, \"/\", NULL, CopyObject, &outfile));\n\n /* finally, close all open files */\n CHECK_ERROR(H5Fclose(infile));\n CHECK_ERROR(H5Fclose(outfile));\n\n /* report status */\n if (nerrors == 0) {\n printf(\"\\n\\n *** All Cactus data successfully converted. ***\\n\\n\");\n } else {\n fprintf(stderr, \"\\n\\n *** WARNING: %u errors occured during \"\n \"conversion. ***\\n\\n\",\n nerrors);\n }\n\n return (0);\n}\n\n/*****************************************************************************/\n/* local routines */\n/*****************************************************************************/\n/*@@\n @routine CopyObject\n @date Thu 10 Jan 2002\n @author Thomas Radke\n @desc\n Iterator recursively called by H5Giterate() for every object\n in the input file\n @enddesc\n\n @calls CopyAttribute\n\n @var from\n @vdesc identifier for the group the current object belongs to\n @vtype hid_t\n @vio in\n @endvar\n @var objectname\n @vdesc name of the current object\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc user-supplied argument indicating the output object identifier\n @vtype hid_t\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 - continue the iteration for following group objects\n 1 - short-curcuit, no further iteration of this group\n @endreturndesc\n@@*/\nstatic herr_t CopyObject(hid_t from, const char *objectname, void *_to) {\n hid_t to, datatype, dataspace;\n H5G_stat_t objectinfo;\n char *current_pathname;\n size_t objectsize;\n char *data;\n\n /* build the full pathname for the current to object to process */\n current_pathname = pathname;\n pathname = (char *)malloc(strlen(current_pathname) + strlen(objectname) + 2);\n sprintf(pathname, \"%s/%s\", current_pathname, objectname);\n\n /* get the output object identifier */\n to = *(hid_t *)_to;\n\n /* check the type of the current object */\n CHECK_ERROR(H5Gget_objinfo(from, objectname, 0, &objectinfo));\n if (objectinfo.type == H5G_GROUP) {\n printf(\" copying group '%s'\\n\", pathname);\n\n CHECK_ERROR(from = H5Gopen(from, objectname));\n CHECK_ERROR(to = H5Gcreate(to, objectname, 0));\n /* iterate over all objects in the (first) input file */\n CHECK_ERROR(H5Giterate(from, \".\", NULL, CopyObject, &to));\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Gclose(to));\n CHECK_ERROR(H5Gclose(from));\n } else if (objectinfo.type == H5G_DATASET) {\n CHECK_ERROR(from = H5Dopen(from, objectname));\n CHECK_ERROR(dataspace = H5Dget_space(from));\n CHECK_ERROR(datatype = H5Dget_type(from));\n if (H5Tget_class(datatype) == H5T_FLOAT) {\n CHECK_ERROR(H5Tclose(datatype));\n CHECK_ERROR(datatype = H5Tcopy(H5T_NATIVE_FLOAT));\n printf(\" converting dataset '%s'\\n\", pathname);\n } else {\n printf(\" copying dataset '%s'\\n\", pathname);\n }\n CHECK_ERROR(\n to = H5Dcreate(to, objectname, datatype, dataspace, H5P_DEFAULT));\n objectsize = H5Tget_size(datatype);\n if (H5Sis_simple(dataspace)) {\n objectsize *= H5Sget_simple_extent_npoints(dataspace);\n }\n if (objectsize > 0) {\n data = (char *)malloc(objectsize);\n CHECK_ERROR(H5Dread(from, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n CHECK_ERROR(H5Dwrite(to, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data));\n free(data);\n }\n CHECK_ERROR(H5Aiterate(from, NULL, CopyAttribute, &to));\n CHECK_ERROR(H5Dclose(to));\n CHECK_ERROR(H5Dclose(from));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n } else {\n fprintf(stderr, \"WARNING: Found object '%s' which is neither a group \"\n \"nor a dataset ! Object will not be copied.\\n\",\n pathname);\n nerrors++;\n }\n\n /* reset the pathname */\n free(pathname);\n pathname = current_pathname;\n\n return (0);\n}\n\n/*@@\n @routine CopyAttribute\n @date Thu 10 Jan 2002\n @author Thomas Radke\n @desc\n Iterator recursively called by H5Aiterate() for every attribute\n of an object (dataset or group)\n @enddesc\n\n @var from\n @vdesc identifier for the group or dataset to read the attribute from\n @vtype hid_t\n @vio in\n @endvar\n @var attrname\n @vdesc name of the current attribute\n @vtype const char *\n @vio in\n @endvar\n @var _to\n @vdesc user-supplied argument indicating the group or dataset\n to copy the attribute to\n @vtype hid_t\n @vio in\n @endvar\n\n @returntype int\n @returndesc\n 0 - continue the iteration for following attributes\n @endreturndesc\n@@*/\nstatic herr_t CopyAttribute(hid_t from, const char *attrname, void *_to) {\n hid_t attr, datatype, dataspace, to;\n size_t attrsize;\n void *value;\n\n /* get the target group/dataset identifier */\n to = *(hid_t *)_to;\n\n /* open the attribute given by its name, get type, dataspace, and value\n and just copy it */\n CHECK_ERROR(attr = H5Aopen_name(from, attrname));\n CHECK_ERROR(datatype = H5Aget_type(attr));\n CHECK_ERROR(dataspace = H5Aget_space(attr));\n attrsize = H5Tget_size(datatype);\n if (H5Sis_simple(dataspace) > 0) {\n attrsize *= H5Sget_simple_extent_npoints(dataspace);\n }\n if (attrsize > 0) {\n value = malloc(attrsize);\n CHECK_ERROR(H5Aread(attr, datatype, value));\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(attr =\n H5Acreate(to, attrname, datatype, dataspace, H5P_DEFAULT));\n CHECK_ERROR(H5Awrite(attr, datatype, value));\n free(value);\n }\n CHECK_ERROR(H5Aclose(attr));\n CHECK_ERROR(H5Sclose(dataspace));\n CHECK_ERROR(H5Tclose(datatype));\n\n return (0);\n}\n"
|
| 18 |
+
},
|
| 19 |
+
"test": {},
|
| 20 |
+
"doc": {
|
| 21 |
+
"documentation.tex": "\\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\\title{\\tt ExternalLibraries/HDF5}\n\\author{Yaakoub Y El-Khamra, Thomas Radke,Federico Cipolletta}\n\\date{2020-07-01}\n\n\\maketitle\n\n% Do not delete next line\n% START CACTUS THORNGUIDE\n\n\\ifx\\ThisThorn\\undefined\n\\newcommand{\\ThisThorn}{{\\it HDF5}}\n\\else\n\\renewcommand{\\ThisThorn}{{\\it HDF5}}\n\\fi\n\n\\begin{abstract}\nThorn \\ThisThorn\\ provides the following utility programs:\n%\n\\begin{itemize}\n \\item {\\tt hdf5\\_double\\_to\\_single}\\\\\n Copies the entire contents of an input HDF5 file to an output HDF5 file,\n converting all double precision datasets to single precision.\n \\item {\\tt hdf5\\_merge}\\\\\n Merges a list of HDF5 input files into a single HDF5 output file.\n This can be used to concatenate HDF5 output data created as one file per\n timestep.\n \\item {\\tt hdf5\\_extract}\\\\\n Extracts a given list of named objects (groups or datasets) from an HDF5\n input file and writes them into a new HDF5 output file.\n This is the reverse operation to what {\\tt hdf5\\_merge.c} does. Useful eg.\n for extracting individual timesteps from a time series HDF5 datafile.\n\\end{itemize}\n%\nAll utility programs are located in the {\\tt src/util/} subdirectory of thorn\n\\ThisThorn. To build the utilities just do a\n\n\\begin{verbatim}\n make <configuration>-utils\n\\end{verbatim}\n\nin the Cactus toplevel directory. The executables will then be placed in the\n{\\tt exe/<configuration>/} subdirectory.\n\nAll utility programs are self-explaining -- just call them without arguments\nto get a short usage info.\nIf any of these utility programs is called without arguments it will print\na usage message.\n\\end{abstract}\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 22 |
+
}
|
| 23 |
+
}
|
ExternalLibraries_LAPACK.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/LAPACK",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn LAPACK\n\nPROVIDES LAPACK\n{\n SCRIPT configure.sh\n LANG bash\n OPTIONS LAPACK_DIR LAPACK_INC_DIRS LAPACK_LIB_DIRS LAPACK_LIBS LAPACK_INSTALL_DIR\n}\n\nREQUIRES BLAS\n",
|
| 5 |
+
"interface": "# Interface definition for thorn LAPACK\n\nIMPLEMENTS: LAPACK\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn LAPACK\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn LAPACK\n\n# Source files in this directory\nSRCS = lapack.F90\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 10 |
+
"lapack.F90": "module lapack\n implicit none\n \n integer, parameter :: izero = 0\n integer, parameter :: lapack_integer_kind = kind(izero)\n \n interface geev\n SUBROUTINE SGEEV( JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR, &\n LDVR, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER JOBVL, JOBVR\n INTEGER INFO, LDA, LDVL, LDVR, LWORK, N\n REAL A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ), &\n WI( * ), WORK( * ), WR( * )\n END SUBROUTINE SGEEV\n \n SUBROUTINE DGEEV( JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR, &\n LDVR, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER JOBVL, JOBVR\n INTEGER INFO, LDA, LDVL, LDVR, LWORK, N\n DOUBLE PRECISION A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ), &\n WI( * ), WORK( * ), WR( * )\n END SUBROUTINE DGEEV\n \n SUBROUTINE CGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR, &\n WORK, LWORK, RWORK, INFO )\n IMPLICIT NONE\n CHARACTER JOBVL, JOBVR\n INTEGER INFO, LDA, LDVL, LDVR, LWORK, N\n REAL RWORK( * )\n COMPLEX A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ), &\n W( * ), WORK( * )\n END SUBROUTINE CGEEV\n \n SUBROUTINE ZGEEV( JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR, &\n WORK, LWORK, RWORK, INFO )\n IMPLICIT NONE\n CHARACTER JOBVL, JOBVR\n INTEGER INFO, LDA, LDVL, LDVR, LWORK, N\n DOUBLE PRECISION RWORK( * )\n COMPLEX*16 A( LDA, * ), VL( LDVL, * ), VR( LDVR, * ), &\n W( * ), WORK( * )\n END SUBROUTINE ZGEEV\n end interface geev\n \n interface gesv\n SUBROUTINE SGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, LDB, N, NRHS\n INTEGER IPIV( * )\n REAL A( LDA, * ), B( LDB, * )\n END SUBROUTINE SGESV\n \n SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, LDB, N, NRHS\n INTEGER IPIV( * )\n DOUBLE PRECISION A( LDA, * ), B( LDB, * )\n END SUBROUTINE DGESV\n \n SUBROUTINE CGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, LDB, N, NRHS\n INTEGER IPIV( * )\n COMPLEX A( LDA, * ), B( LDB, * )\n END SUBROUTINE CGESV\n \n SUBROUTINE ZGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, LDB, N, NRHS\n INTEGER IPIV( * )\n COMPLEX*16 A( LDA, * ), B( LDB, * )\n END SUBROUTINE ZGESV\n end interface gesv\n \n interface getrf\n SUBROUTINE SGETRF( M, N, A, LDA, IPIV, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, M, N\n INTEGER IPIV( * )\n REAL A( LDA, * )\n END SUBROUTINE SGETRF\n \n SUBROUTINE DGETRF( M, N, A, LDA, IPIV, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, M, N\n INTEGER IPIV( * )\n DOUBLE PRECISION A( LDA, * )\n END SUBROUTINE DGETRF\n \n SUBROUTINE CGETRF( M, N, A, LDA, IPIV, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, M, N\n INTEGER IPIV( * )\n COMPLEX A( LDA, * )\n END SUBROUTINE CGETRF\n \n SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )\n IMPLICIT NONE\n INTEGER INFO, LDA, M, N\n INTEGER IPIV( * )\n COMPLEX*16 A( LDA, * )\n END SUBROUTINE ZGETRF\n end interface getrf\n \n interface posv\n SUBROUTINE SPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, N, NRHS\n REAL A( LDA, * ), B( LDB, * )\n END SUBROUTINE SPOSV\n \n SUBROUTINE DPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, N, NRHS\n DOUBLE PRECISION A( LDA, * ), B( LDB, * )\n END SUBROUTINE DPOSV\n \n SUBROUTINE CPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, N, NRHS\n COMPLEX A( LDA, * ), B( LDB, * )\n END SUBROUTINE CPOSV\n \n SUBROUTINE ZPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, N, NRHS\n COMPLEX*16 A( LDA, * ), B( LDB, * )\n END SUBROUTINE ZPOSV\n end interface posv\n \n interface sysv\n SUBROUTINE SSYSV( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, &\n LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, LWORK, N, NRHS\n INTEGER IPIV( * )\n REAL A( LDA, * ), B( LDB, * ), WORK( * )\n END SUBROUTINE SSYSV\n \n SUBROUTINE DSYSV( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, &\n LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, LWORK, N, NRHS\n INTEGER IPIV( * )\n DOUBLE PRECISION A( LDA, * ), B( LDB, * ), WORK( * )\n END SUBROUTINE DSYSV\n \n SUBROUTINE CSYSV( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, &\n LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, LWORK, N, NRHS\n INTEGER IPIV( * )\n COMPLEX A( LDA, * ), B( LDB, * ), WORK( * )\n END SUBROUTINE CSYSV\n \n SUBROUTINE ZSYSV( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, &\n LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LDB, LWORK, N, NRHS\n INTEGER IPIV( * )\n COMPLEX*16 A( LDA, * ), B( LDB, * ), WORK( * )\n END SUBROUTINE ZSYSV\n end interface sysv\n \n interface sytrf\n SUBROUTINE SSYTRF( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LWORK, N\n INTEGER IPIV( * )\n REAL A( LDA, * ), WORK( * )\n END SUBROUTINE SSYTRF\n \n SUBROUTINE DSYTRF( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LWORK, N\n INTEGER IPIV( * )\n DOUBLE PRECISION A( LDA, * ), WORK( * )\n END SUBROUTINE DSYTRF\n \n SUBROUTINE CSYTRF( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LWORK, N\n INTEGER IPIV( * )\n COMPLEX A( LDA, * ), WORK( * )\n END SUBROUTINE CSYTRF\n \n SUBROUTINE ZSYTRF( UPLO, N, A, LDA, IPIV, WORK, LWORK, INFO )\n IMPLICIT NONE\n CHARACTER UPLO\n INTEGER INFO, LDA, LWORK, N\n INTEGER IPIV( * )\n COMPLEX*16 A( LDA, * ), WORK( * )\n END SUBROUTINE ZSYTRF\n end interface sytrf\n end module lapack\n"
|
| 11 |
+
},
|
| 12 |
+
"test": {},
|
| 13 |
+
"doc": {
|
| 14 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{LAPACK}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the LAPACK library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 15 |
+
}
|
| 16 |
+
}
|
ExternalLibraries_LORENE.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/LORENE",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn LORENE\n\nPROVIDES LORENE\n{\n SCRIPT src/detect.sh\n VERSION 2014-04-18-ET1\n LANG bash\n OPTIONS LORENE_DIR LORENE_EXTRA_LIB_DIRS LORENE_EXTRA_LIBS LORENE_INSTALL_DIR\n}\n\nREQUIRES BLAS LAPACK GSL\nREQUIRES LORENE\n",
|
| 5 |
+
"interface": "# Interface definition for thorn LORENE\n\nIMPLEMENTS: LORENE\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn LORENE\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn LORENE\n\nexport BLAS_DIR BLAS_INC_DIRS BLAS_LIB_DIRS BLAS_LIBS\nexport GSL_DIR GSL_INC_DIRS GSL_LIB_DIRS GSL_LIBS\nexport LAPACK_DIR LAPACK_INC_DIRS LAPACK_LIB_DIRS LAPACK_LIBS\n\nexport LORENE_EXTRA_LIB_DIRS LORENE_EXTRA_LIBS\nexport LORENE_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(LORENE_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh $(wildcard $(SRCDIR)/../dist/*.tar.gz $(SRCDIR)/../dist/*.patch)\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.code.defn": "# Main make.code.defn file for thorn LORENE\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 11 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\nfunction printtime() {\n if [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n perl -e 'eval { require(\"Time/HiRes.pm\"); print(&Time::HiRes::gettimeofday()+0,\" \"); }; if($@) { print time(); }'\n fi\n}\n\n# Set locations\nTHORN=LORENE\nNAME=Lorene\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${LORENE_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing LORENE into ${LORENE_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${LORENE_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nLORENE_DIR=${INSTALL_DIR}\n \n# Set up environment\nunset LIBS\nif echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\n\necho \"LORENE: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\necho \"LORENE: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\n${PATCH?} -p0 < ${SRCDIR}/../dist/des.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/makesystem.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/pgplot.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/openmp.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/check_fopen_error.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/eos_multi_poly.patch\n${PATCH?} -p0 < ${SRCDIR}/../dist/eos_table_filepath.patch\n# Some (ancient but still used) versions of patch don't support the\n# patch format used here but also don't report an error using the exit\n# code. So we use this patch to test for this\n${PATCH?} -p0 < ${SRCDIR}/../dist/patchtest.patch\nif [ ! -e Lorene/.patch_tmp ]; then\n echo 'BEGIN ERROR'\n echo 'The version of patch is too old to understand this patch format.'\n echo 'Please set the PATCH environment variable to a more recent '\n echo 'version of the patch command.'\n echo 'END ERROR'\n exit 1\nfi\nrm -f Lorene/.patch_tmp\n# Prevent overly long lines\nfor file in $(find ${NAME} -name '*.f'); do\n # Remove CVS Header comments\n perl -pi -e 's{\\$Header.*\\$}{\\$Header\\$}g' $file\n # Replace tabs with eight blanks\n perl -pi -e 's{\\t}{ }' $file\n # Remove in-line comments (in lines without quotes)\n perl -pi -e 's{^([^'\\''\"]*?)!.*$}{$1}' $file\n # Break long lines\n perl -pi -e 's{^([ 0-9].{71})(.+)}{$1\\n \\$$2}' $file\ndone\n\necho \"LORENE: Configuring...\"\ncd ${NAME}\n\nif echo ${F77} | grep -i xlf > /dev/null 2>&1; then\n FIXEDF77FLAGS=-qfixed\nfi\nexport HOME_LORENE=${BUILD_DIR}/${NAME}\ncat > local_settings <<EOF\nCXX = ${CXX}\nCXXFLAGS = ${CXXFLAGS} ${CPPFLAGS} \\$(addprefix -I,${SYS_INC_DIRS}) ${LDFLAGS}\nCXXFLAGS_G = ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}\nF77 = ${F77}\nF77FLAGS = ${F77FLAGS} ${FIXEDF77FLAGS} ${LDFLAGS}\nF77FLAGS_G = ${F77FLAGS} ${FIXEDF77FLAGS} ${LDFLAGS}\nINC = -I\\$(HOME_LORENE)/C++/Include -I\\$(HOME_LORENE)/C++/Include_extra \\$(addprefix -I,${GSL_INC_DIRS})\nRANLIB = ${RANLIB}\n# We don't need dependencies since we always build from scratch\n#MAKEDEPEND = ${CXX_DEPEND} \\$(INC) \\$< ${CXX_DEPEND_OUT} && mv \\$@ \\$(df).d\nMAKEDEPEND = : > \\$(df).d\nDEPDIR = .deps\nFFT_DIR = FFT991\nLIB_CXX = ${LIBS}\nLIB_LAPACK = ${LAPACK_LIBS} ${BLAS_LIBS}\nLIB_PGPLOT =\nLIB_GSL = ${GSL_LIBS}\nDONTBUILDDEBUGLIB = yes\nEOF\nif [ -n \"$XARGS\" ]; then echo \"XARGS = $XARGS\" >> local_settings; fi\nif [ -n \"$FIND\" ]; then echo \"FIND = $FIND\" >> local_settings; fi\n\nprinttime\necho \"LORENE: Building...\"\n# Note that this builds two versions of the library, a \"regular\"\n# version and a \"debug\" version. Both are identical (since we\n# specified identical build options above), and we ignore the \"debug\"\n# version.\n${MAKE} cpp fortran export\n\nprinttime\necho \"LORENE: Installing...\"\nmv ${BUILD_DIR}/${NAME}/Lib ${INSTALL_DIR}\nmkdir ${INSTALL_DIR}/C++\nmv ${BUILD_DIR}/${NAME}/C++/Include ${INSTALL_DIR}/C++\nmkdir ${INSTALL_DIR}/Export\nmkdir ${INSTALL_DIR}/Export/C++\nmv ${BUILD_DIR}/${NAME}/Export/C++/Include ${INSTALL_DIR}/Export/C++\npopd\n\necho \"LORENE: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"LORENE: Done.\"\n",
|
| 12 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n################################################################################\n# Search\n################################################################################\n\nif [ -z \"${LORENE_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"LORENE selected, but LORENE_DIR not set.\"\n echo \"END MESSAGE\"\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Using LORENE in ${LORENE_DIR}\"\n echo \"END MESSAGE\"\nfi\n\nTHORN=LORENE\n\n\n\n################################################################################\n# Build\n################################################################################\n\nif [ -z \"${LORENE_DIR}\" \\\n -o \"$(echo \"${LORENE_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]\nthen\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled LORENE...\"\n echo \"END MESSAGE\"\n \n # Check for required tools. Do this here so that we don't require\n # them when using the system library.\n if [ \"x$TAR\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find tar command.'\n echo 'Please make sure that the (GNU) tar command is present,'\n echo 'and that the TAR variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n if [ \"x$PATCH\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find patch command.'\n echo 'Please make sure that the patch command is present,'\n echo 'and that the PATCH variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n\n # Set locations\n NAME=Lorene\n SRCDIR=\"$(dirname $0)\"\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${LORENE_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing LORENE into ${LORENE_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${LORENE_INSTALL_DIR}\n fi\n LORENE_BUILD=1\n LORENE_DIR=${INSTALL_DIR}\nelse\n LORENE_BUILD=\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\nfi\n\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"LORENE_BUILD = ${LORENE_BUILD}\"\necho \"LORENE_EXTRA_LIB_DIRS = ${LORENE_EXTRA_LIB_DIRS}\"\necho \"LORENE_EXTRA_LIBS = ${LORENE_EXTRA_LIBS}\"\necho \"LORENE_INSTALL_DIR = ${LORENE_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\n# Set options\nLORENE_INC_DIRS=\"${LORENE_DIR}/Export/C++/Include ${LORENE_DIR}/C++/Include\"\nLORENE_LIB_DIRS=\"${LORENE_DIR}/Lib ${LORENE_EXTRA_LIB_DIRS}\"\nLORENE_LIBS=\"lorene_export lorene lorenef77 ${LORENE_EXTRA_LIBS}\"\n\nLORENE_INC_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${LORENE_INC_DIRS})\"\nLORENE_LIB_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${LORENE_LIB_DIRS})\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"LORENE_DIR = ${LORENE_DIR}\"\necho \"LORENE_INC_DIRS = ${LORENE_INC_DIRS}\"\necho \"LORENE_LIB_DIRS = ${LORENE_LIB_DIRS}\"\necho \"LORENE_LIBS = ${LORENE_LIBS}\"\n# echo \"HOME_LORENE = ${LORENE_DIR}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(LORENE_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(LORENE_LIB_DIRS)'\necho 'LIBRARY $(LORENE_LIBS)'\n"
|
| 13 |
+
},
|
| 14 |
+
"test": {},
|
| 15 |
+
"doc": {
|
| 16 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{LORENE}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the LORENE library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 17 |
+
}
|
| 18 |
+
}
|
ExternalLibraries_MPI.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/MPI",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn MPI\n\nPROVIDES MPI\n{\n SCRIPT src/detect.pl\n LANG perl\n OPTIONS MPI MPI_DIR MPI_INC_DIRS MPI_LIB_DIRS MPI_LIBS MPI_INSTALL_DIR HWLOC_DIR\n}\n\n# Pass configuration options to build script\nREQUIRES MPI\n\nOPTIONAL hwloc\n{\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn MPI\n\nIMPLEMENTS: MPI\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn MPI\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn MPI\n\nexport MPI_INSTALL_DIR HWLOC_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(MPI_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.pl\n\t+$(PERL) $(SRCDIR)/build.pl\nendif\n",
|
| 10 |
+
"make.configuration.defn": "# make.configuration.defn file for thorn MPI\n\n# Define the relevant OpenMPI utilities\nSTD_MPI_UTILS = mpirun ompi-clean ompi-iof ompi-probe ompi-profiler ompi-ps ompi-server ompi-top ompi_info\nMPI_UTILS = $(shell cd $(MPI_DIR)/bin 2>/dev/null && ls $(STD_MPI_UTILS:%=%*) 2>/dev/null)\nALL_UTILS += $(MPI_UTILS)\n",
|
| 11 |
+
"make.code.defn": "# Main make.code.defn file for thorn MPI\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 12 |
+
"detect.pl": "#!/usr/bin/perl\nuse Carp;\nuse strict;\nuse FileHandle;\nuse Cwd;\n$/ = undef;\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nmy $verbose = 0;\n$verbose = 1 if $ENV{VERBOSE} =~ /^yes$/i;\n\nif ($verbose) {\n # we implement VERBOSE by restarting in the debugger and having it print each line\n # this subroutine is defined all the time, just only used when in debug mode\n sub DB::DB {\n no strict;\n my ($p, $f, $l) = caller;\n my $code = \\@{\"::_<$f\"};\n print STDERR \">> $f:$l: $code->[$l]\";\n }\n if (not $^P) {\n exit system($^X, \"-d\", $0, @ARGV);\n }\n}\n\n################################################################################\n# Check for old mechanism\n################################################################################\n\nif (defined($ENV{MPI})) {\n error(\"Setting the option \\\"MPI\\\" is incompatible with the MPI thorn. Please remove the option MPI = $ENV{MPI}.\", 2);\n}\n\n################################################################################\n# Determine whether to build and/or search\n################################################################################\n\nmy $info = undef;\nmy $mpi_info_set = 0;\nmy $mpi_dir = undef;\nmy $mpi_cmd = undef;\nmy $mpi_search = 1;\nmy $mpi_build = 0;\nmy $mpi_manual = 0;\n\n# Note:\n# - look for \"mpiCC\" last, since this is equivalent to mpicc on\n# case-insensitive file systems\n# - don't look for \"mpicc\", since linking with a C compiler won't work\nmy @mpicxx_names = (\"mpic++\", \"mpicxx\", \"mpicxx-openmpi-mp\", \"mpiCC\");\n\nif (!is_set(\"MPI_DIR\")) {\n message(\"MPI selected, but MPI_DIR is not set. Computing settings...\");\n $mpi_build = 1;\n $mpi_search = 1;\n} elsif ($ENV{MPI_DIR} eq \"NO_BUILD\") {\n $mpi_dir = $ENV{MPI_DIR};\n $mpi_build = 0;\n $mpi_search = 1;\n} elsif ($ENV{MPI_DIR} eq \"BUILD\") {\n $mpi_build = 1;\n $mpi_search = 0;\n} elsif ($ENV{MPI_DIR} eq \"NONE\") {\n $mpi_build = 0;\n $mpi_search = 0;\n $mpi_info_set = 1;\n $mpi_dir = '';\n $info = '';\n} else {\n if (!-d $ENV{MPI_DIR}) {\n message(\"MPI_DIR is set to a directory that does not exist (MPI_DIR = $ENV{MPI_DIR}); continuing anyway\");\n }\n $mpi_dir = $ENV{MPI_DIR};\n $mpi_build = 0;\n $mpi_search = 0;\n if (is_set(\"MPI_INC_DIRS\") or is_set(\"MPI_LIB_DIRS\") or is_set(\"MPI_LIBS\"))\n {\n # If some of the MPI variables are set, this is a completely\n # manual configuration.\n $mpi_manual = 1;\n } else {\n # If none of the MPI variables are set, check for the compiler\n # wrapper under MPI_DIR\n $mpi_manual = 0;\n for my $name (@mpicxx_names) {\n my $full_name = \"$ENV{MPI_DIR}/bin/$name\";\n if (-x $full_name) {\n $mpi_cmd = $full_name;\n last;\n }\n }\n if (defined($mpi_cmd)) {\n message(\"Found MPI compiler wrapper at $mpi_cmd!\");\n mpi_get_info();\n } else {\n message(\"No MPI compiler wrapper found beneath MPI_DIR (MPI_DIR = $ENV{MPI_DIR})\");\n }\n }\n}\n\n################################################################################\n# Search\n################################################################################\nif ($mpi_search and !defined($mpi_cmd)) {\n for my $name (@mpicxx_names) {\n last if defined($mpi_cmd);\n $mpi_cmd = which($name);\n }\n if (defined($mpi_cmd)) {\n $mpi_dir = $mpi_cmd;\n $mpi_dir =~ s{/mpi(c\\+\\+|CC|cc|cxx)[^/]*$}{};\n $mpi_dir =~ s{/bin$}{};\n message(\"Found MPI compiler wrapper at $mpi_cmd!\");\n mpi_get_info();\n }\n}\n\nmy $THORN = \"MPI\";\n\n################################################################################\n# Build\n################################################################################\n\nif ($mpi_build and !$mpi_info_set) {\n # Check for required tools. Do this here so that we don't require\n # them when using the system library.\n unless(defined($ENV{TAR}) and $ENV{TAR} =~ /\\S/ and -x which($ENV{TAR})) {\n error(\n \"ENV{TAR} = $ENV{TAR}\\n\" .\n \"Could not find tar command. Please make sure that (GNU) tar is present,\\n\" .\n \"and that the TAR variable is set to its location.\\n\", 3);\n }\n unless(defined($ENV{PATCH}) and $ENV{PATCH} =~ /\\S/ and\n -x which($ENV{PATCH}))\n {\n error(\n \"Could not find patch command. Please make sure that (GNU) patch is present,\\n\" .\n \"and that the PATCH variable is set to its location.\\n\", 4);\n }\n\n # Set locations\n my $INSTALL_DIR = undef;\n my $BUILD_DIR = undef;\n my $SRCDIR = $0;\n $SRCDIR =~ s{(.*)/.*}{$1};\n ${BUILD_DIR} = \"$ENV{SCRATCH_BUILD}/build/${THORN}\";\n if (defined($ENV{MPI_INSTALL_DIR}) and $ENV{MPI_INSTALL_DIR} =~ /\\S/) {\n $INSTALL_DIR = \"$ENV{MPI_INSTALL_DIR}/${THORN}\";\n } else {\n $INSTALL_DIR = \"$ENV{SCRATCH_BUILD}/external/${THORN}\";\n }\n message(\"Installing MPI into ${INSTALL_DIR}\");\n $mpi_dir = ${INSTALL_DIR};\n\n $mpi_manual = 1;\n $ENV{MPI_BUILD} = '1';\n $ENV{MPI_DIR} = $mpi_dir;\n $ENV{MPI_INC_DIRS} = \"$mpi_dir/include\";\n $ENV{MPI_LIB_DIRS} = \"$mpi_dir/lib\";\n my $mpi_fortranlibs = '';\n if ($ENV{F90} ne 'none') {\n $mpi_fortranlibs = \"mpi_usempif08 mpi_usempi_ignore_tkr mpi_mpifh\";\n }\n my $mpi_linux_libs = '';\n if ($^O eq 'linux') {\n $mpi_linux_libs = \"rt util\";\n }\n $ENV{MPI_LIBS} = \"$mpi_fortranlibs mpi_cxx mpi open-rte open-pal $mpi_linux_libs\";\n} else {\n $ENV{MPI_BUILD} = '';\n my $DONE_FILE = \"$ENV{SCRATCH_BUILD}/done/${THORN}\";\n if (! -e $DONE_FILE) {\n mkdir(\"$ENV{SCRATCH_BUILD}/done\");\n system(\"date > ${DONE_FILE}\") == 0 or die;\n }\n}\n\n################################################################################\n# Configure MPI options\n################################################################################\n\nif ($mpi_info_set) {\n my @incdirs = ();\n my @libdirs = ();\n my @libs = ();\n while($info =~ /\\s-I\\s*(\\S+)/g) {\n push @incdirs, $1;\n }\n while($info =~ /\\s-L\\s*(\\S+)/g) {\n push @libdirs, $1;\n }\n while($info =~ /\\s-l(\\S+)/g) {\n push @libs, $1;\n }\n\n $ENV{MPI_DIR} = $mpi_dir;\n $ENV{MPI_INC_DIRS} = join(\" \",@incdirs);\n $ENV{MPI_LIB_DIRS} = join(\" \",@libdirs);\n $ENV{MPI_LIBS} = join(\" \",@libs);\n\n message(\"Successfully configured MPI.\");\n} elsif ($mpi_manual) {\n my @incdirs = ();\n my @libdirs = ();\n my @libs = ();\n if (is_set(\"MPI_INC_DIRS\")) {\n push @incdirs, $ENV{MPI_INC_DIRS};\n } else {\n push @incdirs, \"$ENV{MPI_DIR}/include\";\n }\n if (is_set(\"MPI_LIB_DIRS\")) {\n push @libdirs, $ENV{MPI_LIB_DIRS};\n } else {\n push @libdirs, \"$ENV{MPI_DIR}/lib64\";\n push @libdirs, \"$ENV{MPI_DIR}/lib\";\n }\n if (is_set(\"MPI_LIBS\")) {\n push @libs, $ENV{MPI_LIBS};\n } else {\n # do nothing\n }\n\n $ENV{MPI_INC_DIRS} = join(\" \",@incdirs);\n $ENV{MPI_LIB_DIRS} = join(\" \",@libdirs);\n $ENV{MPI_LIBS} = join(\" \",@libs);\n\n message(\"MPI was manually configured.\");\n} else {\n error(\"MPI could not be configured: neither automatic nor manual configuration succeeded\",5);\n}\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Strip standard paths\n$ENV{MPI_INC_DIRS} = strip_inc_dirs($ENV{MPI_INC_DIRS});\n$ENV{MPI_LIB_DIRS} = strip_lib_dirs($ENV{MPI_LIB_DIRS});\n\n# Pass configuration options to build script\nprint \"BEGIN MAKE_DEFINITION\\n\";\nprint \"MPI_BUILD = $ENV{MPI_BUILD}\\n\";\nprint \"MPI_INSTALL_DIR = $ENV{MPI_INSTALL_DIR}\\n\";\nprint \"HWLOC_DIR = $ENV{HWLOC_DIR}\\n\";\nprint \"END MAKE_DEFINITION\\n\";\n\n# Pass options to Cactus\n\nprint \"BEGIN DEFINE\\n\";\nprint \"CCTK_MPI 1\\n\";\nprint \"END DEFINE\\n\";\n\nprint \"BEGIN MAKE_DEFINITION\\n\";\nprint \"CCTK_MPI = 1\\n\";\nprint \"MPI_DIR = $ENV{MPI_DIR}\\n\";\nprint \"MPI_INC_DIRS = $ENV{MPI_INC_DIRS}\\n\";\nprint \"MPI_LIB_DIRS = $ENV{MPI_LIB_DIRS}\\n\";\nprint \"MPI_LIBS = $ENV{MPI_LIBS}\\n\";\nprint \"END MAKE_DEFINITION\\n\";\n\nprint \"INCLUDE_DIRECTORY \\$(MPI_INC_DIRS)\\n\";\nprint \"INCLUDE_DIRECTORY_FORTRAN \\$(MPI_LIB_DIRS)\\n\";\nprint \"LIBRARY_DIRECTORY \\$(MPI_LIB_DIRS)\\n\";\nprint \"LIBRARY \\$(MPI_LIBS)\\n\";\n\n################################################################################\n# Functions\n################################################################################\n\nsub which {\n my $cmd = shift;\n for my $path (split(/:/,$ENV{PATH})) {\n my $full_cmd = \"$path/$cmd\";\n if (-x $full_cmd) {\n return $full_cmd;\n }\n }\n return undef;\n}\n\nsub mpi_get_info {\n my $fd = new FileHandle;\n open($fd,\"$mpi_cmd -compile_info 2>/dev/null|\");\n $info = <$fd>;\n close($fd);\n if ($info eq \"\") {\n open($fd,\"$mpi_cmd --showme 2>/dev/null|\");\n $info = <$fd>;\n close($fd);\n }\n if ($info eq \"\") {\n # The command, mpicc, is quite often a shell script.\n # Run it with -x to trace, and find the compile command.\n open($fd,\"sh -x $mpi_cmd /dev/null 2>/dev/null|\");\n my $contents = <$fd>;\n if ($contents =~ /\\w+cc.*-I\\/.*-lmpi.*/) {\n $info = $&;\n }\n }\n if ($info =~ /^\\s*$/) {\n $mpi_info_set = 0;\n } else {\n $mpi_info_set = 1;\n }\n}\n\nsub message {\n my $msg = shift;\n $msg =~ s/\\n$//;\n print \"BEGIN MESSAGE\\n\";\n print \"$msg\\n\";\n print \"END MESSAGE\\n\";\n}\nsub error {\n my ($msg,$errno) = @_;\n $msg =~ s/\\n$//;\n print \"BEGIN ERROR\\n\";\n print \"$msg\\n\";\n print \"END ERROR\\n\";\n exit $errno;\n}\n\nsub is_set {\n my $var = shift;\n return (defined($ENV{$var}) and !($ENV{$var} =~ /^\\s*$/));\n}\n\nsub strip_inc_dirs {\n my $dirlist = shift;\n my @dirs = split / /, $dirlist;\n map { s{//}{/}g } @dirs;\n @dirs = grep { !m{^/(usr/(local/)?)?include/?$} } @dirs;\n return join ' ', @dirs;\n}\nsub strip_lib_dirs {\n my $dirlist = shift;\n my @dirs = split / /, $dirlist;\n map { s{//}{/}g } @dirs;\n @dirs = grep { !m{^/(usr/(local/)?)?lib(64?)/?$} } @dirs;\n return join ' ', @dirs;\n}\n",
|
| 13 |
+
"make.configuration.deps": "# make.configuration.deps file for thorn MPI\n\n$(patsubst %,$(UTIL_DIR)/%,$(MPI_UTILS)): $(UTIL_DIR)/% : $(MPI_DIR)/bin/%\n\t@echo \"Copying $* from $< to $(UTIL_DIR)\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null\n\tcp $< $@\n",
|
| 14 |
+
"build.pl": "#!/usr/bin/perl\nuse Carp;\nuse strict;\nuse FileHandle;\nuse Cwd;\n$/ = undef;\n\n# Set up shell\nmy $verbose = 0;\n$verbose = 1 if $ENV{VERBOSE} =~ /^yes$/i;\n\nif ($verbose) {\n # we implement VERBOSE by restarting in the debugger and having it print each line\n if (not defined($ENV{'PERL5DB'})) {\n $ENV{'PERL5DB'} = 'sub DB::DB {\n my ($p, $f, $l) = caller;\n my $code = \\@{\"::_<$f\"};\n print STDERR \">> $f:$l: $code->[$l]\";\n }';\n exit system($^X, \"-d\", $0, @ARGV);\n }\n}\n\n# Set locations\nmy $THORN = \"MPI\";\nmy $NAME = \"openmpi-4.0.2\";\nmy $INSTALL_DIR = undef;\nmy $BUILD_DIR = undef;\nmy $SRCDIR = $0;\n$SRCDIR =~ s{(.*)/.*}{$1};\n${BUILD_DIR} = \"$ENV{SCRATCH_BUILD}/build/${THORN}\";\nif (defined($ENV{MPI_INSTALL_DIR}) and $ENV{MPI_INSTALL_DIR} =~ /\\S/) {\n $INSTALL_DIR = \"$ENV{MPI_INSTALL_DIR}/${THORN}\";\n} else {\n $INSTALL_DIR = \"$ENV{SCRATCH_BUILD}/external/${THORN}\";\n}\nprint \"Installing MPI into ${INSTALL_DIR}\\n\";\nmy $DONE_FILE = \"$ENV{SCRATCH_BUILD}/done/${THORN}\";\nmy $mpi_dir = ${INSTALL_DIR};\n\nchdir($ENV{SCRATCH_BUILD});\n\n# Set up environment\n# Disable ccache: remove \"ccache\" and all options that follow\n$ENV{CC} =~ s/^\\s*ccache\\s+(-\\S*\\s+)*//;\n$ENV{CXX} =~ s/^\\s*ccache\\s+(-\\S*\\s+)*//;\nif ($ENV{F90} eq 'none') {\n print \"No Fortran 90 compiler available. Building MPI library without Fortran support.\\n\";\n $ENV{FC} = undef;\n $ENV{FCFLAGS} = undef;\n} else {\n $ENV{FC} = $ENV{F90};\n $ENV{FCFLAGS} = $ENV{F90FLAGS};\n}\n$ENV{LIBS} = undef;\n$ENV{RPATH} = undef;\nif ($ENV{ARFLAGS} =~ /64/) {\n $ENV{OBJECT_MODE} = \"64\";\n}\n\nprint \"MPI: Preparing directory structure...\\n\";\nmkdir(\"build\");\nmkdir(\"external\");\nmkdir(\"done\");\nsystem(\"rm -rf ${BUILD_DIR} ${INSTALL_DIR}\") == 0 or die;\nmkdir(${BUILD_DIR});\nmkdir(${INSTALL_DIR});\nerror(\"${INSTALL_DIR} does not exist.\",6) unless(-e ${INSTALL_DIR});\nerror(\"${INSTALL_DIR} is not a directory.\",6) unless(-d ${INSTALL_DIR});\nerror(\"${INSTALL_DIR} is not readable.\",7) unless(-r ${INSTALL_DIR});\nerror(\"${INSTALL_DIR} is not writeable.\",8) unless(-w ${INSTALL_DIR});\nerror(\"${INSTALL_DIR} is not executable.\",8) unless(-x ${INSTALL_DIR});\n\nprint \"MPI: Unpacking archive...\\n\";\nchdir(${BUILD_DIR});\nsystem(\"$ENV{TAR} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\") == 0 or die;\n\nprint \"MPI: Configuring...\\n\";\nchdir(${NAME});\nmy $hwloc_opts = '';\nif ($ENV{HWLOC_DIR} ne '' and $ENV{HWLOC_DIR} ne 'NO_BUILD') {\n $hwloc_opts = \"--with-hwloc='$ENV{HWLOC_DIR}'\";\n}\n# Cannot have a memory manager with a static library on some systems\n# (e.g. Linux); see\n# <http://www.open-mpi.org/faq/?category=mpi-apps#static-mpi-apps>\nsystem(\"./configure --prefix='$mpi_dir' $hwloc_opts --enable-mpi-cxx --with-zlib=no --enable-mpi1-compatibility --without-memory-manager --enable-shared=no --enable-static=yes\") == 0 or die;\n\nprint \"MPI: Building...\\n\";\nsystem(\"$ENV{MAKE}\") == 0 or die;\n\nprint \"MPI: Installing...\\n\";\nsystem(\"$ENV{MAKE} install\") == 0 or die;\nchdir($ENV{SCRATCH_BUILD});\n\nprint \"MPI: Cleaning up...\\n\";\nsystem(\"rm -rf ${BUILD_DIR}\") == 0 or die;\n\nsystem(\"date > ${DONE_FILE}\") == 0 or die;\nprint \"MPI: Done.\\n\";\n"
|
| 15 |
+
},
|
| 16 |
+
"test": {},
|
| 17 |
+
"doc": {
|
| 18 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{MPI}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the MPI library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n\n"
|
| 19 |
+
}
|
| 20 |
+
}
|
ExternalLibraries_OpenSSL.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/OpenSSL",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn OpenSSL\n\nPROVIDES OpenSSL\n{\n SCRIPT configure.sh\n LANG bash\n OPTIONS OPENSSL_INSTALL_DIR OPENSSL_DIR OPENSSL_INC_DIRS OPENSSL_LIB_DIRS OPENSSL_LIBS\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn OpenSSL\n\nIMPLEMENTS: OpenSSL\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn OpenSSL\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn OpenSSL\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n"
|
| 10 |
+
},
|
| 11 |
+
"test": {},
|
| 12 |
+
"doc": {
|
| 13 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{OpenSSL}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the OpenSSL library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 14 |
+
}
|
| 15 |
+
}
|
ExternalLibraries_PAPI.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/PAPI",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn PAPI\n\nPROVIDES PAPI\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS PAPI_DIR PAPI_INSTALL_DIR\n}\n\nREQUIRES PAPI\n",
|
| 5 |
+
"interface": "# Interface definition for thorn PAPI\n\nIMPLEMENTS: PAPI\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn PAPI\n\nSCHEDULE PAPI_init AT wragh\n{\n LANG: C\n OPTIONS: meta\n} \"Initialise PAPI\"\n\nSCHEDULE PAPI_register_clock AT wragh AFTER PAPI_init\n{\n LANG: C\n OPTIONS: meta\n} \"Set up Cactus clock for PAPI\"\n\nSCHEDULE PAPI_dgemm AT basegrid\n{\n LANG: C\n OPTIONS: meta\n} \"Run a DGEMM benchmark to test PAPI\"\n\nSCHEDULE PAPI_output_stats_analysis AT analysis\n{\n LANG: C\n OPTIONS: meta\n} \"Output PAPI statistics\"\n\nSCHEDULE PAPI_output_stats_terminate AT terminate\n{\n LANG: C\n OPTIONS: meta\n} \"Output PAPI statistics\"\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn PAPI\n\nexport PAPI_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(PAPI_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.configuration.defn": "# make.configuration.defn file for thorn PAPI\n\n# Define standard PAPI utilities and install those that we could build\n# and/or that are present in the system\nSTD_PAPI_UTILS = papi_avail papi_clockres papi_command_line papi_component_avail papi_cost papi_decode papi_error_codes papi_event_chooser papi_mem_info papi_multiplex_cost papi_native_avail papi_version papi_xml_event_info\nPAPI_UTILS = $(filter $(STD_PAPI_UTILS), $(notdir $(wildcard $(PAPI_DIR)/bin/*)))\nALL_UTILS += $(PAPI_UTILS)\n",
|
| 11 |
+
"make.code.defn": "# Main make.code.defn file for thorn PAPI\n\n# Source files in this directory\nSRCS = clock.c dgemm.c stats.c\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 12 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Build\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n# Set locations\nTHORN=PAPI\nNAME=papi-6.0.0.1\nTARNAME=papi-6.0.0.1\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${PAPI_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing PAPI into ${PAPI_INSTALL_DIR} \"\n echo \"END MESSAGE\"\n INSTALL_DIR=${PAPI_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nPAPI_DIR=${INSTALL_DIR}\n \n# Set up environment\nunset CPP\nunset LIBS\nexport MPICC=: # disable MPI tests\nif echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\n\necho \"PAPI: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\necho \"PAPI: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${TARNAME}.tar.gz\n\necho \"PAPI: Applying patches...\"\npushd ${NAME}\n# Replace <malloc.h> by <stdlib.h>\nfind . -type f -print | xargs perl -pi -e 's/malloc.h/stdlib.h/'\n# disable Werror since new compiler warns about PAPI\nfind . -name config.mk -print | xargs perl -pi -e 's/-Werror//g'\n${PATCH?} -p1 < ${SRCDIR}/../dist/F77_COMMON_NAME.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/create_timer.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/syscall.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/thread_id.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/component.patch\n${PATCH?} -p1 < ${SRCDIR}/../dist/configure_flags.patch\n# Some (ancient but still used) versions of patch don't support the\n# patch format used here but also don't report an error using the exit\n# code. So we use this patch to test for this\n${PATCH?} -p1 < ${SRCDIR}/../dist/patchtest.patch\nif [ ! -e .patch_tmp ]; then\n echo 'BEGIN ERROR'\n echo 'The version of patch is too old to understand this patch format.'\n echo 'Please set the PATCH environment variable to a more recent '\n echo 'version of the patch command.'\n echo 'END ERROR'\n exit 1\nfi\nrm -f .patch_tmp\npopd\n\necho \"PAPI: Configuring...\"\ncd ${NAME}/src\n# CC C compiler command\n# CFLAGS C compiler flags\n# LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a\n# nonstandard directory <lib dir>\n# CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have\n# headers in a nonstandard directory <include dir>\n# F77 Fortran 77 compiler command\n# FFLAGS Fortran 77 compiler flags\n# CPP C preprocessor\n#unset CC\n#unset CFLAGS\n#unset LDFLAGS\n#unset CPPFLAGS\n#unset F77\n#unset FFLAGS\n#unset CPP\n#export MPICC=\n\n# get rid of NAME variables in make since PAPI's Makefile uses it as well\nunset NAME\n# disable parallel build since PAPI does not support it\nMAKEFLAGS=${MAKEFLAGS%% -- *}\n\n# need OpenMP support in LDFLAGS, PAPI uses CC to link, so:\nexport LDFLAGS=\"$CFLAGS $LDFLAGS\"\n\n./configure --prefix=${PAPI_DIR} --with-shared-lib=no\n\n# disable building and running the tests since they may fail and we don't care\necho \"PAPI: Building...\"\n${MAKE} TESTS=\n\necho \"PAPI: Installing...\"\n${MAKE} install\npopd\n\necho \"PAPI: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"PAPI: Done.\"\n",
|
| 13 |
+
"stats.c": "#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <assert.h>\n#include <math.h>\n#include <stdarg.h>\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef _OPENMP\n#include <omp.h>\n#else\nstatic int omp_get_max_threads(void) { return 1; }\nstatic int omp_get_thread_num(void) { return 0; }\n#endif\n\n#include <papi.h>\n\n#include \"stats.h\"\n\n// For backward compatibility\n#if PAPI_VERSION_MAJOR(PAPI_VERSION) <= 4\n\n// Taken (and modified) from PAPI 5.1.0.1, file src/papi.c\nstatic int PAPI_add_named_event(int EventSet, char *EventName) {\n int ret;\n int code;\n ret = PAPI_event_name_to_code(EventName, &code);\n if (ret != PAPI_OK)\n return ret;\n ret = PAPI_add_event(EventSet, code);\n return ret;\n}\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n\nvoid outinfo(const char *const function) {\n DECLARE_CCTK_PARAMETERS;\n if (verbose) {\n#pragma omp master\n { printf(\"[%s]\\n\", function); }\n }\n}\n\n// Check for an error, and output an error message if there was one\nvoid chkerr(const int ierr, const char *const function, ...) {\n if (ierr < 0) {\n#pragma omp critical\n {\n va_list ap;\n va_start(ap, function);\n printf(\"ERROR %d [%s] in \", ierr, PAPI_strerror(ierr));\n vprintf(function, ap);\n printf(\"\\n\");\n va_end(ap);\n }\n }\n}\n\n////////////////////////////////////////////////////////////////////////////////\n\nint num_threads;\nint *restrict eventsets = NULL;\nint num_events;\nint *restrict events;\n\n// The PAPI component of these eventsets\nstatic int component = -1;\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Remember timer values when PAPI counters were last reset\nstatic long long *restrict last_nsec = NULL;\nstatic long long *restrict last_cyc = NULL;\n\n#if defined __linux__\n\n// This is recommended for Linux, but e.g. doesn't work on OSX\n#include <pthread.h>\nstatic unsigned long thread_id(void) {\n const pthread_t tid = pthread_self();\n unsigned long ret;\n memcpy(&ret, &tid, sizeof ret);\n return ret;\n}\n\n#elif defined _OPENMP\n\n// This works only if no threads are created/destroyed\n// (if the number of threads doesn't change)\n#include <omp.h>\nstatic unsigned long thread_id(void) { return omp_get_thread_num(); }\n\n#else\n\n// Don't know how to obtain a thread id\nstatic unsigned long thread_id(void) { return 0; }\n\n#endif\n\nvoid PAPI_init(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n int ierr;\n\n CCTK_INFO(\"Initialising PAPI\");\n\n // OpenMP\n\n assert(per_thread_statistics);\n num_threads = omp_get_max_threads();\n\n // Initialise PAPI\n\n outinfo(\"PAPI_library_init\");\n ierr = PAPI_library_init(PAPI_VER_CURRENT);\n chkerr(ierr, \"PAPI_library_init\");\n if (ierr != PAPI_VER_CURRENT) {\n CCTK_ERROR(\"PAPI library version mismatch\");\n }\n\n if (per_thread_statistics) {\n outinfo(\"PAPI_thread_init\");\n// TODO: Investigate PAPI_INHERIT -- but this may work only with\n// recent version of PAPI and/or Linux\n\n// NOTE: Our implementation of thread_id probably cannot handle\n// changes in the number of threads. That is, omp_set_num_threads\n// should not be called after this point.\n\n#if 0\n // Ensure all threads are created\n // (This is necessary for Intel's OpenMP.)\n volatile int dummy = 0;\n#pragma omp parallel reduction(+ : dummy)\n {\n dummy += 1;\n }\n#endif\n\n ierr = PAPI_thread_init(thread_id);\n chkerr(ierr, \"PAPI_thread_init\");\n }\n\n if (use_multiplexing) {\n outinfo(\"PAPI_multiplex_init\");\n ierr = PAPI_multiplex_init();\n chkerr(ierr, \"PAPI_multiplex_init\");\n }\n\n // Get some basic information\n\n outinfo(\"PAPI_num_components\");\n int num_components = ierr = PAPI_num_components();\n chkerr(ierr, \"PAPI_num_components\");\n if (ierr < 0)\n num_components = 0;\n if (verbose) {\n printf(\"There are %d PAPI components\\n\", num_components);\n }\n\n if (verbose) {\n for (int n = 0; n < num_components; ++n) {\n outinfo(\"PAPI_get_component_info\");\n const PAPI_component_info_t *const info = PAPI_get_component_info(n);\n printf(\"PAPI component #%d:\\n\", n);\n printf(\" name: %s\\n\", info->name);\n#if PAPI_VERSION_MAJOR(PAPI_VERSION) >= 5\n printf(\" short_name: %s\\n\", info->short_name);\n printf(\" description: %s\\n\", info->description);\n#endif\n printf(\" num_cntrs: %d\\n\", info->num_cntrs);\n printf(\" num_mpx_cntrs: %d\\n\", info->num_mpx_cntrs);\n printf(\" num_preset_events: %d\\n\", info->num_preset_events);\n printf(\" num_native_events: %d\\n\", info->num_native_events);\n }\n }\n\n if(num_components > 0) {\n component = 0;\n if (verbose) {\n printf(\"Using PAPI component %d\\n\", component);\n }\n } else {\n if (verbose) {\n printf(\"No PAPI component to use\\n\");\n }\n } \n\n#if PAPI_VERSION_MAJOR(PAPI_VER_CURRENT) < 6\n outinfo(\"PAPI_num_counters\");\n int num_counters = ierr = PAPI_num_counters();\n chkerr(ierr, \"PAPI_num_counters\");\n if (ierr < 0)\n num_counters = 0;\n if (verbose) {\n printf(\"There are %d PAPI counters\\n\", num_counters);\n }\n#endif\n\n // Translate user event names to an eventset\n\n eventsets = malloc(num_threads * sizeof *eventsets);\n assert(eventsets);\n\n#pragma omp parallel private(ierr)\n {\n const int thread_num = omp_get_thread_num();\n\n outinfo(\"PAPI_create_eventset\");\n eventsets[thread_num] = PAPI_NULL;\n ierr = PAPI_create_eventset(&eventsets[thread_num]);\n chkerr(ierr, \"PAPI_create_eventset\");\n if(num_components > 0) {\n outinfo(\"PAPI_assign_eventset_component\");\n ierr = PAPI_assign_eventset_component(eventsets[thread_num], component);\n chkerr(ierr, \"PAPI_assign_eventset_component\");\n }\n if (use_multiplexing) {\n outinfo(\"PAPI_set_multiplex\");\n ierr = PAPI_set_multiplex(eventsets[thread_num]);\n chkerr(ierr, \"PAPI_set_multiplex\");\n }\n\n // User-defined event sets\n const int num_eventsets = 5;\n const char *restrict const eventset_descriptions[] = {\n \"flops\", \"ipc\", \"icache\", \"dcache\", \"memory\",\n };\n assert(sizeof eventset_descriptions / sizeof *eventset_descriptions ==\n num_eventsets);\n const char *const eventset_eventnames[] = {\n events_flops, events_ipc, events_icache, events_dcache, events_memory,\n };\n assert(sizeof eventset_eventnames / sizeof *eventset_eventnames ==\n num_eventsets);\n\n for (int n = 0; n < num_eventsets; ++n) {\n#pragma omp master\n if (verbose) {\n printf(\"Adding eventset %s:\\n\", eventset_descriptions[n]);\n }\n\n char *const eventnames = strdup(eventset_eventnames[n]);\n const char *const sep = \", \";\n char *lasts;\n for (char *event_name = strtok_r(eventnames, sep, &lasts); event_name;\n event_name = strtok_r(NULL, sep, &lasts)) {\n#pragma omp master\n if (verbose) {\n printf(\" event %s\\n\", event_name);\n }\n outinfo(\"PAPI_add_named_event\");\n ierr = PAPI_add_named_event(eventsets[thread_num], event_name);\n chkerr(ierr, \"PAPI_add_named_event[%s]\", event_name);\n }\n free(eventnames);\n }\n }\n\n outinfo(\"PAPI_num_events\");\n num_events = ierr = PAPI_num_events(eventsets[0]);\n chkerr(ierr, \"PAPI_num_events\");\n if (ierr < 0)\n num_events = 0;\n\n outinfo(\"PAPI_list_events\");\n events = malloc(num_events * sizeof *events);\n ierr = PAPI_list_events(eventsets[0], events, &num_events);\n chkerr(ierr, \"PAPI_list_events\");\n\n last_nsec = malloc(num_threads * sizeof *last_nsec);\n assert(last_nsec);\n last_cyc = malloc(num_threads * sizeof *last_cyc);\n assert(last_cyc);\n\n#pragma omp parallel private(ierr)\n {\n const int thread_num = omp_get_thread_num();\n\n outinfo(\"PAPI_start\");\n ierr = PAPI_start(eventsets[thread_num]);\n chkerr(ierr, \"PAPI_start\");\n\n outinfo(\"PAPI_get_real_nsec\");\n last_nsec[thread_num] = PAPI_get_real_nsec();\n outinfo(\"PAPI_get_real_cyc\");\n last_cyc[thread_num] = PAPI_get_real_cyc();\n }\n}\n\nstatic void output_stats(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n int ierr;\n\n CCTK_INFO(\"PAPI Statistics:\");\n\n long long elapsed_nsec = 0;\n long long elapsed_cyc = 0;\n long long values[num_events];\n for (int i = 0; i < num_events; ++i) {\n values[i] = 0;\n }\n#pragma omp parallel private(ierr)\n {\n const int thread_num = omp_get_thread_num();\n\n outinfo(\"PAPI_get_real_nsec\");\n const long long my_nsec = PAPI_get_real_nsec();\n\n outinfo(\"PAPI_read_ts\");\n long long my_cyc;\n long long my_values[num_events];\n ierr = PAPI_read_ts(eventsets[thread_num], my_values, &my_cyc);\n chkerr(ierr, \"PAPI_read_ts\");\n\n const long long my_elapsed_nsec = my_nsec - last_nsec[thread_num];\n const long long my_elapsed_cyc = my_cyc - last_cyc[thread_num];\n last_nsec[thread_num] = my_nsec;\n last_cyc[thread_num] = my_cyc;\n\n#pragma omp critical(PAPI_output_stats_add)\n {\n elapsed_nsec += my_elapsed_nsec;\n elapsed_cyc += my_elapsed_cyc;\n for (int i = 0; i < num_events; ++i) {\n values[i] += my_values[i];\n }\n }\n }\n\n printf(\" CPU time %20.9f sec\\n\", elapsed_nsec / 1.0e+9);\n printf(\" CPU cycles %20.9f Gcyc\\n\", elapsed_cyc / 1.0e+9);\n for (int i = 0; i < num_events; ++i) {\n outinfo(\"PAPI_event_code_to_name\");\n char eventname[PAPI_MAX_STR_LEN];\n ierr = PAPI_event_code_to_name(events[i], eventname);\n chkerr(ierr, \"PAPI_event_code_to_name\");\n printf(\" %-15s %20.9f cyc^(-1)\\n\", eventname,\n 1.0 * values[i] / elapsed_cyc);\n }\n}\n\nvoid PAPI_output_stats_analysis(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n if (out_every == -1)\n return;\n if (cctk_iteration > 0) {\n if (out_every == 0)\n return;\n if (cctk_iteration % out_every > 0)\n return;\n }\n\n output_stats(CCTK_PASS_CTOC);\n}\n\nvoid PAPI_output_stats_terminate(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n if (out_every == -1)\n return;\n if (out_every > 0)\n return;\n\n output_stats(CCTK_PASS_CTOC);\n}\n",
|
| 14 |
+
"dgemm.c": "#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <stdlib.h>\n#include <time.h>\n#include <sys/time.h>\n\n#ifdef _OPENMP\n#include <omp.h>\n#else\nstatic int omp_get_num_threads(void) { return 1; }\n#endif\n\nstatic double get_time(void) {\n struct timeval tv;\n gettimeofday(&tv, NULL);\n return tv.tv_sec + tv.tv_usec / 1.0e+6;\n}\n\n/* Generate a matrix with random entries between 0.0 and 1.0 */\nstatic void dmatgen(const ptrdiff_t m, const ptrdiff_t n,\n CCTK_REAL *restrict const A, const ptrdiff_t ldA) {\n const CCTK_REAL x = rand() / (RAND_MAX + 1.0);\n\n for (ptrdiff_t j = 0; j < n; ++j) {\n for (ptrdiff_t i = 0; i < m; ++i) {\n A[i + ldA * j] = x;\n }\n }\n}\n\n/* DGEMM (for transposed A and un-transposed B) */\nstatic void dgemm(const ptrdiff_t m, const ptrdiff_t n, const ptrdiff_t l,\n const CCTK_REAL *restrict const A, const ptrdiff_t ldA,\n const CCTK_REAL *restrict const B, const ptrdiff_t ldB,\n CCTK_REAL *restrict const C, const ptrdiff_t ldC) {\n for (ptrdiff_t j = 0; j < n; ++j) {\n for (ptrdiff_t i = 0; i < m; ++i) {\n CCTK_REAL s = C[i + ldC * j];\n for (ptrdiff_t k = 0; k < l; ++k) {\n s += A[k + ldA * i] * B[k + ldB * j];\n }\n C[i + ldC * j] = s;\n }\n }\n}\n\n/* \"Use\" a matrix */\nstatic CCTK_REAL dmatuse(const ptrdiff_t m, const ptrdiff_t n,\n const CCTK_REAL *restrict const A,\n const ptrdiff_t ldA) {\n CCTK_REAL s = 0.0;\n\n for (ptrdiff_t j = 0; j < n; ++j) {\n for (ptrdiff_t i = 0; i < m; ++i) {\n s += A[i + ldA * j];\n }\n }\n\n return s;\n}\n\nstatic void run_dgemm(const ptrdiff_t N) {\n DECLARE_CCTK_PARAMETERS;\n\n#pragma omp barrier\n const double t0 = get_time();\n\n CCTK_REAL *restrict const A = malloc(N * N * sizeof *A);\n CCTK_REAL *restrict const B = malloc(N * N * sizeof *B);\n CCTK_REAL *restrict const C = malloc(N * N * sizeof *C);\n\n dmatgen(N, N, A, N);\n dmatgen(N, N, B, N);\n dmatgen(N, N, C, N);\n\n const double t1 = get_time();\n#pragma omp barrier\n dgemm(N, N, N, A, N, B, N, C, N);\n#pragma omp barrier\n const double t2 = get_time();\n const int num_threads = omp_get_num_threads();\n const double Gflop = num_threads * 2.0 * N * N * N / 1.0e+9;\n\n const volatile CCTK_REAL s CCTK_ATTRIBUTE_UNUSED = dmatuse(N, N, C, N);\n\n free(A);\n free(B);\n free(C);\n\n#pragma omp barrier\n const double t3 = get_time();\n\n const double Gflop_sec_pure = Gflop / (t2 - t1);\n const double Gflop_sec_overall = Gflop / (t3 - t0);\n\n#pragma omp master\n {\n CCTK_VInfo(CCTK_THORNSTRING,\n \"Floating point operations: %g Gflop over %d threads\", Gflop,\n num_threads);\n CCTK_VInfo(CCTK_THORNSTRING, \"Pure performance: %g Gflop/sec\",\n Gflop_sec_pure);\n CCTK_VInfo(CCTK_THORNSTRING, \"Overall performance: %g Gflop/sec\",\n Gflop_sec_overall);\n }\n}\n\nvoid PAPI_dgemm(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n const ptrdiff_t N = dgemm_N;\n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"Running local single-threaded DGEMM benchmark with N=%td...\", N);\n run_dgemm(N);\n\n CCTK_VInfo(CCTK_THORNSTRING,\n \"Running local multi-threaded DGEMM benchmark with N=%td...\", N);\n#pragma omp parallel\n { run_dgemm(N); }\n\n CCTK_INFO(\"NOTE: These performance numbers do not have to be large, but they \"\n \"need to agree with what PAPI reports\");\n}\n",
|
| 15 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n################################################################################\n# Search\n################################################################################\n\nif [ -z \"${PAPI_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"PAPI selected, but PAPI_DIR not set. Checking some places...\"\n echo \"END MESSAGE\"\n \n DIRS=\"/usr /usr/local /opt/local ${HOME}\"\n # look into each directory\n for dir in $DIRS; do\n # libraries might have different file extensions\n for libext in a dll dll.a dylib lib so; do\n # libraries can be in lib or lib64 (or libx32?)\n for libdir in lib64 lib lib/x86_64-linux-gnu; do\n # These files must exist\n FILES=\"include/papi.h ${libdir}/libpapi.${libext}\"\n # assume this is the one and check all needed files\n PAPI_DIR=\"$dir\"\n for file in $FILES; do\n # discard this directory if one file was not found\n if [ ! -r \"$dir/$file\" ]; then\n unset PAPI_DIR\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PAPI_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PAPI_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PAPI_DIR\" ]; then\n break\n fi\n done\n \n if [ -z \"$PAPI_DIR\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"PAPI not found\"\n echo \"END MESSAGE\"\n else\n echo \"BEGIN MESSAGE\"\n echo \"Found PAPI in ${PAPI_DIR}\"\n echo \"END MESSAGE\"\n fi\nfi\n\nTHORN=PAPI\n\n\n\n################################################################################\n# Build\n################################################################################\n\nif [ -z \"${PAPI_DIR}\" \\\n -o \"$(echo \"${PAPI_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]\nthen\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled PAPI...\"\n echo \"END MESSAGE\"\n \n # Set locations\n NAME=papi-5.3.0\n TARNAME=papi-5.3.0\n SRCDIR=\"$(dirname $0)\"\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${PAPI_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing PAPI into ${PAPI_INSTALL_DIR} \"\n echo \"END MESSAGE\"\n INSTALL_DIR=${PAPI_INSTALL_DIR}\n fi\n PAPI_BUILD=1\n PAPI_DIR=${INSTALL_DIR}\nelse \n PAPI_BUILD=\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\nfi\n\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"PAPI_BUILD = ${PAPI_BUILD}\"\necho \"PAPI_INSTALL_DIR = ${PAPI_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\n# Set options\nPAPI_INC_DIRS=\"${PAPI_DIR}/include\"\nPAPI_LIB_DIRS=\"${PAPI_DIR}/lib\"\nPAPI_LIBS=\"papi\"\n\nif nm ${PAPI_LIB_DIRS}/libpapi.a 2>/dev/null | grep -q pm_initialize; then\n PAPI_LIBS=\"${PAPI_LIBS} pmapi\"\nfi\n\nPAPI_INC_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${PAPI_INC_DIRS})\"\nPAPI_LIB_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${PAPI_LIB_DIRS})\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"PAPI_DIR = ${PAPI_DIR}\"\necho \"PAPI_INC_DIRS = ${PAPI_INC_DIRS}\"\necho \"PAPI_LIB_DIRS = ${PAPI_LIB_DIRS}\"\necho \"PAPI_LIBS = ${PAPI_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(PAPI_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(PAPI_LIB_DIRS)'\necho 'LIBRARY $(PAPI_LIBS)'\n",
|
| 16 |
+
"make.configuration.deps": "# make.configuration.deps file for thorn PAPI\n\n# Copy standard PAPI utilities from the install directory\n\n$(patsubst %,$(UTIL_DIR)/%,$(PAPI_UTILS)): $(UTIL_DIR)/%: $(PAPI_DIR)/bin/%\n\t@echo \"Copying $* from $< to $(UTIL_DIR)\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null\n\tcp $< $@\n",
|
| 17 |
+
"clock.c": "#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <assert.h>\n#include <float.h>\n#include <limits.h>\n#include <math.h>\n#include <stdarg.h>\n#include <stdbool.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#ifdef _OPENMP\n#include <omp.h>\n#else\nstatic int omp_get_max_threads(void) { return 1; }\nstatic int omp_get_thread_num(void) { return 0; }\n#endif\n\n#include <papi.h>\n\n#include \"stats.h\"\n\nstatic const char *const clock_name = \"PAPI\";\n\nstatic int num_event_vals = -1;\nstatic int num_clock_vals = -1;\n\nstatic const int counter_nsec = 0;\nstatic const int counter_cyc = 1;\nstatic const int counter_count = 2;\nstatic const int counter_begin = 3;\n\nstatic int num_statistics_vals = -1;\nstatic int num_cactus_clock_vals = -1;\nstatic const char **counter_names = NULL; // [num_cactus_clock_vals]\nstatic const char **counter_units = NULL; // [num_cactus_clock_vals]\n\ntypedef long long papi_counter_t;\n\ntypedef struct {\n // indexing: [num_clock_vals], laid out as [num_threads][num_event_vals]\n papi_counter_t *restrict accum; // [num_clock_vals]\n papi_counter_t *restrict snapshot; // [num_clock_vals]\n papi_counter_t count;\n bool running;\n} papi_clock_t;\n\nstatic void read_papi_counters(papi_counter_t *restrict const counters) {\n int ierr;\n\n/* for (int i=0; i<num_clock_vals; ++i) { */\n/* counters[i] = -1; */\n/* } */\n#pragma omp barrier\n#pragma omp parallel private(ierr)\n {\n const int thread_num = omp_get_thread_num();\n\n papi_counter_t *restrict const my_counters =\n &counters[num_event_vals * thread_num];\n\n my_counters[counter_nsec] = PAPI_get_real_nsec();\n ierr = PAPI_read_ts(eventsets[thread_num], &my_counters[counter_begin],\n &my_counters[counter_cyc]);\n // chkerr(ierr, \"PAPI_read_ts\");\n if (ierr < 0)\n my_counters[counter_cyc] = PAPI_get_real_cyc();\n ++my_counters[counter_count];\n }\n /* for (int i=0; i<num_clock_vals; ++i) { */\n /* assert(counters[i] != -1); */\n /* } */\n /* for (int i=0; i<num_clock_vals; ++i) { */\n /* assert(counters[i] >= 0); */\n /* } */\n}\n\nstatic void *clock_create(const int timernum) {\n papi_clock_t *restrict const data = malloc(sizeof *data);\n assert(data);\n data->accum = malloc(num_clock_vals * sizeof *data->accum);\n assert(data->accum);\n data->snapshot = malloc(num_clock_vals * sizeof *data->snapshot);\n assert(data->snapshot);\n for (int i = 0; i < num_clock_vals; ++i) {\n data->accum[i] = 0;\n }\n data->running = false;\n return data;\n}\n\nstatic void clock_destroy(const int timernum, void *restrict const data_) {\n papi_clock_t *restrict const data = data_;\n assert(data);\n free(data->accum);\n free(data->snapshot);\n free(data);\n}\n\nstatic void clock_start(const int timernum, void *restrict const data_) {\n papi_clock_t *restrict const data = data_;\n assert(!data->running);\n read_papi_counters(data->snapshot);\n data->running = true;\n}\n\nstatic void clock_stop(const int timernum, void *restrict const data_) {\n papi_clock_t *restrict const data = data_;\n // Apparently clocks can be created in a \"running\" state?\n if (!data->running)\n return;\n assert(data->running);\n papi_counter_t current[num_clock_vals];\n read_papi_counters(current);\n data->running = false;\n for (int i = 0; i < num_clock_vals; ++i) {\n data->accum[i] += current[i] - data->snapshot[i];\n }\n /* for (int i=0; i<num_clock_vals; ++i) { */\n /* assert(data->accum[i] >= 0); */\n /* } */\n}\n\nstatic void clock_reset(const int timernum, void *restrict const data_) {\n papi_clock_t *restrict const data = data_;\n for (int i = 0; i < num_clock_vals; ++i) {\n data->accum[i] = 0;\n }\n}\n\nstatic void clock_get(const int timernum, void *restrict const data_,\n cTimerVal *restrict const vals) {\n DECLARE_CCTK_PARAMETERS;\n\n const papi_clock_t *restrict const data = data_;\n\n int count = 0;\n for (int i = 0; i < num_event_vals; ++i) {\n\n double sum = 0.0, sum2 = 0.0, min = DBL_MAX, max = 0.0;\n for (int j = i; j < num_clock_vals; j += num_event_vals) {\n /* assert(data->accum[j] >= 0); */\n const double val = data->accum[j];\n sum += val;\n sum2 += val * val;\n min = fmin(min, val);\n max = fmax(max, val);\n }\n /* assert(sum >= 0.0); */\n\n if (!define_statistics_clocks) {\n\n vals[count].type = val_double;\n vals[count].heading = counter_names[count];\n vals[count].units = counter_units[count];\n vals[count].val.d = sum / 1.0e+9;\n vals[count].seconds = sum / 1.0e+9;\n vals[count].resolution = 1.0e-9;\n ++count;\n\n } else {\n\n const double avg = sum / num_threads;\n const double sdv = sqrt(fmax(0.0, sum2 / num_threads - avg * avg));\n\n vals[count].type = val_double;\n vals[count].heading = counter_names[count];\n vals[count].units = counter_units[count];\n vals[count].val.d = avg / 1.0e+9;\n vals[count].seconds = avg / 1.0e+9;\n vals[count].resolution = 1.0e-9;\n ++count;\n\n vals[count].type = val_double;\n vals[count].heading = counter_names[count];\n vals[count].units = counter_units[count];\n vals[count].val.d = sdv / 1.0e+9;\n vals[count].seconds = sdv / 1.0e+9;\n vals[count].resolution = 1.0e-9;\n ++count;\n\n vals[count].type = val_double;\n vals[count].heading = counter_names[count];\n vals[count].units = counter_units[count];\n vals[count].val.d = min / 1.0e+9;\n vals[count].seconds = min / 1.0e+9;\n vals[count].resolution = 1.0e-9;\n ++count;\n\n vals[count].type = val_double;\n vals[count].heading = counter_names[count];\n vals[count].units = counter_units[count];\n vals[count].val.d = max / 1.0e+9;\n vals[count].seconds = max / 1.0e+9;\n vals[count].resolution = 1.0e-9;\n ++count;\n }\n }\n}\n\nstatic void clock_set(const int timernum, void *restrict const data_,\n cTimerVal *restrict const vals) {\n papi_clock_t *restrict const data = data_;\n\n for (int i = 0; i < num_event_vals; ++i) {\n assert(vals[i].type == val_double);\n const papi_counter_t val = llrint(vals[i].val.d * 1.0e+9);\n for (int j = i; j < num_clock_vals; j += num_event_vals) {\n data->accum[j] = val;\n }\n }\n}\n\nstatic void add_clock(const char **names, const char **units, const char *name,\n const char *unit, int *clock, int nclocks) {\n DECLARE_CCTK_PARAMETERS;\n if (!define_statistics_clocks) {\n assert(*clock < nclocks);\n names[*clock] = strdup(name);\n units[*clock] = unit;\n ++*clock;\n } else {\n const char *const suffixes[] = {\"_avg\", \"_sdv\", \"_min\", \"_max\"};\n for (int s = 0; s < 4; ++s) {\n assert(*clock < nclocks);\n char buf[1000];\n snprintf(buf, sizeof buf, \"%s%s\", name, suffixes[s]);\n names[*clock] = strdup(buf);\n units[*clock] = unit;\n ++*clock;\n }\n }\n}\n\nvoid PAPI_register_clock(CCTK_ARGUMENTS) {\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n\n CCTK_INFO(\"PAPI_register_clock\");\n\n int ierr;\n\n num_event_vals = counter_begin + num_events;\n\n // PAPI clocks\n\n num_clock_vals = num_threads * num_event_vals;\n\n // Cactus clocks\n\n num_statistics_vals = define_statistics_clocks ? 4 : 1;\n num_cactus_clock_vals = num_event_vals * num_statistics_vals;\n\n counter_names = malloc(num_cactus_clock_vals * sizeof *counter_names);\n assert(counter_names);\n counter_units = malloc(num_cactus_clock_vals * sizeof *counter_units);\n assert(counter_units);\n\n int clock = 0;\n add_clock(counter_names, counter_units, \"P_time\", \"sec\", &clock,\n num_cactus_clock_vals);\n add_clock(counter_names, counter_units, \"P_cycles\", \"Gcycles\", &clock,\n num_cactus_clock_vals);\n add_clock(counter_names, counter_units, \"P_count\", \"Gevents\", &clock,\n num_cactus_clock_vals);\n for (int i = 0; i < num_events; ++i) {\n char eventname[PAPI_MAX_STR_LEN + 4];\n ierr = PAPI_event_code_to_name(events[i], eventname);\n chkerr(ierr, \"PAPI_event_code_to_name\");\n if (strlen(eventname) >= 4) {\n // Change prefix \"PAPI\" to \"P\" to save space\n for (char *p = eventname + 1; p[2]; ++p)\n p[0] = p[3];\n }\n add_clock(counter_names, counter_units, eventname, \"Gevents\", &clock,\n num_cactus_clock_vals);\n }\n assert(clock == num_cactus_clock_vals);\n\n cClockFuncs funcs;\n funcs.name = clock_name;\n funcs.n_vals = num_cactus_clock_vals;\n funcs.create = clock_create;\n funcs.destroy = clock_destroy;\n funcs.start = clock_start;\n funcs.stop = clock_stop;\n funcs.reset = clock_reset;\n funcs.get = clock_get;\n funcs.set = clock_set;\n funcs.seconds = NULL;\n ierr = CCTK_ClockRegister(clock_name, &funcs);\n assert(ierr >= 0);\n}\n",
|
| 18 |
+
"stats.h": "#ifndef STATS_H\n#define STATS_H\n\n#include <cctk.h>\n#include <cctk_Parameters.h>\n\n#include <stdarg.h>\n#include <stdio.h>\n\n#define num_threads PAPI_Cactus_num_threads\n#define eventsets PAPI_Cactus_eventsets\n#define num_events PAPI_Cactus_num_events\n#define events PAPI_Cactus_events\n\n// Number of threads\nextern int num_threads;\n// Eventsets for each thread\nextern int *restrict eventsets; // [num_threads]\n\n// Number of events in these eventsets\nextern int num_events;\n// Events in these eventsets\nextern int *restrict events; // [num_events]\n\n// Output a a debug message\n#define outinfo PAPI_Cactus_outinfo\nvoid outinfo(const char *const function);\n\n// Check for an error, and output an error message if there was one\n#define chkerr PAPI_Cactus_chkerr\nvoid chkerr(const int ierr, const char *const function, ...)\n CCTK_ATTRIBUTE_FORMAT(printf, 2, 3);\n\n#endif // #ifndef STATS_H\n"
|
| 19 |
+
},
|
| 20 |
+
"test": {
|
| 21 |
+
"papi.par": "ActiveThorns = \"PAPI\"\n\nActiveThorns = \"CartGrid3D CoordBase IOBasic IOUtil LocalReduce PUGH PUGHReduce SymBase\"\n\nIO::out_dir = $parfile\nIO::out_every = 1\nIO::out_fileinfo = \"none\"\nIO::parfile_write = \"no\"\n\nIOBasic::outScalar_vars = \"grid::r\"\nIOBasic::outScalar_reductions = \"average\"\n",
|
| 22 |
+
"papi/r_average.xg": "\"r v time\n0.0000000000000\t0.5314624890259\n1.0000000000000\t0.5314624890259\n2.0000000000000\t0.5314624890259\n3.0000000000000\t0.5314624890259\n4.0000000000000\t0.5314624890259\n5.0000000000000\t0.5314624890259\n6.0000000000000\t0.5314624890259\n7.0000000000000\t0.5314624890259\n8.0000000000000\t0.5314624890259\n9.0000000000000\t0.5314624890259\n10.0000000000000\t0.5314624890259\n"
|
| 23 |
+
},
|
| 24 |
+
"doc": {
|
| 25 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{PAPI}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the PAPI library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 26 |
+
}
|
| 27 |
+
}
|
ExternalLibraries_hwloc.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/hwloc",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn hwloc\n\nREQUIRES zlib\n\nOPTIONAL pciutils\n{\n}\n\nPROVIDES hwloc\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS HWLOC_DIR HWLOC_LIB_DIRS HWLOC_INC_DIRS HWLOC_LIBS HWLOC_EXTRA_LIBS HWLOC_INSTALL_DIR\n}\n\nREQUIRES hwloc\n",
|
| 5 |
+
"interface": "# Interface definition for thorn hwloc\n\nIMPLEMENTS: hwloc\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn hwloc\n\nSCHEDULE GROUP hwloc_startup AT startup\n{\n} \"hwloc startup group\"\n\nSCHEDULE hwloc_version IN hwloc_startup\n{\n LANG: C\n} \"Output hwloc version\"\n\n#SCHEDULE hwloc_lstopo IN hwloc_startup\n#{\n# LANG: C\n#} \"Output hardware locality information\"\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.deps": "# Main make.code.deps file for thorn HWLOC\n\nexport HWLOC_INSTALL_DIR\n\n$(CCTK_TARGET) $(OBJS) $(SRCS:%=%.d): $(SCRATCH_BUILD)/done/$(THORN)\n\nifneq ($(HWLOC_BUILD),)\n$(SCRATCH_BUILD)/done/$(THORN): $(SRCDIR)/build.sh\n\t+$(SRCDIR)/build.sh\nendif\n",
|
| 10 |
+
"make.configuration.defn": "# make.configuration.defn file for thorn hwloc\n\n# Define the hwloc utilities\nSTD_HWLOC_UTILS = hwloc-assembler hwloc-assembler-remote hwloc-bind hwloc-calc hwloc-distances hwloc-distrib hwloc-info hwloc-ls hwloc-ps lstopo lstopo-no-graphics\nHWLOC_UTILS = $(filter $(STD_HWLOC_UTILS), $(notdir $(wildcard $(HWLOC_DIR)/bin/*)))\nALL_UTILS += $(HWLOC_UTILS)\n",
|
| 11 |
+
"make.code.defn": "# Main make.code.defn file for thorn hwloc\n\nCFLAGS += -DHWLOC_UTILPATH='$(CCTK_HOME)/exe/$(notdir $(TOP))'\nCFLAGS += $(foreach V,HWLOC_VERSION_BUILD HWLOC_VERSION_PKGCONFIG HWLOC_VERSION_HWLOCINFO, $(if $($(V)),-D$(V)='\"$($(V))\"'))\n# Source files in this directory\nSRCS = version.c # lstopo.c\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 12 |
+
"version.c": "#include <hwloc.h>\n\n#include <cctk.h>\n\nint hwloc_version(void) {\n const char *library_version =\n // HWLOC_VERSION appears first in hwloc 2.1, before that one has to consult\n // the output of hwloc-info --version or pkgconfig\n#if defined(HWLOC_VERSION) // modern hwloc\n HWLOC_VERSION;\n#elif defined(HWLOC_VERSION_BUILD) // bundled copy\n HWLOC_VERSION_BUILD;\n#elif defined(HWLOC_VERSION_PKGCONFIG) // found via pkgconfig\n HWLOC_VERSION_PKGCONFIG;\n#elif defined(HWLOC_VERSION_HWLOCINFO) // found hwloc-info\n HWLOC_VERSION_HWLOCINFO;\n#else\n \"unknown\";\n#endif\n unsigned buildtime_api_version = HWLOC_API_VERSION;\n unsigned runtime_api_version = hwloc_get_api_version();\n // TODO: Check only major version number?\n if (runtime_api_version != buildtime_api_version)\n CCTK_VWARN(CCTK_WARN_ALERT,\n \"library version %s, build-time API version 0x%x, run-time API version 0x%x\",\n library_version, buildtime_api_version, runtime_api_version);\n CCTK_VINFO(\"library version %s, API version 0x%x\", library_version,\n buildtime_api_version);\n return 0;\n}\n",
|
| 13 |
+
"build.sh": "#! /bin/bash\n\n################################################################################\n# Build\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n\n# Set locations\nTHORN=hwloc\nNAME=hwloc-2.0.4\nSRCDIR=\"$(dirname $0)\"\nBUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\nif [ -z \"${HWLOC_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\nelse\n echo \"BEGIN MESSAGE\"\n echo \"Installing hwloc into ${HWLOC_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${HWLOC_INSTALL_DIR}\nfi\nDONE_FILE=${SCRATCH_BUILD}/done/${THORN}\nHWLOC_DIR=${INSTALL_DIR}\n\n# Set up environment\nexport CPPFLAGS=\"${CPPFLAGS} $(echo $(for dir in ${SYS_INC_DIRS}; do echo '' -I${dir}; done))\"\nexport LDFLAGS=\"${LDFLAGS} $(echo $(for dir in ${LIBDIRS}; do echo '' -L${dir} -Wl,-rpath,${dir}; done))\"\nunset CPP\nunset LIBS\nunset LD\nif echo '' ${ARFLAGS} | grep 64 > /dev/null 2>&1; then\n export OBJECT_MODE=64\nfi\nexport HWLOC_PCIUTILS_CFLAGS=\"$(echo '' $(for dir in ${PCIUTILS_INC_DIRS} ${ZLIB_INC_DIRS}; do echo '' $dir; done | sed -e 's/^ /-I/'))\"\nexport HWLOC_PCIUTILS_LIBS=\"$(echo '' $(for dir in ${PCIUTILS_LIB_DIRS} ${ZLIB_LIB_DIRS}; do echo '' $dir; done | sed -e 's/^ /-L/') $(for dir in ${PCIUTILS_LIBS} ${ZLIB_LIBS}; do echo '' $dir; done | sed -e 's/^ /-l/'))\"\necho \"hwloc: Preparing directory structure...\"\ncd ${SCRATCH_BUILD}\nmkdir build external done 2> /dev/null || true\nrm -rf ${BUILD_DIR} ${INSTALL_DIR}\nmkdir ${BUILD_DIR} ${INSTALL_DIR}\n\necho \"hwloc: Unpacking archive...\"\npushd ${BUILD_DIR}\n${TAR?} xzf ${SRCDIR}/../dist/${NAME}.tar.gz\n\necho \"hwloc: Configuring...\"\ncd ${NAME}\n# Provide a special option for Blue Gene/Q; this is a cross-compile,\n# so we can't easily detect this automatically\nif echo ${CC} | grep -q bgxlc; then\n bgq='--host=powerpc64-bgq-linux'\nelse\n bgq=''\nfi\n# Disable Cairo and XML explicitly, since configure may pick it up if\n# it is installed on the system, but our final link line may not link\n# against these libraries. (We could use our own libxml2 library if we\n# want.)\nif test -n \"${HAVE_CAPABILITY_PCIUTILS}\"; then\n handle_pci='--enable-libpci'\nelse\n handle_pci='--disable-pci'\nfi\n## Disable pciaccess by forcing compiler errors\n#export HWLOC_PCIACCESS_CFLAGS=DISABLE-PCIACCESS\n./configure --prefix=${HWLOC_DIR} ${bgq} ${handle_pci} --disable-cairo --disable-libxml2 --disable-cuda --disable-nvml --disable-opencl --with-x=no --disable-gl --enable-shared=no --enable-static=yes\n\necho \"hwloc: Building...\"\n${MAKE}\n\necho \"hwloc: Installing...\"\n${MAKE} install\npopd\n\necho \"hwloc: Cleaning up...\"\nrm -rf ${BUILD_DIR}\n\ndate > ${DONE_FILE}\necho \"hwloc: Done.\"\n",
|
| 14 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n################################################################################\n# Search\n################################################################################\n\nif [ -z \"${HWLOC_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"hwloc selected, but HWLOC_DIR not set. Checking some places...\"\n echo \"END MESSAGE\"\n \n # Check whether pkg-config works\n export PKG_CONFIG_PATH=pkgconfig:${PCIUTILS_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}\n if pkg-config hwloc; then\n # Check that version is sufficient\n # we negate the return code since in perl true == 1 but for the shell true == 0\n if pkg-config --modversion hwloc | \n perl -ne 'm/^0*(\\d+)[.]0*(\\d+)/; exit !($1>1 or $1==1 and $2>=6)' ; then \n inc_dirs=\"$(pkg-config hwloc --static --cflags 2>/dev/null || pkg-config hwloc --cflags)\"\n lib_dirs=\"$(pkg-config hwloc --static --libs 2>/dev/null || pkg-config hwloc --libs)\"\n libs=\"$(pkg-config hwloc --static --libs 2>/dev/null || pkg-config hwloc --libs)\"\n # Translate option flags into Cactus options:\n # - for INC_DIRS, remove -I prefix from flags\n # - for LIB_DIRS, remove all -l flags, and remove -L prefix from flags\n # - for LIBS, keep only -l flags, and remove -l prefix from flags\n HWLOC_INC_DIRS=\"$(echo '' $(for flag in $inc_dirs; do echo '' $flag; done | sed -e 's/^ -I//'))\"\n HWLOC_LIB_DIRS=\"$(echo '' $(for flag in $lib_dirs; do echo '' $flag; done | grep -v '^ -l' | sed -e 's/^ -L//'))\"\n HWLOC_LIBS=\"$(echo '' $(for flag in $libs; do echo '' $flag; done | grep '^ -l' | sed -e 's/^ -l//'))\"\n HWLOC_DIR=\"$(echo ${HWLOC_INC_DIRS} NO_BUILD | sed 's!/[^/]* .*!!')\"\n HWLOC_VERSION_PKGCONFIG=$(pkg-config --modversion hwloc)\n else\n echo \"BEGIN MESSAGE\"\n echo \"hwloc in ${HWLOC_DIR} too old (require at least version 1.6)\"\n echo \"END MESSAGE\" \n fi\n else\n echo \"BEGIN MESSAGE\"\n echo \"pkg-config not found; attempting to use reasonable defaults\"\n echo \"END MESSAGE\"\n \n DIRS=\"/usr /usr/local /usr/local/packages /usr/local/apps /opt/local ${HOME} c:/packages\"\n for dir in $DIRS; do\n # libraries might have different file extensions\n for libext in a dll dll.a so dylib lib so; do\n # libraries can be in /lib or /lib64 (or libx32?)\n for libdir in lib64 lib/x86_64-linux-gnu lib lib/i386-linux-gnu; do\n FILES=\"include/hwloc.h $libdir/libhwloc.$libext\"\n # assume this is the one and check all needed files\n HWLOC_DIR=\"$dir\"\n HWLOC_LIB_DIRS=\"$dir/$libdir\"\n HWLOC_INC_DIRS=\"$dir/include\"\n for file in $FILES; do\n # discard this directory if one file was not found\n if [ ! -r \"$dir/$file\" ]; then\n unset HWLOC_DIR\n unset HWLOC_LIB_DIRS\n unset HWLOC_INC_DIRS\n break\n fi\n done\n # Check that version is sufficient\n if [ -r ${HWLOC_INC_DIRS}/hwloc.h ] &&\n perl -ne 'exit !($1 lt \"0x00010600\") if m/^#define HWLOC_API_VERSION (.*)/' \\\n ${HWLOC_INC_DIRS}/hwloc.h ; then\n echo \"BEGIN MESSAGE\"\n echo \"hwloc in ${HWLOC_DIR} too old (require at least version 1.6)\"\n echo \"END MESSAGE\"\n unset HWLOC_DIR\n unset HWLOC_LIB_DIRS\n unset HWLOC_INC_DIRS\n fi\n # don't look further if all files have been found\n if [ -n \"$HWLOC_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$HWLOC_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$HWLOC_DIR\" ]; then\n break\n fi\n done\n fi\n \n if [ -z \"$HWLOC_DIR\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"hwloc not found\"\n echo \"END MESSAGE\"\n else\n echo \"BEGIN MESSAGE\"\n echo \"Found hwloc in ${HWLOC_DIR}\"\n echo \"END MESSAGE\"\n fi\nfi\n\nTHORN=hwloc\n\n################################################################################\n# Build\n################################################################################\n\nif [ -z \"${HWLOC_DIR}\" \\\n -o \"$(echo \"${HWLOC_DIR}\" | tr '[a-z]' '[A-Z]')\" = 'BUILD' ]\nthen\n echo \"BEGIN MESSAGE\"\n echo \"Using bundled hwloc...\"\n echo \"END MESSAGE\"\n \n # Check for required tools. Do this here so that we don't require\n # them when using the system library.\n if [ \"x$TAR\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find tar command.'\n echo 'Please make sure that the (GNU) tar command is present,'\n echo 'and that the TAR variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n if [ \"x$PATCH\" = x ] ; then\n echo 'BEGIN ERROR'\n echo 'Could not find patch command.'\n echo 'Please make sure that the patch command is present,'\n echo 'and that the PATCH variable is set to its location.'\n echo 'END ERROR'\n exit 1\n fi\n\n # Set locations\n NAME=hwloc-2.0.4\n SRCDIR=\"$(dirname $0)\"\n BUILD_DIR=${SCRATCH_BUILD}/build/${THORN}\n if [ -z \"${HWLOC_INSTALL_DIR}\" ]; then\n INSTALL_DIR=${SCRATCH_BUILD}/external/${THORN}\n else\n echo \"BEGIN MESSAGE\"\n echo \"Installing hwloc into ${HWLOC_INSTALL_DIR}\"\n echo \"END MESSAGE\"\n INSTALL_DIR=${HWLOC_INSTALL_DIR}\n fi\n HWLOC_BUILD=1\n HWLOC_DIR=${INSTALL_DIR}\n HWLOC_INC_DIRS=\"${HWLOC_DIR}/include\"\n HWLOC_LIB_DIRS=\"${HWLOC_DIR}/lib\"\n HWLOC_LIBS='hwloc'\n HWLOC_VERSION_BUILD=${NAME#*-}\nelse\n HWLOC_BUILD=\n DONE_FILE=${SCRATCH_BUILD}/done/${THORN}\n if [ ! -e ${DONE_FILE} ]; then\n mkdir ${SCRATCH_BUILD}/done 2> /dev/null || true\n date > ${DONE_FILE}\n fi\n \n if [ \"${HWLOC_DIR}\" != 'NO_BUILD' ]; then\n : ${HWLOC_INC_DIRS=\"${HWLOC_DIR}/include\"}\n : ${HWLOC_LIB_DIRS=\"${HWLOC_DIR}/lib\"}\n fi\n : ${HWLOC_LIBS='hwloc'}\n\n if [ \"${HWLOC_DIR}\" = 'NO_BUILD' ]; then\n HWLOC_INFO_EXE=hwloc-info\n else\n HWLOC_INFO_EXE=\"${HWLOC_DIR}/bin/hwloc-info\"\n fi\n if $HWLOC_INFO_EXE --version &>/dev/null ; then\n HWLOC_VERSION_HWLOCINFO=\"$($HWLOC_INFO_EXE --version 2>/dev/null | perl -ne 'm/(.*) (.*)/;print $2')\"\n fi\n\n # Add libnuma manually, if necessary\n for hwloc_lib_dir in ${HWLOC_LIB_DIRS} ; do\n if grep -q '[-]lnuma' ${hwloc_lib_dir}/libhwloc.la 2>/dev/null; then\n if ! echo '' ${HWLOC_LIBS} '' | grep -q ' numa '; then\n HWLOC_LIBS=\"${HWLOC_LIBS} numa\"\n fi\n fi\n done\nfi\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# Pass configuration options to build script\necho \"BEGIN MAKE_DEFINITION\"\necho \"HWLOC_BUILD = ${HWLOC_BUILD}\"\necho \"HWLOC_INSTALL_DIR = ${HWLOC_INSTALL_DIR}\"\necho \"END MAKE_DEFINITION\"\n\nHWLOC_INC_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${HWLOC_INC_DIRS})\"\nHWLOC_LIB_DIRS=\"$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${HWLOC_LIB_DIRS})\"\nHWLOC_LIBS=\"${HWLOC_LIBS} ${HWLOC_EXTRA_LIBS}\"\n\n# Pass options to Cactus\necho \"BEGIN MAKE_DEFINITION\"\necho \"HWLOC_DIR = ${HWLOC_DIR}\"\necho \"HWLOC_INC_DIRS = ${HWLOC_INC_DIRS}\"\necho \"HWLOC_LIB_DIRS = ${HWLOC_LIB_DIRS}\"\necho \"HWLOC_LIBS = ${HWLOC_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\n# Pass version information to Cactus in case it is not included in hwloc.h (for\n# versions less than 2.1)\necho \"BEGIN MAKE_DEFINITION\"\necho \"HWLOC_VERSION_PKGCONFIG = ${HWLOC_VERSION_PKGCONFIG}\"\necho \"HWLOC_VERSION_HWLOCINFO = ${HWLOC_VERSION_HWLOCINFO}\"\necho \"HWLOC_VERSION_BUILD = ${HWLOC_VERSION_BUILD}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(HWLOC_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(HWLOC_LIB_DIRS)'\necho 'LIBRARY $(HWLOC_LIBS)'\n",
|
| 15 |
+
"make.configuration.deps": "# make.configuration.deps file for thorn hwloc\n\n# The hwloc utilities are copied from the install directory\n\n$(patsubst %,$(UTIL_DIR)/%,$(HWLOC_UTILS)): $(UTIL_DIR)/% : $(HWLOC_DIR)/bin/%\n\t@echo \"Copying $* from $< to $(UTIL_DIR)\"\n\t-$(MKDIR) $(MKDIRFLAGS) $(UTIL_DIR) 2> /dev/null\n\tcp $< $@\n",
|
| 16 |
+
"lstopo.c": "#include <cctk.h>\n#include <stdlib.h>\n\n#define XSTR(x) #x\n#define STR(x) XSTR(x)\n\nint hwloc_lstopo(void) {\n if (CCTK_MyProc(NULL) == 0) {\n CCTK_INFO(\"Hardware locality information:\");\n CCTK_INFO(STR(HWLOC_UTILPATH) \"/lstopo -v\");\n system(STR(HWLOC_UTILPATH) \"/lstopo -v\");\n }\n return 0;\n}\n"
|
| 17 |
+
},
|
| 18 |
+
"test": {},
|
| 19 |
+
"doc": {
|
| 20 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{hwloc}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the hwloc library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n\n"
|
| 21 |
+
}
|
| 22 |
+
}
|
ExternalLibraries_libjpeg.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/libjpeg",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn libjpeg\n\nPROVIDES libjpeg\n{\n SCRIPT configure.sh\n LANG bash\n OPTIONS LIBJPEG_INSTALL_DIR LIBJPEG_DIR\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn libjpeg\n\nIMPLEMENTS: libjpeg\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn libjpeg\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn libjpeg\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n"
|
| 10 |
+
},
|
| 11 |
+
"test": {},
|
| 12 |
+
"doc": {
|
| 13 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{libjpeg}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the libjpeg library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 14 |
+
}
|
| 15 |
+
}
|
ExternalLibraries_pthreads.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/pthreads",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn PTHREADS\n\nPROVIDES PTHREADS\n{\n SCRIPT src/detect.sh\n LANG bash\n OPTIONS PTHREADS PTHREADS_DIR PTHREADS_INC_DIRS PTHREADS_LIB_DIRS PTHREADS_LIBS\n}\n\nREQUIRES PTHREADS\n",
|
| 5 |
+
"interface": "# Interface definition for thorn PTHREADS\n\nIMPLEMENTS: PTHREADS\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn PTHREADS\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn PTHREADS\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 10 |
+
"detect.sh": "#! /bin/bash\n\n################################################################################\n# Prepare\n################################################################################\n\n# Set up shell\nif [ \"$(echo ${VERBOSE} | tr '[:upper:]' '[:lower:]')\" = 'yes' ]; then\n set -x # Output commands\nfi\nset -e # Abort on errors\n\n\n################################################################################\n# Check for old mechanism\n################################################################################\n\nif [ -n \"${PTHREADS}\" ]; then\n echo 'BEGIN ERROR'\n echo \"Setting the option \\\"PTHREADS\\\" is incompatible with the Pthreads thorn. Please remove the option PTHREADS=${PTHREADS}.\"\n echo 'END ERROR'\n exit 1\nfi\n\n\n\n################################################################################\n# Set default libraries to link if nothing provided by user\n################################################################################\n: ${PTHREADS_LIBS=pthread}\n\n################################################################################\n# Search\n################################################################################\n\nif [ -z \"${PTHREADS_DIR}\" ]; then\n echo \"BEGIN MESSAGE\"\n echo \"PTHREADS selected, but PTHREADS_DIR not set. Checking some places...\"\n echo \"END MESSAGE\"\n \n # We look in these directories\n DIRS=\"/usr /usr/local /opt/local ${HOME} c:/packages/PTHREADS\"\n # look into each directory\n for dir in $DIRS; do\n # libraries might have different file extensions\n for libext in a so dylib; do\n # libraries can be in /lib or /lib64\n for libdir in lib64 lib lib/x86_64-linux-gnu lib/i386-linux-gnu lib/arm-linux-gnueabihf; do\n # These files must exist\n FILES=\"include/pthread.h $(for lib in ${PTHREADS_LIBS}; do echo ${libdir}/lib${lib}.${libext}; done)\"\n # assume this is the one and check all needed files\n PTHREADS_DIR=\"$dir\"\n for file in $FILES; do\n # discard this directory if one file was not found\n if [ ! -r \"$dir/$file\" ]; then\n unset PTHREADS_DIR\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PTHREADS_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PTHREADS_DIR\" ]; then\n break\n fi\n done\n # don't look further if all files have been found\n if [ -n \"$PTHREADS_DIR\" ]; then\n break\n fi\n done\n \n if [ -z \"$PTHREADS_DIR\" ]; then\n echo \"BEGIN ERROR\"\n echo \"Did not find PTHREADS\"\n echo \"END ERROR\"\n exit 1\n else\n echo \"BEGIN MESSAGE\"\n echo \"Found PTHREADS in ${PTHREADS_DIR}\"\n echo \"END MESSAGE\"\n fi\nfi\n\n\n\n################################################################################\n# Configure Cactus\n################################################################################\n\n# PTHREADS_LIBS and PTHREADS_DIR are already set; set remaining unset\n# options based on these\nif [ \"x$PTHREADS_DIR\" != xNO_BUILD ] ; then\n : ${PTHREADS_INC_DIRS=\"${PTHREADS_DIR}/include\"}\n : ${PTHREADS_LIB_DIRS=\"${PTHREADS_DIR}/lib\"}\nfi\nPTHREADS_INC_DIRS=$(${CCTK_HOME}/lib/sbin/strip-incdirs.sh ${PTHREADS_INC_DIRS})\nPTHREADS_LIB_DIRS=$(${CCTK_HOME}/lib/sbin/strip-libdirs.sh ${PTHREADS_LIB_DIRS})\n\n# Pass options to Cactus\necho \"BEGIN DEFINE\"\necho \"CCTK_PTHREADS 1\"\necho \"END DEFINE\"\n\necho \"BEGIN MAKE_DEFINITION\"\necho \"PTHREADS_DIR = ${PTHREADS_DIR}\"\necho \"PTHREADS_INC_DIRS = ${PTHREADS_INC_DIRS}\"\necho \"PTHREADS_LIB_DIRS = ${PTHREADS_LIB_DIRS}\"\necho \"PTHREADS_LIBS = ${PTHREADS_LIBS}\"\necho \"END MAKE_DEFINITION\"\n\necho 'INCLUDE_DIRECTORY $(PTHREADS_INC_DIRS)'\necho 'LIBRARY_DIRECTORY $(PTHREADS_LIB_DIRS)'\necho 'LIBRARY $(PTHREADS_LIBS)'\n"
|
| 11 |
+
},
|
| 12 |
+
"test": {},
|
| 13 |
+
"doc": {
|
| 14 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{pthreads}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the pthreads library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 15 |
+
}
|
| 16 |
+
}
|
ExternalLibraries_zlib.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "ExternalLibraries/zlib",
|
| 3 |
+
"url": "https://github.com/EinsteinToolkit/$1-$2.git/branches/$ET_RELEASE",
|
| 4 |
+
"configuration": "# Configuration definitions for thorn zlib\n\nPROVIDES zlib\n{\n SCRIPT configure.sh\n LANG bash\n OPTIONS ZLIB_DIR ZLIB_INSTALL_DIR\n}\n",
|
| 5 |
+
"interface": "# Interface definition for thorn zlib\n\nIMPLEMENTS: zlib\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn zlib\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn zlib\n\n# Source files in this directory\nSRCS = \n\n# Subdirectories containing source files\nSUBDIRS = \n"
|
| 10 |
+
},
|
| 11 |
+
"test": {},
|
| 12 |
+
"doc": {
|
| 13 |
+
"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% relevant 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 separated with a \\\\ or a comma.\n% - You can define your own macros, but they must appear after\n% the START CACTUS THORNGUIDE line, and must 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 graphicx 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 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% - Do not use \\appendix, instead include any appendices you need as\n% standard sections.\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{Federico Cipolletta, Roland Haas}\n\n% The title of the document (not necessarily the name of the Thorn)\n\\title{zlib}\n\n% the date your document was last changed, if your document is in CVS,\n% please use:\n% \\date{$ $Date$ $}\n% when using git instead record the commit ID:\n% \\date{$ $Id$ $}\n% and add this line to your repos' .gitattributes file:\n% **.tex ident\n\\date{2020-07-01}\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}\nThis thorn provides access to the zlib library.\n\\end{abstract}\n\n% The following sections are suggestive only.\n% Remove them or add your own.\n\n\\section{Using This Thorn}\n\nRefer to the Cactus UserGuide, Sec. B2.2, in order to know how this thorn can be used in a compiled configuration and how to possibly linking another specific version, already installed steparately.\n\n\\subsection*{Note on possible ExternalLibraries' location stripping}\n\\label{stripping}\n\nEach thorn contained in \\texttt{Cactus/arrangements/ExternalLibraries} will automatically adopt the library version contained in the \\texttt{Cactus/arrangements/<library>/dist} folder. In particular, the tarball in \\texttt{Cactus/arrangements/<library>/dist} is only used if either \\texttt{THORN\\_DIR} is set to \\texttt{BUILD} or is left empty and no precompiled copy of the library is found. If another location is specified via the \\texttt{THORN\\_DIR} variable in the \\texttt{<machine>.cfg} file at compilation, then the \\texttt{Cactus/lib/sbin/strip-incdirs.sh} script will automatically strip away (for safety reasons) the locations:\n\\begin{Lentry}\n\\item [\\texttt{/include}]\n\\item [\\texttt{/usr/include}]\n\\item [\\texttt{/usr/local/include}]\n\\end{Lentry}\nfrom \\texttt{THORN\\_INC\\_DIRS} which default to \\texttt{THORN\\_DIR/include}. Therefore, if there is any need for using one already installed version of one external library, the aforementioned location should be avoided (e.g. indicating \\texttt{/home} as the \\texttt{THORN\\_DIR} will work with no problems if the required library is installed there) or should be carefully checked, in order to avoid unwanted stripping. The same stripping happens to \\texttt{THORN\\_LIB\\_DIRS} in \\texttt{lib/sbin/strip-libdirs.sh} with a larger list of directories:\n\\begin{Lentry}\n\\item [\\texttt{/lib}]\n\\item [\\texttt{/usr/lib}]\n\\item [\\texttt{/usr/local/lib}]\n\\item [\\texttt{/lib64}]\n\\item [\\texttt{/usr/lib64}]\n\\item [\\texttt{/usr/local/lib64}] \n\\end{Lentry}\n\n% Do not delete next line\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 14 |
+
}
|
| 15 |
+
}
|
Llama_ADMDerivatives.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "Llama/ADMDerivatives",
|
| 3 |
+
"url": "https://bitbucket.org/llamacode/llama.git",
|
| 4 |
+
"configuration": "REQUIRES THORNS: SummationByParts\n",
|
| 5 |
+
"interface": "# Interface definition for thorn ADMDerivatives\n# $Header:$\n\nimplements: ADMDerivatives\ninherits: Coordinates ADMBase \n\n\nuses include: loopcontrol.h\nuses include: GlobalDerivative.h\n\n\n\n# Specify whether multipatch supports Thornburg04 6-patch system\nCCTK_INT FUNCTION \\\n MultiPatch_ProvidesThornburg04 \\\n ()\nUSES FUNCTION MultiPatch_ProvidesThornburg04\n\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetMap \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nUSES FUNCTION MultiPatch_GetMap\n \nCCTK_INT FUNCTION \\\n MultiPatch_GetBbox \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY bbox)\nUSES FUNCTION MultiPatch_GetBbox\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetBoundarySpecification \\\n (CCTK_INT IN map, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY nboundaryzones, \\\n CCTK_INT OUT ARRAY is_internal, \\\n CCTK_INT OUT ARRAY is_staggered, \\\n CCTK_INT OUT ARRAY shiftout)\nUSES FUNCTION MultiPatch_GetBoundarySpecification\n\nSUBROUTINE Diff_coeff ( CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN dir, \\\n CCTK_INT IN nsize, \\\n CCTK_INT OUT ARRAY imin, \\\n CCTK_INT OUT ARRAY imax, \\\n CCTK_REAL OUT ARRAY q, \\\n CCTK_INT IN table_handle )\nUSES FUNCTION Diff_coeff\n\n\n### From CactusBase/SymBase\n\nCCTK_INT FUNCTION \\\n SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH)\nREQUIRES FUNCTION SymmetryTableHandleForGrid\n\n### From CoordBase\n\nCCTK_INT FUNCTION \\\n GetBoundarySpecification (CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY nboundaryzones, \\\n CCTK_INT OUT ARRAY is_internal, \\\n CCTK_INT OUT ARRAY is_staggered, \\\n CCTK_INT OUT ARRAY shiftout)\nUSES FUNCTION GetBoundarySpecification\n\n\nCCTK_INT FUNCTION Boundary_SelectVarForBC(CCTK_POINTER_TO_CONST IN GH, \\\n CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, \\\n CCTK_STRING IN var_name, CCTK_STRING IN bc_name)\nCCTK_INT FUNCTION Boundary_SelectGroupForBC(CCTK_POINTER_TO_CONST IN GH, \\\n CCTK_INT IN faces, CCTK_INT IN boundary_width, CCTK_INT IN table_handle, \\\n CCTK_STRING IN group_name, CCTK_STRING IN bc_name)\n\nREQUIRES FUNCTION Boundary_SelectVarForBC\nREQUIRES FUNCTION Boundary_SelectGroupForBC\n\n\nPUBLIC:\n\n\nREAL dr_lapse TYPE=GF TIMELEVELS=3 TAGS='checkpoint=\"no\" prolongation=\"none\" tensortypealias=\"Scalar\"'\n{\n alp_dr\n} \"Radial derivatives of ADM lapse\"\n\n\nREAL dr_shift TYPE=GF TIMELEVELS=3 TAGS='checkpoint=\"no\" prolongation=\"none\" tensortypealias=\"U\"'\n{\n betax_dr, betay_dr, betaz_dr\n} \"Radial derivatives of ADM shift\"\n\n\nREAL dr_metric TYPE=GF TIMELEVELS=3 TAGS='checkpoint=\"no\" prolongation=\"none\" tensortypealias=\"DD_sym\"'\n{\n gxx_dr, gxy_dr, gxz_dr\n gyy_dr, gyz_dr\n gzz_dr\n} \"Radial derivatives of ADM 3-metric\"\n\n\nREAL dx_vars TYPE=GF TIMELEVELS=1 TAGS='checkpoint=\"no\" prolongation=\"none\"'\n{\n alp_dx\n betax_dx, betay_dx, betaz_dx\n gxx_dx, gxy_dx, gxz_dx\n gyy_dx, gyz_dx\n gzz_dx\n alp_dy\n betax_dy, betay_dy, betaz_dy\n gxx_dy, gxy_dy, gxz_dy\n gyy_dy, gyz_dy\n gzz_dy\n alp_dz\n betax_dz, betay_dz, betaz_dz\n gxx_dz, gxy_dz, gxz_dz\n gyy_dz, gyz_dz\n gzz_dz\n} \"Cartesian derivatives of ADM lapse, shift, 3-metric\"\n\n\n\nREAL dt_metric TYPE=GF TIMELEVELS=3 TAGS='checkpoint=\"no\" prolongation=\"none\" tensortypealias=\"DD_sym\"'\n{\n gxx_dt, gxy_dt, gxz_dt\n gyy_dt, gyz_dt\n gzz_dt\n} \"Time derivatives of ADM 3-metric\"\n\n\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn ADMDerivatives\n# $Header:$\n\n\nif (store_radial_derivatives)\n{\n if (timelevels == 1)\n {\n STORAGE: dr_lapse[1]\n STORAGE: dr_shift[1]\n STORAGE: dr_metric[1]\n }\n if (timelevels == 3)\n {\n STORAGE: dr_lapse[3]\n STORAGE: dr_shift[3]\n STORAGE: dr_metric[3]\n }\n}\n\nif (store_time_derivatives)\n{\n if (timelevels == 1)\n {\n STORAGE: dt_metric[1]\n }\n if (timelevels == 3)\n {\n STORAGE: dt_metric[3]\n }\n}\n\n\nif (store_cartesian_derivatives)\n{\n STORAGE: dx_vars\n}\n\n\nSCHEDULE GROUP ADMDerivatives_Group AT CCTK_POSTSTEP\n{\n} \"Group for ADMDerivatives computations.\"\n\n\nSCHEDULE GROUP ADMDerivatives_Group AT CCTK_POST_RECOVER_VARIABLES\n{\n} \"Group for ADMDerivatives computations.\"\n\n\nSCHEDULE ADMDerivatives_CalcDerivatives IN ADMDerivatives_Group\n{\n LANG: C\n OPTIONS: LOCAL\n} \"Calculate requested derivatives of ADM lapse, shift, 3-metric\"\n\n\n\nif (synchronize)\n{\n\n# This bin applies all (Cactus) boundary and symmetry conditions\nSCHEDULE GROUP ApplyBCs as ADMDerivatives_ApplyBCs IN ADMDerivatives_Group AFTER (ADMDerivatives_radial_SelectBC ADMDerivatives_cartesian_SelectBC ADMDerivatives_time_SelectBC)\n{\n} \"Apply boundary conditions controlled by thorn Boundary\"\n\n\nif (store_radial_derivatives)\n{\n SCHEDULE ADMDerivatives_radial_SelectBC IN ADMDerivatives_Group AFTER ADMDerivatives_CalcDerivatives\n {\n OPTIONS: LEVEL\n LANG: C\n SYNC: ADMDerivatives::dr_lapse\n SYNC: ADMDerivatives::dr_shift\n SYNC: ADMDerivatives::dr_metric\n } \"Selecting BC for metric radial derivatives\" \n}\n\nif (store_cartesian_derivatives)\n{\n SCHEDULE ADMDerivatives_cartesian_SelectBC IN ADMDerivatives_Group AFTER ADMDerivatives_CalcDerivatives\n {\n OPTIONS: LEVEL\n LANG: C\n SYNC: ADMDerivatives::dx_vars\n } \"Selecting BC for metric cartesian derivatives\" \n}\n\n\nif (store_time_derivatives)\n{\n SCHEDULE ADMDerivatives_time_SelectBC IN ADMDerivatives_Group AFTER ADMDerivatives_CalcDerivatives\n {\n OPTIONS: LEVEL\n LANG: C\n SYNC: ADMDerivatives::dt_metric\n } \"Selecting BC for metric time derivatives\" \n}\n\n}\n\n\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn ADMDerivatives\n# $Header:$\n\n# Source files in this directory\nSRCS = calc_derivs.cc sync.cc grids.cc\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 10 |
+
"sync.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Functions.h\"\n\n\nextern \"C\" void ADMDerivatives_radial_SelectBC(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n \n CCTK_INT faces;\n \n int ierr = 0;\n\n faces = CCTK_ALL_FACES;\n\n if (store_radial_derivatives)\n {\n ierr += Boundary_SelectGroupForBC(cctkGH, faces, 1, -1,\n \"ADMDerivatives::dr_lapse\", \"None\");\n ierr += Boundary_SelectGroupForBC(cctkGH, faces, 1, -1,\n \"ADMDerivatives::dr_shift\", \"None\");\n ierr += Boundary_SelectGroupForBC(cctkGH, faces, 1, -1,\n \"ADMDerivatives::dr_metric\", \"None\");\n }\n \n if (ierr)\n CCTK_WARN(1, \"Error selecting BCs!\");\n}\n\n\n\nextern \"C\" void ADMDerivatives_cartesian_SelectBC(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n \n CCTK_INT faces;\n \n int ierr = 0;\n\n faces = CCTK_ALL_FACES;\n\n if (store_cartesian_derivatives)\n {\n ierr += Boundary_SelectGroupForBC(cctkGH, faces, 1, -1,\n \"ADMDerivatives::dx_vars\", \"None\");\n }\n \n if (ierr)\n CCTK_WARN(1, \"Error selecting BCs!\");\n}\n\n\n\nextern \"C\" void ADMDerivatives_time_SelectBC(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n \n CCTK_INT faces;\n \n int ierr = 0;\n\n faces = CCTK_ALL_FACES;\n\n if (store_time_derivatives)\n {\n ierr += Boundary_SelectGroupForBC(cctkGH, faces, 1, -1,\n \"ADMDerivatives::dt_metric\", \"None\");\n }\n \n if (ierr)\n CCTK_WARN(1, \"Error selecting BCs!\");\n}\n\n",
|
| 11 |
+
"calc_derivs.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Functions.h\"\n#include <assert.h>\n#include <iostream>\n\n#include \"loopcontrol.h\"\n\n#include \"GlobalDerivative.h\"\n#include \"grids.hh\"\n\nusing namespace std;\n\n\n#define invert_metric(g11, g12, g13, g22, g23, g33, detg, \\\n ig11, ig12, ig13, ig22, ig23, ig33) \\\n do \\\n { \\\n CCTK_REAL detg11 = g22*g33 - g23*g23; \\\n CCTK_REAL detg12 = g13*g23 - g12*g33; \\\n CCTK_REAL detg13 = g12*g23 - g13*g22; \\\n CCTK_REAL detg22 = g11*g33 - g13*g13; \\\n CCTK_REAL detg23 = g12*g13 - g11*g23; \\\n CCTK_REAL detg33 = g11*g22 - g12*g12; \\\n \\\n detg = detg11*g11 + detg12*g12 + detg13*g13; \\\n \\\n ig11 = detg11 / detg; \\\n ig12 = detg12 / detg; \\\n ig13 = detg13 / detg; \\\n ig22 = detg22 / detg; \\\n ig23 = detg23 / detg; \\\n ig33 = detg33 / detg; \\\n } \\\n while (0)\n\n\n\nextern \"C\" void ADMDerivatives_CalcDerivatives(CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS\n DECLARE_CCTK_PARAMETERS\n \n bool radial_coordinate = false;\n \n // calculate radial derivative\n /*if (CCTK_IsFunctionAliased(\"MultiPatch_ProvidesThornburg04\"))\n {\n if (MultiPatch_ProvidesThornburg04())\n {\n int map = MultiPatch_GetMap(cctkGH);\n // don't do anything on Cartesian map\n //if (map != 0) // we would also have to check for sphere_inner_radius...for now we assume the user knows that the extraction slice has to be on spherical grid\n radial_coordinate = true;\n \n }\n }*/\n \n \n CCTK_INT* imin[3];\n CCTK_INT* imax[3];\n CCTK_REAL* q[3];\n int ni = cctk_lsh[0]; \n int nj = cctk_lsh[1];\n int nk = cctk_lsh[2];\n \n CCTK_REAL ihx = 1.0 / CCTK_DELTA_SPACE(0);\n CCTK_REAL ihy = 1.0 / CCTK_DELTA_SPACE(1);\n CCTK_REAL ihz = 1.0 / CCTK_DELTA_SPACE(2);\n \n int orig_fd_order =\n *(const CCTK_INT*)CCTK_ParameterGet(\"order\", \"SummationByParts\", NULL);\n \n if (spatial_deriv_order > 0)\n {\n ostringstream fd_order_str;\n fd_order_str << spatial_deriv_order;\n CCTK_ParameterSet(\"order\", \"SummationByParts\", fd_order_str.str().c_str());\n }\n \n for (int i=0; i<3; ++i)\n {\n int n = cctk_lsh[i];\n imin[i] = new CCTK_INT[n];\n imax[i] = new CCTK_INT[n];\n q[i] = new CCTK_REAL[n*n];\n\n if ((imin[i]==NULL) || (imax[i]==NULL) || (q[i]==NULL))\n CCTK_WARN(0, \"Could not allocated derivative coefficient arrays.\");\n\n Diff_coeff(cctkGH, i, n, imin[i], imax[i], q[i], -1);\n\n for (int j=0; j<n; ++j)\n {\n imin[i][j] -= 1;\n imax[i][j] -= 1;\n }\n }\n \n if (spatial_deriv_order > 0)\n {\n ostringstream fd_order_str;\n fd_order_str << orig_fd_order;\n CCTK_ParameterSet(\"order\", \"SummationByParts\", fd_order_str.str().c_str());\n }\n \n CCTK_INT istart[3], iend[3];\n\n ADMDerivatives_GetGridRanges(cctkGH, istart, iend);\n \n if (store_radial_derivatives || store_cartesian_derivatives || store_time_derivatives)\n {\n if (!radial_coordinate)\n { \n // we would have to make use of Jacobains to transform to a radial coordinate system\n#pragma omp parallel\n LC_LOOP3 (ADMDerivatives_CalcDerivatives,\n i, j, k,\n istart[0], istart[1], istart[2],\n iend[0], iend[1], iend[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ijk = CCTK_GFINDEX3D(cctkGH, i, j, k);\n \n // calculate derivatives \\partial_i \\beta^j\n CCTK_REAL dxBetax(0), dxBetay(0), dyBetax(0), dxBetaz(0), dzBetax(0);\n CCTK_REAL dyBetay(0), dyBetaz(0), dzBetay(0), dzBetaz(0);\n CCTK_REAL dxalp(0), dyalp(0), dzalp(0);\n \n CCTK_REAL dadx=1, dbdx=0, dcdx=0, dady=0, dbdy=1, dcdy=0, dadz=0,\n dbdz=0, dcdz=1;\n\n CCTK_REAL dg[3][3][3], detg;\n\n#include \"derivatives.h\"\n \n if (store_radial_derivatives)\n {\n const CCTK_REAL irad = 1.0/sqrt(x[ijk]*x[ijk] + y[ijk]*y[ijk] + z[ijk]*z[ijk]);\n \n alp_dr[ijk] = irad * (x[ijk]*dxalp + y[ijk]*dyalp + z[ijk]*dzalp);\n \n betax_dr[ijk] = irad * (x[ijk]*dxBetax + y[ijk]*dyBetax + z[ijk]*dzBetax);\n betay_dr[ijk] = irad * (x[ijk]*dxBetay + y[ijk]*dyBetay + z[ijk]*dzBetay);\n betaz_dr[ijk] = irad * (x[ijk]*dxBetaz + y[ijk]*dyBetaz + z[ijk]*dzBetaz);\n \n gxx_dr[ijk] = irad * (x[ijk]*dg[0][0][0] + y[ijk]*dg[0][0][1] + z[ijk]*dg[0][0][2]);\n gxy_dr[ijk] = irad * (x[ijk]*dg[0][1][0] + y[ijk]*dg[0][1][1] + z[ijk]*dg[0][1][2]);\n gxz_dr[ijk] = irad * (x[ijk]*dg[0][2][0] + y[ijk]*dg[0][2][1] + z[ijk]*dg[0][2][2]);\n gyy_dr[ijk] = irad * (x[ijk]*dg[1][1][0] + y[ijk]*dg[1][1][1] + z[ijk]*dg[1][1][2]);\n gyz_dr[ijk] = irad * (x[ijk]*dg[1][2][0] + y[ijk]*dg[1][2][1] + z[ijk]*dg[1][2][2]);\n gzz_dr[ijk] = irad * (x[ijk]*dg[2][2][0] + y[ijk]*dg[2][2][1] + z[ijk]*dg[2][2][2]);\n }\n \n if (store_cartesian_derivatives)\n {\n alp_dx[ijk] = dxalp;\n \n betax_dx[ijk] = dxBetax;\n betay_dx[ijk] = dxBetay;\n betaz_dx[ijk] = dxBetaz;\n \n gxx_dx[ijk] = dg[0][0][0];\n gxy_dx[ijk] = dg[0][1][0];\n gxz_dx[ijk] = dg[0][2][0];\n gyy_dx[ijk] = dg[1][1][0];\n gyz_dx[ijk] = dg[1][2][0];\n gzz_dx[ijk] = dg[2][2][0];\n \n alp_dy[ijk] = dyalp;\n \n betax_dy[ijk] = dyBetax;\n betay_dy[ijk] = dyBetay;\n betaz_dy[ijk] = dyBetaz;\n \n gxx_dy[ijk] = dg[0][0][1];\n gxy_dy[ijk] = dg[0][1][1];\n gxz_dy[ijk] = dg[0][2][1];\n gyy_dy[ijk] = dg[1][1][1];\n gyz_dy[ijk] = dg[1][2][1];\n gzz_dy[ijk] = dg[2][2][1];\n \n alp_dz[ijk] = dzalp;\n \n betax_dz[ijk] = dzBetax;\n betay_dz[ijk] = dzBetay;\n betaz_dz[ijk] = dzBetaz;\n \n gxx_dz[ijk] = dg[0][0][2];\n gxy_dz[ijk] = dg[0][1][2];\n gxz_dz[ijk] = dg[0][2][2];\n gyy_dz[ijk] = dg[1][1][2];\n gyz_dz[ijk] = dg[1][2][2];\n gzz_dz[ijk] = dg[2][2][2];\n }\n \n if (store_time_derivatives)\n {\n for (int ii=0; ii < 3; ++ii)\n {\n dg[1][0][ii] = dg[0][1][ii];\n dg[2][0][ii] = dg[0][2][ii];\n dg[2][1][ii] = dg[1][2][ii];\n } \n \n // calculate inverse metric compoenents\n CCTK_REAL ig[3][3];\n \n invert_metric(gxx[ijk], gxy[ijk], gxz[ijk], gyy[ijk], gyz[ijk], gzz[ijk], detg,\n ig[0][0], ig[0][1], ig[0][2], ig[1][1], ig[1][2], ig[2][2]);\n \n ig[1][0] = ig[0][1];\n ig[2][0] = ig[0][2];\n ig[2][1] = ig[1][2];\n \n // calculate Christoffels\n \n CCTK_REAL C[3][3][3]; // last index is the upper index of Christoffel symbol\n \n for (int ii=0; ii < 3; ++ii)\n for (int jj=ii; jj < 3; ++jj)\n for (int kk=0; kk < 3; ++kk)\n {\n C[ii][jj][kk] = 0.5* ( ig[kk][0] * (dg[0][ii][jj] + dg[0][jj][ii] - dg[ii][jj][0])\n + ig[kk][1] * (dg[1][ii][jj] + dg[1][jj][ii] - dg[ii][jj][1])\n + ig[kk][2] * (dg[2][ii][jj] + dg[2][jj][ii] - dg[ii][jj][2]) );\n if (ii != jj)\n C[jj][ii][kk] = C[ii][jj][kk];\n }\n \n \n // calculate covariant derivative D_i \\beta^j\n CCTK_REAL DxBetax(0), DxBetay(0), DyBetax(0), DxBetaz(0), DzBetax(0);\n CCTK_REAL DyBetay(0), DyBetaz(0), DzBetay(0), DzBetaz(0);\n \n DxBetax = dxBetax + (C[0][0][0]*betax[ijk] + C[0][1][0]*betay[ijk] + C[0][2][0]*betaz[ijk]);\n DxBetay = dxBetay + (C[0][0][1]*betax[ijk] + C[0][1][1]*betay[ijk] + C[0][2][1]*betaz[ijk]);\n DxBetaz = dxBetaz + (C[0][0][2]*betax[ijk] + C[0][1][2]*betay[ijk] + C[0][2][2]*betaz[ijk]);\n \n DyBetax = dyBetax + (C[1][0][0]*betax[ijk] + C[1][1][0]*betay[ijk] + C[1][2][0]*betaz[ijk]);\n DyBetay = dyBetay + (C[1][0][1]*betax[ijk] + C[1][1][1]*betay[ijk] + C[1][2][1]*betaz[ijk]);\n DyBetaz = dyBetaz + (C[1][0][2]*betax[ijk] + C[1][1][2]*betay[ijk] + C[1][2][2]*betaz[ijk]);\n \n DzBetax = dzBetax + (C[2][0][0]*betax[ijk] + C[2][1][0]*betay[ijk] + C[2][2][0]*betaz[ijk]);\n DzBetay = dzBetay + (C[2][0][1]*betax[ijk] + C[2][1][1]*betay[ijk] + C[2][2][1]*betaz[ijk]);\n DzBetaz = dzBetaz + (C[2][0][2]*betax[ijk] + C[2][1][2]*betay[ijk] + C[2][2][2]*betaz[ijk]);\n \n // get index down: D_i \\beta_j \n CCTK_REAL Dxbetax(0), Dxbetay(0), Dybetax(0), Dxbetaz(0), Dzbetax(0);\n CCTK_REAL Dybetay(0), Dybetaz(0), Dzbetay(0), Dzbetaz(0);\n \n Dxbetax = gxx[ijk]*DxBetax + gxy[ijk]*DxBetay + gxz[ijk]*DxBetaz;\n Dxbetay = gxy[ijk]*DxBetax + gyy[ijk]*DxBetay + gyz[ijk]*DxBetaz;\n Dxbetaz = gxz[ijk]*DxBetax + gyz[ijk]*DxBetay + gzz[ijk]*DxBetaz;\n \n Dybetax = gxx[ijk]*DyBetax + gxy[ijk]*DyBetay + gxz[ijk]*DyBetaz;\n Dybetay = gxy[ijk]*DyBetax + gyy[ijk]*DyBetay + gyz[ijk]*DyBetaz;\n Dybetaz = gxz[ijk]*DyBetax + gyz[ijk]*DyBetay + gzz[ijk]*DyBetaz;\n \n Dzbetax = gxx[ijk]*DzBetax + gxy[ijk]*DzBetay + gxz[ijk]*DzBetaz;\n Dzbetay = gxy[ijk]*DzBetax + gyy[ijk]*DzBetay + gyz[ijk]*DzBetaz;\n Dzbetaz = gxz[ijk]*DzBetax + gyz[ijk]*DzBetay + gzz[ijk]*DzBetaz;\n \n // get time derivative of metric\n gxx_dt[ijk] = -2.0*alp[ijk]*kxx[ijk] + Dxbetax + Dxbetax;\n gxy_dt[ijk] = -2.0*alp[ijk]*kxy[ijk] + Dxbetay + Dybetax;\n gxz_dt[ijk] = -2.0*alp[ijk]*kxz[ijk] + Dxbetaz + Dzbetax;\n gyy_dt[ijk] = -2.0*alp[ijk]*kyy[ijk] + Dybetay + Dybetay;\n gyz_dt[ijk] = -2.0*alp[ijk]*kyz[ijk] + Dybetaz + Dzbetay;\n gzz_dt[ijk] = -2.0*alp[ijk]*kzz[ijk] + Dzbetaz + Dzbetaz;\n }\n \n \n }\n LC_ENDLOOP3 (ADMDerivatives_CalcDerivatives);\n \n }\n/* else\n {\n // we need to do only radial Jacobian trafo since we have one radial coordinate direction which might be stretched!\n \n assert(*general_coordinates);\n \n#pragma omp parallel\n LC_LOOP3 (ADMDerivatives_CalcRadialDerivatives,\n i, j, k,\n istart[0], istart[1], istart[2],\n iend[0], iend[1], iend[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ijk = CCTK_GFINDEX3D(cctkGH, i, j, k);\n \n // FIXME: Get Jacobian right!\n const CCTK_REAL Jac = sqrt(J31[ijk]*J31[ijk] + J32[ijk]*J32[ijk] + J33[ijk]*J33[ijk]);\n \n alp_dr[ijk] = Jac * calc_dc(cctkGH, alp, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n \n betax_dr[ijk] = Jac * calc_dc(cctkGH, betax, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n betay_dr[ijk] = Jac * calc_dc(cctkGH, betay, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n betaz_dr[ijk] = Jac * calc_dc(cctkGH, betaz, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n \n gxx_dr[ijk] = Jac * calc_dc(cctkGH, gxx, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n gxy_dr[ijk] = Jac * calc_dc(cctkGH, gxy, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n gxz_dr[ijk] = Jac * calc_dc(cctkGH, gxz, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n gyy_dr[ijk] = Jac * calc_dc(cctkGH, gyy, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n gyz_dr[ijk] = Jac * calc_dc(cctkGH, gyz, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n gzz_dr[ijk] = Jac * calc_dc(cctkGH, gzz, i, j, k, nk, imin[2], imax[2], q[2], ihz);\n }\n LC_ENDLOOP3 (ADMDerivatives_CalcRadialDerivatives);\n }*/\n } \n\n\n\n delete [] imin[0];\n delete [] imin[1];\n delete [] imin[2];\n delete [] imax[0];\n delete [] imax[1];\n delete [] imax[2];\n delete [] q[0];\n delete [] q[1];\n delete [] q[2];\n \n}\n",
|
| 12 |
+
"grids.cc": "#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n#include \"cctk_Arguments.h\"\n#include \"util_String.h\"\n#include \"util_Table.h\" \n\n#include \"Symmetry.h\"\n#include \"GlobalDerivative.h\"\n\n//#include \"util.h\"\n#include \"util_String.h\"\n#include \"util_Table.h\"\n\n#include \"grids.hh\"\n\n// Copied from CTGBase/src/util.c\n\nvoid\nADMDerivatives_GetPhysicalBoundaries(cGH *cctkGH, int* do_bc)\n{\n// const cGH* const cctkGH = (const cGH*) GH; \n// const cGH* cctkGH = (const cGH*) GH; \n // const cGH *cctkGH = (const cGH *) GH;\n\n\n DECLARE_CCTK_ARGUMENTS;\n\n// int patch = MultiPatch_GetMap(cctkGH);\n\n if (CCTK_IsFunctionAliased(\"MultiPatch_GetBbox\"))\n {\n CCTK_INT bbox[6];\n MultiPatch_GetBbox(cctkGH, 6, bbox);\n for (int i=0; i<6; ++i)\n\tdo_bc[i] = bbox[i];\n }\n else\n {\n CCTK_INT symbnd[6];\n\n CCTK_INT symtable = SymmetryTableHandleForGrid(cctkGH);\n if (symtable < 0)\n\tCCTK_WARN(0, \"Could not get symmetry table for grid.\");\n\n int ierr = Util_TableGetIntArray(symtable, 6, symbnd, \"symmetry_handle\");\n if (ierr != 6)\n\tCCTK_WARN(0, \"Could not get symmetry table handle for grid.\");\n for (int i=0; i<6; ++i)\n\tdo_bc[i] = (cctk_bbox[i] && symbnd[i]<0);\n }\n\n return;\n}\n\n\nCCTK_INT ADMDerivatives_GetGridRanges(cGH *cctkGH, int* istart,\n int* iend)\n{\n // const cGH* const cctkGH = GH; \n DECLARE_CCTK_ARGUMENTS;\n int i;\n int do_bc[6];\n \n if (!CCTK_IsFunctionAliased(\"MultiPatch_GetBbox\"))\n {\n ADMDerivatives_GetPhysicalBoundaries (cctkGH, do_bc);\n \n for (i=0; i<3; ++i)\n {\n if (do_bc[2*i])\n istart[i] = 0;\n else\n istart[i] = cctk_nghostzones[i];\n if (do_bc[2*i+1])\n iend[i] = cctk_lsh[i];\n else\n iend[i] = cctk_lsh[i] - cctk_nghostzones[i];\n }\n \n return 0;\n }\n \n CCTK_INT bbox[6];\n CCTK_INT nboundaryzones[6];\n CCTK_INT is_internal[6];\n CCTK_INT is_staggered[6];\n CCTK_INT shiftout[6];\n CCTK_INT symbnd[6];\n CCTK_INT is_ipbnd[6];\n \n CCTK_INT dir = 0;\n CCTK_INT symtable = 0;\n CCTK_INT face = 0;\n CCTK_INT npoints = 0;\n CCTK_INT iret = 0;\n CCTK_INT ierr = 0;\n \n \n if (CCTK_IsFunctionAliased (\"MultiPatch_GetBbox\")) {\n ierr = MultiPatch_GetBbox (cctkGH, 6, bbox);\n if (ierr != 0)\n CCTK_WARN(0, \"Could not obtain bbox specification\");\n } else {\n for (dir = 0; dir < 6; dir++)\n {\n bbox[dir] = 0;\n }\n }\n\n if (CCTK_IsFunctionAliased (\"MultiPatch_GetBoundarySpecification\")) {\n CCTK_INT const map = MultiPatch_GetMap (cctkGH);\n if (map < 0)\n CCTK_WARN(0, \"Could not obtain boundary specification\");\n ierr = MultiPatch_GetBoundarySpecification\n (map, 6, nboundaryzones, is_internal, is_staggered, shiftout);\n if (ierr != 0)\n CCTK_WARN(0, \"Could not obtain boundary specification\");\n } else if (CCTK_IsFunctionAliased (\"GetBoundarySpecification\")) {\n ierr = GetBoundarySpecification\n (6, nboundaryzones, is_internal, is_staggered, shiftout);\n if (ierr != 0)\n CCTK_WARN(0, \"Could not obtain boundary specification\");\n } else {\n CCTK_WARN(0, \"Could not obtain boundary specification\");\n }\n\n symtable = SymmetryTableHandleForGrid(cctkGH);\n if (symtable < 0)\n {\n CCTK_WARN(0, \"Could not obtain symmetry table\");\n }\n\n iret = Util_TableGetIntArray(symtable, 6, symbnd, \"symmetry_handle\");\n if (iret != 6) CCTK_WARN (0, \"Could not obtain symmetry information\");\n\n for (dir = 0; dir < 6; dir++)\n {\n is_ipbnd[dir] = (!cctk_bbox[dir]);\n }\n\n for (dir = 0; dir < 3; dir++)\n {\n for (face = 0; face < 2; face++)\n {\n CCTK_INT index = dir*2 + face;\n if (is_ipbnd[index])\n {\n /* Inter-processor boundary */\n npoints = cctk_nghostzones[dir];\n }\n else\n {\n /* Symmetry or physical boundary */\n npoints = nboundaryzones[index];\n\n }\n\n switch(face)\n {\n case 0: /* Lower boundary */\n istart[dir] = npoints;\n break;\n case 1: /* Upper boundary */\n iend[dir] = cctk_lsh[dir] - npoints;\n break;\n default:\n CCTK_WARN(0, \"internal error\");\n }\n }\n }\n\n\n return 0;\n}\n",
|
| 13 |
+
"derivatives.h": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\nif (*general_coordinates)\n {\n dadx = J11[ijk];\n dady = J12[ijk];\n dadz = J13[ijk];\n dbdx = J21[ijk];\n dbdy = J22[ijk];\n dbdz = J23[ijk];\n dcdx = J31[ijk];\n dcdy = J32[ijk];\n dcdz = J33[ijk];\n \n }\n\n\ng_diff(cctkGH, gxx, &dg[0][0][0], &dg[0][0][1], &dg[0][0][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, gxy, &dg[0][1][0], &dg[0][1][1], &dg[0][1][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, gxz, &dg[0][2][0], &dg[0][2][1], &dg[0][2][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, gyy, &dg[1][1][0], &dg[1][1][1], &dg[1][1][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, gyz, &dg[1][2][0], &dg[1][2][1], &dg[1][2][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, gzz, &dg[2][2][0], &dg[2][2][1], &dg[2][2][2],\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, betax, &dxBetax, &dyBetax, &dzBetax,\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, betay, &dxBetay, &dyBetay, &dzBetay,\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, betaz, &dxBetaz, &dyBetaz, &dzBetaz,\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\ng_diff(cctkGH, alp, &dxalp, &dyalp, &dzalp,\n *general_coordinates,\n dadx, dbdx, dcdx, dady, dbdy, dcdy, dadz, dbdz, dcdz,\n i, j, k, ni, nj, nk,\n imin[0], imax[0], imin[1], imax[1], imin[2], imax[2], q[0], q[1], q[2],\n ihx, ihy, ihz);\n\n",
|
| 14 |
+
"grids.hh": "\n#include \"cctk.h\"\n\nCCTK_INT ADMDerivatives_GetGridRanges(cGH *cctkGH, int* istart,\n int* iend);\n"
|
| 15 |
+
},
|
| 16 |
+
"test": {},
|
| 17 |
+
"doc": {}
|
| 18 |
+
}
|
Llama_Coordinates.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Llama_CoordinatesSymmetry.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "Llama/CoordinatesSymmetry",
|
| 3 |
+
"url": "https://bitbucket.org/llamacode/llama.git",
|
| 4 |
+
"configuration": "",
|
| 5 |
+
"interface": "# Interface definition for thorn CoordinatesSymmetry\n\nIMPLEMENTS: CoordinatesSymmetry\n\n\nCCTK_INT FUNCTION SymmetryHandleOfName (CCTK_STRING IN sym_name)\nREQUIRES FUNCTION SymmetryHandleOfName\n\n#CCTK_INT FUNCTION SymmetryRegister (CCTK_STRING IN sym_name)\n#REQUIRES FUNCTION SymmetryRegister\n\n# which_faces : array [N_FACES] \n# symmetry_zone_width: array [N_FACES]\n#CCTK_INT FUNCTION \\\n# SymmetryRegisterGrid \\\n# (CCTK_POINTER IN cctkGH, \\\n# CCTK_INT IN sym_handle, \\\n# CCTK_INT IN ARRAY which_faces, \\\n# CCTK_INT IN ARRAY symmetry_zone_width)\n#REQUIRES FUNCTION SymmetryRegisterGrid\n\nCCTK_INT FUNCTION \\\n SymmetryRegisterGridInterpolator \\\n (CCTK_POINTER IN cctkGH, \\\n CCTK_INT IN sym_handle, \\\n CCTK_INT CCTK_FPOINTER IN symmetry_interpolate \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN N_dims, \\\n CCTK_INT IN local_interp_handle, \\\n CCTK_INT IN param_table_handle, \\\n CCTK_INT IN coord_system_handle, \\\n CCTK_INT IN N_interp_points, \\\n CCTK_INT IN interp_coords_type, \\\n CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \\\n CCTK_INT IN N_input_arrays, \\\n CCTK_INT ARRAY IN input_array_indices, \\\n CCTK_INT IN N_output_arrays, \\\n CCTK_INT ARRAY IN output_array_types, \\\n CCTK_POINTER ARRAY IN output_arrays, \\\n CCTK_INT IN faces))\nREQUIRES FUNCTION SymmetryRegisterGridInterpolator\n\nCCTK_INT FUNCTION \\\n CoordinatesSymmetry_Interpolate \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN N_dims, \\\n CCTK_INT IN local_interp_handle, \\\n CCTK_INT IN param_table_handle, \\\n CCTK_INT IN coord_system_handle, \\\n CCTK_INT IN N_interp_points, \\\n CCTK_INT IN interp_coords_type, \\\n CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \\\n CCTK_INT IN N_input_arrays, \\\n CCTK_INT ARRAY IN input_array_indices, \\\n CCTK_INT IN N_output_arrays, \\\n CCTK_INT ARRAY IN output_array_types, \\\n CCTK_POINTER ARRAY IN output_arrays, \\\n CCTK_INT IN faces)\nPROVIDES FUNCTION CoordinatesSymmetry_Interpolate \\\n WITH CoordinatesSymmetry_interp \\\n LANGUAGE C\n\n#CCTK_INT FUNCTION \\\n# SymmetryInterpolateFaces \\\n# (CCTK_POINTER_TO_CONST IN cctkGH, \\\n# CCTK_INT IN N_dims, \\\n# CCTK_INT IN local_interp_handle, \\\n# CCTK_INT IN param_table_handle, \\\n# CCTK_INT IN coord_system_handle, \\\n# CCTK_INT IN N_interp_points, \\\n# CCTK_INT IN interp_coords_type, \\\n# CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \\\n# CCTK_INT IN N_input_arrays, \\\n# CCTK_INT ARRAY IN input_array_indices, \\\n# CCTK_INT IN N_output_arrays, \\\n# CCTK_INT ARRAY IN output_array_types, \\\n# CCTK_POINTER ARRAY IN output_arrays, \\\n# CCTK_INT IN faces)\n#REQUIRES FUNCTION SymmetryInterpolateFaces\n\nCCTK_INT FUNCTION \\\n MultiPatch_SymmetryInterpolateFaces \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN N_dims, \\\n CCTK_INT IN local_interp_handle, \\\n CCTK_INT IN param_table_handle, \\\n CCTK_INT IN coord_system_handle, \\\n CCTK_INT IN N_interp_points, \\\n CCTK_INT IN interp_coords_type, \\\n CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \\\n CCTK_INT IN N_input_arrays, \\\n CCTK_INT ARRAY IN input_array_indices, \\\n CCTK_INT IN N_output_arrays, \\\n CCTK_INT ARRAY IN output_array_types, \\\n CCTK_POINTER ARRAY IN output_arrays, \\\n CCTK_INT IN faces)\nREQUIRES FUNCTION MultiPatch_SymmetryInterpolateFaces\n\n\nCCTK_INT FUNCTION Boundary_SelectedGVs \\\n (CCTK_POINTER_TO_CONST IN GH, \\\n CCTK_INT IN array_size, \\\n CCTK_INT ARRAY OUT var_indicies, \\\n CCTK_INT ARRAY OUT faces, \\\n CCTK_INT ARRAY OUT boundary_widths, \\\n CCTK_INT ARRAY OUT table_handles, \\\n CCTK_STRING IN bc_name)\nREQUIRES FUNCTION Boundary_SelectedGVs\n\n\n\n#CCTK_INT FUNCTION GetBoundarySpecification \\\n# (CCTK_INT IN size, \\\n# CCTK_INT OUT ARRAY nboundaryzones, \\\n# CCTK_INT OUT ARRAY is_internal, \\\n# CCTK_INT OUT ARRAY is_staggered, \\\n# CCTK_INT OUT ARRAY shiftout)\n#REQUIRES FUNCTION GetBoundarySpecification\n\n\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetMap \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nREQUIRES FUNCTION MultiPatch_GetMap\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetBbox \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY bbox)\nREQUIRES FUNCTION MultiPatch_GetBbox \n\nCCTK_INT FUNCTION \\\n MultiPatch_GetBoundarySpecification \\\n (CCTK_INT IN map, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY nboundaryzones, \\\n CCTK_INT OUT ARRAY is_internal, \\\n CCTK_INT OUT ARRAY is_staggered, \\\n CCTK_INT OUT ARRAY shiftout)\nREQUIRES FUNCTION MultiPatch_GetBoundarySpecification\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetSymmetrySpecification \\\n (CCTK_INT IN map, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY type, \\\n CCTK_INT OUT symmetry_overlap, \\\n CCTK_INT OUT symmetry_dir)\nREQUIRES FUNCTION MultiPatch_GetSymmetrySpecification\n\n\nCCTK_INT FUNCTION \\\n GetRefinementLevel \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nUSES FUNCTION GetRefinementLevel\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "# Schedule definitions for thorn CoordinatesSymmetry\n\nSCHEDULE CoordinatesSymmetry_Apply AS CoordinatesSymmetry_Apply_FirstPass IN BoundaryConditions BEFORE Interpolate2ApplyBC\n{\n LANG: C\n} \"Apply multipatch symmetries\"\n\n# Note: the second pass is actually only necessary for all points in the symmetry zone that are also inter-patch boundary points.\n# Right now, we re-apply the complete symmetry condition, which could be optimized by only applying the symmetry condition to the points in the interpatch boundary.\nSCHEDULE CoordinatesSymmetry_Apply AS CoordinatesSymmetry_Apply_SecondPass IN BoundaryConditions AFTER Interpolate2ApplyBC\n{\n LANG: C\n} \"Apply multipatch symmetries for remaining points not filled by interpatch interpolation\"\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# Main make.code.defn file for thorn CoordinatesSymmetry\n\n# Source files in this directory\nSRCS = apply.c interpolate.c\n\n# Subdirectories containing source files\nSUBDIRS = \n",
|
| 10 |
+
"interpolate.c": "#include <assert.h>\n#include <math.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"util_ErrorCodes.h\"\n#include \"util_Table.h\"\n\n#include \"reflection.h\"\n\n\n\nCCTK_INT\nCoordinatesSymmetry_interp (CCTK_POINTER_TO_CONST const cctkGH,\n CCTK_INT const N_dims,\n CCTK_INT const local_interp_handle,\n CCTK_INT const param_table_handle,\n CCTK_INT const coord_system_handle,\n CCTK_INT const N_interp_points,\n CCTK_INT const interp_coords_type,\n CCTK_POINTER_TO_CONST const interp_coords[],\n CCTK_INT const N_input_arrays,\n CCTK_INT const input_array_indices[],\n CCTK_INT const N_output_arrays,\n CCTK_INT const output_array_types[],\n CCTK_POINTER const output_arrays[],\n CCTK_INT const faces)\n{\n DECLARE_CCTK_PARAMETERS;\n \n int do_reflection[6];\n \n CCTK_POINTER_TO_CONST restrict new_interp_coords[3];\n CCTK_INT newfaces;\n \n CCTK_INT * restrict operand_indices;\n CCTK_INT * restrict operation_codes;\n CCTK_INT * restrict output_array_indices;\n \n int dir;\n \n int iret;\n \n int m;\n int n;\n int d;\n \n int ierr;\n \n \n do_reflection[0] = reflection_x;\n do_reflection[1] = 0;\n do_reflection[2] = reflection_y;\n do_reflection[3] = 0;\n do_reflection[4] = reflection_z;\n do_reflection[5] = 0;\n \n \n newfaces = faces;\n /*for (d=0; d<6; ++d) {\n if (do_reflection[d]) {\n assert (newfaces & (1 << d));\n newfaces &= ~ (1 << d);\n }\n }*/\n \n \n \n /* Fold coordinates */\n assert (interp_coords_type == CCTK_VARIABLE_REAL);\n for (dir=0; dir<3; ++dir) {\n assert (! do_reflection[2*dir+1]);\n \n if (do_reflection[2*dir]) {\n CCTK_REAL * restrict coords_in_dir\n = malloc (N_interp_points * sizeof (CCTK_REAL));\n assert (N_interp_points == 0 || coords_in_dir);\n \n for (n=0; n<N_interp_points; ++n) {\n CCTK_REAL const pos = ((CCTK_REAL const *)interp_coords[dir])[n];\n CCTK_REAL const newpos = fabs(pos);\n coords_in_dir[n] = newpos;\n }\n new_interp_coords[dir] = coords_in_dir;\n } else {\n new_interp_coords[dir] = interp_coords[dir];\n }\n }\n \n \n \n /* Recursive call */\n iret = MultiPatch_SymmetryInterpolateFaces\n (cctkGH, \n N_dims, local_interp_handle, param_table_handle, coord_system_handle,\n N_interp_points, interp_coords_type, (CCTK_POINTER_TO_CONST)new_interp_coords,\n N_input_arrays, input_array_indices,\n N_output_arrays, output_array_types, (CCTK_POINTER_TO_CONST)output_arrays,\n newfaces);\n \n \n \n /* Free coordinates */\n for (dir=0; dir<3; ++dir) {\n if (do_reflection[2*dir]) {\n free ((void*)new_interp_coords[dir]);\n }\n }\n \n \n \n /* Find output variable indices */\n operand_indices = malloc (N_output_arrays * sizeof *operand_indices);\n assert (operand_indices);\n ierr = Util_TableGetIntArray\n (param_table_handle, N_output_arrays, operand_indices, \"operand_indices\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n assert (N_output_arrays == N_input_arrays);\n for (m=0; m<N_output_arrays; ++m) {\n operand_indices[m] = m; /* set output index to input index */\n }\n } else {\n assert (ierr == N_output_arrays);\n }\n \n operation_codes = malloc (N_output_arrays * sizeof *operation_codes);\n assert (operation_codes);\n ierr = Util_TableGetIntArray\n (param_table_handle, N_output_arrays, operation_codes, \"operation_codes\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n assert (N_output_arrays == N_input_arrays);\n for (m=0; m<N_output_arrays; ++m) {\n operation_codes[m] = 0; /* do not take derivatives */\n }\n } else {\n assert (ierr == N_output_arrays);\n }\n \n output_array_indices\n = malloc (N_output_arrays * sizeof *output_array_indices);\n assert (output_array_indices);\n for (m=0; m<N_output_arrays; ++m) {\n assert (operand_indices[m]>=0 && operand_indices[m]<N_input_arrays);\n output_array_indices[m] = input_array_indices[operand_indices[m]];\n assert (output_array_indices[m]==-1\n || (output_array_indices[m]>=0\n && output_array_indices[m]<CCTK_NumVars()));\n }\n \n \n \n /* Unfold tensor types */\n for (m=0; m<N_output_arrays; ++m) {\n if (output_array_indices[m]!=-1) {\n \n int vi, gi;\n int numvars, firstvar, vectorlength;\n cGroup group;\n char * groupname;\n \n int table;\n char tensortypealias[1000];\n enum tensortype { UNKNOWN,\n SCALAR, VECTOR, SYMTENSOR, SYMTENSOR3, TENSOR,\n WEYLSCALARS_REAL, MANUALCARTESIAN };\n enum tensortype ttype;\n CCTK_INT tensorparity;\n int tcomponent;\n \n int parities[3];\n int check_dir[3];\n int needs_checking;\n \n \n \n vi = output_array_indices[m];\n assert (vi>=0 && vi<CCTK_NumVars());\n gi = CCTK_GroupIndexFromVarI (vi);\n assert (gi>=0 && gi<CCTK_NumGroups());\n\n ierr = CCTK_GroupData (gi, &group);\n assert (!ierr);\n\n numvars = CCTK_NumVarsInGroupI(gi);\n assert (numvars>0);\n firstvar = CCTK_FirstVarIndexI(gi);\n assert (firstvar>=0);\n vectorlength = group.vectorlength;\n assert (vectorlength>=0);\n assert (vectorlength==1 || group.vectorgroup);\n table = CCTK_GroupTagsTableI(gi);\n assert (table>=0);\n \n \n \n /* Get and check tensor type information */\n ierr = Util_TableGetString\n (table, sizeof tensortypealias, tensortypealias, \"tensortypealias\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (4, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Tensor type alias not declared for group \\\"%s\\\" -- assuming a scalar\",\n groupname);\n free (groupname);\n strcpy (tensortypealias, \"scalar\");\n } else if (ierr<0) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error in tensor type alias declaration for group \\\"%s\\\"\",\n groupname);\n free (groupname);\n }\n \n ttype = UNKNOWN;\n tcomponent = 0;\n if (CCTK_EQUALS (tensortypealias, \"scalar\")) {\n /* scalar */\n if (numvars != vectorlength) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (4, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Group \\\"%s\\\" has the tensor type alias \\\"scalar\\\", but contains more than 1 element\",\n groupname);\n free (groupname);\n }\n ttype = SCALAR;\n tcomponent = 0;\n } else if (CCTK_EQUALS (tensortypealias, \"4scalar\")) {\n /* 4-scalar */\n assert (numvars == vectorlength);\n ttype = SCALAR;\n tcomponent = 0;\n } else if (CCTK_EQUALS (tensortypealias, \"u\")\n || CCTK_EQUALS (tensortypealias, \"d\"))\n {\n /* vector */\n const int numcomps = 3;\n /* special case to handle things like vel[3] */\n assert (numvars % numcomps == 0 &&\n (numvars == numcomps * vectorlength || numvars == vectorlength));\n ttype = VECTOR;\n if(numvars == vectorlength) {\n tcomponent = (vi - firstvar);\n } else {\n tcomponent = (vi - firstvar) / vectorlength;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"4u\")\n || CCTK_EQUALS (tensortypealias, \"4d\"))\n {\n /* 4-vector */\n const int numcomps = 4;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n if ((vi - firstvar) / vectorlength == 0) {\n ttype = SCALAR;\n tcomponent = 0;\n } else {\n ttype = VECTOR;\n tcomponent = (vi - firstvar) / vectorlength - 1;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"uu_sym\")\n || CCTK_EQUALS (tensortypealias, \"dd_sym\"))\n {\n /* symmetric tensor */\n const int numcomps = 6;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = SYMTENSOR;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"uu\")\n || CCTK_EQUALS (tensortypealias, \"ud\")\n || CCTK_EQUALS (tensortypealias, \"du\")\n || CCTK_EQUALS (tensortypealias, \"dd\"))\n {\n /* non-symmetric tensor */\n const int numcomps = 9;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = TENSOR;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"4uu_sym\")\n || CCTK_EQUALS (tensortypealias, \"4dd_sym\"))\n {\n /* symmetric 4-tensor */\n const int numcomps = 10;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n if ((vi - firstvar) / vectorlength == 0) {\n ttype = SCALAR;\n tcomponent = 0;\n } else if ((vi - firstvar) / vectorlength <= 3) {\n ttype = VECTOR;\n tcomponent = (vi - firstvar) / vectorlength - 1;\n } else {\n ttype = SYMTENSOR;\n tcomponent = (vi - firstvar) / vectorlength - 4;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"ddd_sym\")) {\n /* 3rd rank tensor, symmetric in last 2 indices */\n const int numcomps = 18;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = SYMTENSOR3;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"weylscalars_real\")) {\n /* Weyl scalars, stored as 10 real numbers */\n const int numcomps = 10;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = WEYLSCALARS_REAL;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"ManualCartesian\")) {\n /* Reflection symmetries specified by hand */\n ttype = MANUALCARTESIAN;\n tcomponent = vi - firstvar;\n } else {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Illegal tensor type alias \\\"%s\\\" for group \\\"%s\\\"\", \n\t\t tensortypealias, groupname);\n free (groupname);\n }\n \n switch (ttype) {\n case SCALAR:\n assert (tcomponent>=0 && tcomponent<1);\n break;\n case VECTOR:\n assert (tcomponent>=0 && tcomponent<3);\n break;\n case SYMTENSOR:\n assert (tcomponent>=0 && tcomponent<6);\n break;\n case SYMTENSOR3:\n assert (tcomponent>=0 && tcomponent<18);\n break;\n case TENSOR:\n assert (tcomponent>=0 && tcomponent<9);\n break;\n case WEYLSCALARS_REAL:\n assert (tcomponent>=0 && tcomponent<10);\n break;\n case MANUALCARTESIAN:\n /* No restriction on number of components */\n break;\n default:\n assert (0);\n }\n \n ierr = Util_TableGetInt (table, & tensorparity, \"tensorparity\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n tensorparity = +1;\n } else if (ierr<0) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error in tensor parity declaration for group \\\"%s\\\"\",\n groupname);\n free (groupname);\n }\n \n \n \n /* Calculate parities */\n parities[0] = parities[1] = parities[2] = +1;\n switch (ttype) {\n case SCALAR:\n /* do nothing */\n break;\n case VECTOR:\n parities[tcomponent] = -1;\n break;\n case SYMTENSOR:\n switch (tcomponent) {\n case 0: break;\n case 1: parities[0] = parities[1] = -1; break;\n case 2: parities[0] = parities[2] = -1; break;\n case 3: break;\n case 4: parities[1] = parities[2] = -1; break;\n case 5: break;\n default: assert (0);\n }\n break;\n case SYMTENSOR3:\n switch (tcomponent % 6) {\n case 0: break;\n case 1: parities[0] = parities[1] = -1; break;\n case 2: parities[0] = parities[2] = -1; break;\n case 3: break;\n case 4: parities[1] = parities[2] = -1; break;\n case 5: break;\n default: assert (0);\n }\n switch (tcomponent / 6) {\n case 0: parities[0] *= -1; break;\n case 1: parities[1] *= -1; break;\n case 2: parities[2] *= -1; break;\n default: assert (0);\n }\n break;\n case TENSOR:\n switch (tcomponent) {\n case 0: break;\n case 1: parities[0] = parities[1] = -1; break;\n case 2: parities[0] = parities[2] = -1; break;\n case 3: parities[1] = parities[0] = -1; break;\n case 4: break;\n case 5: parities[1] = parities[2] = -1; break;\n case 6: parities[2] = parities[0] = -1; break;\n case 7: parities[2] = parities[1] = -1; break;\n case 8: break;\n default: assert (0);\n }\n break;\n case WEYLSCALARS_REAL: {\n static int const weylparities[10][3] =\n {{+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1}};\n for (dir=0; dir<3; ++dir) {\n parities[dir] = weylparities[tcomponent][dir];\n }\n break;\n }\n case MANUALCARTESIAN:\n CoordinatesSymmetry_GetManualParities(table, gi, parities);\n break;\n default:\n assert (0);\n }\n \n \n \n /* Take derivatives into account */\n {\n int code = operation_codes[m];\n while (code) {\n d = code % 10 - 1;\n code /= 10;\n assert (d>=0 && d<3);\n parities[d] *= -1;\n }\n }\n \n \n \n /* Are there negative parities? */\n needs_checking = 0;\n for (dir=0; dir<3; ++dir) {\n check_dir[dir] = do_reflection[2*dir] && parities[dir]*tensorparity < 0;\n needs_checking |= check_dir[dir];\n }\n\n \n \n \n /* Loop over all points and unfold */\n if (needs_checking) {\n for (n=0; n<N_interp_points; ++n) {\n int parity = 1; /* all types have their \"natural\" sign in the +++ octant */\n /* Is the point outside the domain? */\n for (dir=0; dir<3; ++dir) {\n if (check_dir[dir]) {\n CCTK_REAL const pos = ((CCTK_REAL const *)interp_coords[dir])[n];\n if (pos < 0) {\n /* Reflect the tensor component */\n parity *= -1; /* we only get here if parities[dir]*tensorparity < 0 */\n }\n }\n }\n ((CCTK_REAL *)output_arrays[m])[n] *= parity;\n }\n }\n \n }\n } /* for m */\n \n \n \n /* Free output variable indices */\n free (operand_indices);\n free (operation_codes);\n free (output_array_indices);\n \n \n \n /* Return */\n return iret;\n}\n\nvoid CoordinatesSymmetry_GetManualParities(int table, int gi, int *parities)\n{\n char cartsyms[100];\n char *groupname = NULL;\n int i = 0;\n int ierr = -1;\n\n /* Get and check tensor type information */\n ierr = Util_TableGetString\n (table, sizeof cartsyms, cartsyms, \"cartesianreflectionparities\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,\n\t\t\"Cartesian refection parity not declared for group \\\"%s\\\" -- aborting\",\n\t\tgroupname);\n assert(0);\n } else if (ierr<0) {\n groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n\t\t\"Error in tensor type alias declaration for group \\\"%s\\\"\",\n\t\tgroupname);\n free (groupname);\n }\n\n if (strlen(cartsyms) != 3)\n {\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n\t\t\"Invalid format for cartesianreflectionparities: must be xxx where x is + or - for group %s\",\n\t\tgroupname);\n }\n\n for (i = 0; i < 3; i++)\n {\n switch (cartsyms[i])\n {\n case '+':\n parities[i] = 1;\n break;\n case '-':\n parities[i] = -1;\n break;\n default:\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n\t\t \"Invalid format for cartesianreflectionparities: must be xxx where x is + or - for group %s\",\n\t\t groupname);\n }\n }\n}\n",
|
| 11 |
+
"reflection.h": "#ifndef COORDINATESSYMMETRY_H\n#define COORDINATESSYMMETRY_H\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n\nvoid\nCoordinatesSymmetry_Apply (CCTK_ARGUMENTS);\n\nvoid \nCoordinatesSymmetry_GetManualParities(int table, int gi, int *parities);\n\n#endif /* ! defined COORDINATESSYMMETRY_H */\n",
|
| 12 |
+
"apply.c": "#include <assert.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"cctk.h\"\n#include \"cctk_Arguments.h\"\n#include \"cctk_Parameters.h\"\n\n#include \"util_ErrorCodes.h\"\n#include \"util_Table.h\"\n\n#include \"reflection.h\"\n\n\n\n#define COPY_PRE(VARTYPE) \\\n static void \\\n copy_##VARTYPE (VARTYPE const * restrict const srcvar, \\\n VARTYPE * restrict const dstvar, \\\n int const ni, int const nj, int const nk, \\\n int const imin, int const jmin, int const kmin, \\\n int const imax, int const jmax, int const kmax, \\\n int const ioff, int const joff, int const koff, \\\n int const idir, int const jdir, int const kdir, \\\n int const parity) \\\n { \\\n assert (abs(idir)==1); \\\n assert (abs(jdir)==1); \\\n assert (abs(kdir)==1); \\\n int const iioff = ioff + (1 - idir) * imin; \\\n int const jjoff = joff + (1 - jdir) * jmin; \\\n int const kkoff = koff + (1 - kdir) * kmin; \\\n int const iimin = iioff + idir * imin; \\\n int const jjmin = jjoff + jdir * jmin; \\\n int const kkmin = kkoff + kdir * kmin; \\\n int const iimax = iioff + idir * imax; \\\n int const jjmax = jjoff + jdir * jmax; \\\n int const kkmax = kkoff + kdir * kmax; \\\n assert (imin>=0 && imax<=ni); \\\n assert (jmin>=0 && jmax<=nj); \\\n assert (kmin>=0 && kmax<=nk); \\\n assert (iimin>=0 && iimax<=ni); \\\n assert (jjmin>=0 && jjmax<=nj); \\\n assert (kkmin>=0 && kkmax<=nk); \\\n assert (iimax>=-1 && iimin<ni); \\\n assert (jjmax>=-1 && jjmin<nj); \\\n assert (kkmax>=-1 && kkmin<nk);\n\n#define COPY_LOOP(VARTYPE) \\\n for (int k=kmin; k<kmax; ++k) { \\\n for (int j=jmin; j<jmax; ++j) { \\\n for (int i=imin; i<imax; ++i) { \\\n int const dstind = i + ni * (j + nj * k); \\\n int const ii = iioff + idir * i; \\\n int const jj = jjoff + jdir * j; \\\n int const kk = kkoff + kdir * k; \\\n int const srcind = ii + ni * (jj + nj * kk); \\\n dstvar[dstind] = parity * srcvar[srcind]; \\\n } \\\n } \\\n } \\\n\n#define COPY_POST(VARTYPE) \\\n }\n\n#ifdef HAVE_CCTK_INT1\nCOPY_PRE(CCTK_INT1)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_INT1)\nCOPY_POST(CCTK_INT1)\n#endif\n\n#ifdef HAVE_CCTK_INT2\nCOPY_PRE(CCTK_INT2)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_INT2)\nCOPY_POST(CCTK_INT2)\n#endif\n\n#ifdef HAVE_CCTK_INT4\nCOPY_PRE(CCTK_INT4)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_INT4)\nCOPY_POST(CCTK_INT4)\n#endif\n\n#ifdef HAVE_CCTK_INT8\nCOPY_PRE(CCTK_INT8)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_INT8)\nCOPY_POST(CCTK_INT8)\n#endif\n\n#ifdef HAVE_CCTK_INT16\nCOPY_PRE(CCTK_INT16)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_INT16)\nCOPY_POST(CCTK_INT16)\n#endif\n\n#ifdef HAVE_CCTK_REAL4\nCOPY_PRE(CCTK_REAL4)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_REAL4)\nCOPY_POST(CCTK_REAL4)\n#endif\n\n#ifdef HAVE_CCTK_REAL8\nCOPY_PRE(CCTK_REAL8)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_REAL8)\nCOPY_POST(CCTK_REAL8)\n#endif\n\n#ifdef HAVE_CCTK_REAL16\nCOPY_PRE(CCTK_REAL16)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_REAL16)\nCOPY_POST(CCTK_REAL16)\n#endif\n\n#ifdef HAVE_CCTK_COMPLEX8\nCOPY_PRE(CCTK_COMPLEX8)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_COMPLEX8)\nCOPY_POST(CCTK_COMPLEX8)\n#endif\n\n#ifdef HAVE_CCTK_COMPLEX16\nCOPY_PRE(CCTK_COMPLEX16)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_COMPLEX16)\nCOPY_POST(CCTK_COMPLEX16)\n#endif\n\n#ifdef HAVE_CCTK_COMPLEX32\nCOPY_PRE(CCTK_COMPLEX32)\n#pragma omp parallel for\nCOPY_LOOP(CCTK_COMPLEX32)\nCOPY_POST(CCTK_COMPLEX32)\n#endif\n\n#undef COPY_PRE\n#undef COPY_LOOP\n#undef COPY_POST\n\n\n\nstatic int\nBndReflectVI (cGH const * restrict const cctkGH,\n int const vi)\n{\n DECLARE_CCTK_PARAMETERS;\n \n int gi;\n cGroup group;\n cGroupDynamicData data;\n int firstvar, numvars, vectorlength;\n char * restrict fullname;\n \n void * restrict varptr;\n \n int table;\n char tensortypealias[1000];\n enum tensortype { TT_UNKNOWN,\n SCALAR, VECTOR, SYMTENSOR, SYMTENSOR3, TENSOR,\n WEYLSCALARS_REAL, MANUALCARTESIAN };\n enum tensortype ttype;\n CCTK_INT tensorparity;\n int tcomponent;\n \n /* The stagger type is defined for grid variable groups, and\n depending on this type, each variable in the group may be\n staggered differently. This implies that groups with FACE or EDGE\n staggering have well-defined tensor types. */\n /* The stagger type is defined assuming a cell-centered grid, since\n this seems to be the common case where different stagger types\n are used. If the grid is vertex centered, then we currently abort\n when staggered grid variables are encountered. (We determine the\n centering of the grid via the avoid_origin_* parameters.) */\n char staggertype[1000];\n enum staggertype { ST_UNKNOWN, CELL, FACE, EDGE, VERTEX };\n enum staggertype stype;\n \n int do_reflection[6];\n int do_stagger_grid[6];\n \n int dir, face;\n \n int ash[3], imin[3], imax[3], ioff[3], idir[3];\n \n int parity;\n int do_stagger;\n int manual_parities[3];\n\n int d;\n \n int ierr;\n \n \n \n /* Check arguments */\n if (! cctkGH) {\n CCTK_WARN (0, \"Argument cctkGH is NULL\");\n }\n if (vi < 0 || vi >= CCTK_NumVars()) {\n CCTK_WARN (0, \"Illegal variable index\");\n }\n \n if (verbose) {\n fullname = CCTK_FullName (vi);\n if (! fullname) {\n CCTK_WARN (0, \"Internal error in CCTK_FullName\");\n }\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Applying reflection boundary conditions to \\\"%s\\\"\",\n fullname);\n free (fullname);\n }\n \n \n \n /* Get and check group information */\n gi = CCTK_GroupIndexFromVarI (vi);\n if (gi < 0 || gi > CCTK_NumGroups()) {\n CCTK_WARN (0, \"Internal error in CCTK_GroupIndexFromVarI\");\n }\n \n ierr = CCTK_GroupData (gi, &group);\n assert (!ierr);\n assert (group.grouptype == CCTK_GF);\n assert (group.disttype == CCTK_DISTRIB_DEFAULT);\n \n firstvar = CCTK_FirstVarIndexI (gi);\n assert (firstvar>=0 && firstvar<CCTK_NumVars());\n numvars = CCTK_NumVarsInGroupI (gi);\n assert (numvars>=0);\n vectorlength = group.vectorlength;\n assert (vectorlength>=0);\n assert (vectorlength==1 || group.vectorgroup);\n \n ierr = CCTK_GroupDynamicData (cctkGH, gi, &data);\n assert (!ierr);\n \n table = CCTK_GroupTagsTableI(gi);\n assert (table>=0);\n \n varptr = CCTK_VarDataPtrI (cctkGH, 0, vi);\n if (!varptr) {\n fullname = CCTK_FullName (vi);\n CCTK_VInfo (CCTK_THORNSTRING,\n \"assertion for \\\"%s\\\"\",\n fullname);\n free (fullname);\n }\n assert (varptr);\n \n \n \n /* Get and check tensor type information */\n ierr = Util_TableGetString\n (table, sizeof tensortypealias, tensortypealias, \"tensortypealias\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n /* assume a scalar */\n if (numvars != 1) {\n static int * restrict didwarn = 0;\n if (! didwarn) {\n didwarn = calloc (CCTK_NumGroups(), sizeof *didwarn);\n }\n if (! didwarn[gi]) {\n didwarn[gi] = 1;\n {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Group \\\"%s\\\" has no tensor type and contains more than one element -- treating these as \\\"scalar\\\"\",\n groupname);\n free (groupname);\n }\n }\n }\n strcpy (tensortypealias, \"scalar\");\n } else if (ierr<0) {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error in tensor type alias declaration for group \\\"%s\\\": %d\",\n groupname, ierr);\n free (groupname);\n }\n \n ttype = TT_UNKNOWN;\n tcomponent = 0;\n if (CCTK_EQUALS (tensortypealias, \"scalar\")) {\n /* scalar */\n ttype = SCALAR;\n tcomponent = 0;\n } else if (CCTK_EQUALS (tensortypealias, \"4scalar\")) {\n /* 4-scalar */\n ttype = SCALAR;\n tcomponent = 0;\n } else if (CCTK_EQUALS (tensortypealias, \"u\")\n || CCTK_EQUALS (tensortypealias, \"d\"))\n {\n /* vector */\n const int numcomps = 3;\n /* special case to handle things like vel[3] */\n assert (numvars % numcomps == 0 && \n (numvars == numcomps * vectorlength || numvars == vectorlength));\n ttype = VECTOR;\n if(numvars == vectorlength) {\n tcomponent = (vi - firstvar);\n } else {\n tcomponent = (vi - firstvar) / vectorlength;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"4u\")\n || CCTK_EQUALS (tensortypealias, \"4d\"))\n {\n /* 4-vector */\n const int numcomps = 4;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n if ((vi - firstvar) / vectorlength == 0) {\n ttype = SCALAR;\n tcomponent = 0;\n } else {\n ttype = VECTOR;\n tcomponent = (vi - firstvar) / vectorlength - 1;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"uu_sym\")\n || CCTK_EQUALS (tensortypealias, \"dd_sym\"))\n {\n /* symmetric tensor */\n const int numcomps = 6;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = SYMTENSOR;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"uu\")\n || CCTK_EQUALS (tensortypealias, \"ud\")\n || CCTK_EQUALS (tensortypealias, \"du\")\n || CCTK_EQUALS (tensortypealias, \"dd\"))\n {\n /* non-symmetric tensor */\n const int numcomps = 9;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = TENSOR;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"4uu_sym\")\n || CCTK_EQUALS (tensortypealias, \"4dd_sym\"))\n {\n /* symmetric 4-tensor */\n const int numcomps = 10;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n if ((vi - firstvar) / vectorlength == 0) {\n ttype = SCALAR;\n tcomponent = 0;\n } else if ((vi - firstvar) / vectorlength <= 3) {\n ttype = VECTOR;\n tcomponent = (vi - firstvar) / vectorlength - 1;\n } else {\n ttype = SYMTENSOR;\n tcomponent = (vi - firstvar) / vectorlength - 4;\n }\n } else if (CCTK_EQUALS (tensortypealias, \"ddd_sym\")) {\n /* 3rd rank tensor, symmetric in last 2 indices */\n const int numcomps = 18;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = SYMTENSOR3;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"weylscalars_real\")) {\n /* Weyl scalars, stored as 10 real values. NOTE: This assumes\n that Psi_0 comes first, which is NOT the default with\n PsiKadelia. */\n const int numcomps = 10;\n assert (numvars % numcomps == 0 && numvars == numcomps * vectorlength);\n ttype = WEYLSCALARS_REAL;\n tcomponent = (vi - firstvar) / vectorlength;\n } else if (CCTK_EQUALS (tensortypealias, \"ManualCartesian\")) {\n /* Reflection symmetries specified by hand */\n ttype = MANUALCARTESIAN;\n tcomponent = vi - firstvar;\n } else {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Illegal tensor type alias \\\"%s\\\" for group \\\"%s\\\"\",\n tensortypealias, groupname);\n free (groupname);\n }\n \n switch (ttype) {\n case SCALAR:\n assert (tcomponent>=0 && tcomponent<1);\n break;\n case VECTOR:\n assert (tcomponent>=0 && tcomponent<3);\n break;\n case SYMTENSOR:\n assert (tcomponent>=0 && tcomponent<6);\n break;\n case SYMTENSOR3:\n assert (tcomponent>=0 && tcomponent<18);\n break;\n case TENSOR:\n assert (tcomponent>=0 && tcomponent<9);\n break;\n case WEYLSCALARS_REAL:\n assert (tcomponent>=0 && tcomponent<10);\n break;\n case MANUALCARTESIAN:\n /* No restriction on number of components */\n CoordinatesSymmetry_GetManualParities(table, gi, manual_parities);\n break;\n\n default:\n assert (0);\n }\n \n ierr = Util_TableGetInt (table, & tensorparity, \"tensorparity\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n tensorparity = +1;\n } else if (ierr<0) {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error in tensor parity declaration for group \\\"%s\\\": %d\",\n groupname, ierr);\n free (groupname);\n }\n \n \n \n /* Get and check stagger type information */\n ierr = Util_TableGetString\n (table, sizeof staggertype, staggertype, \"staggertype\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n /* assume cell centering */\n strcpy (staggertype, \"cell\");\n } else if (ierr<0) {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error in stagger type declaration for group \\\"%s\\\": %d\",\n groupname, ierr);\n free (groupname);\n }\n \n stype = ST_UNKNOWN;\n if (CCTK_EQUALS (staggertype, \"cell\")) {\n /* cell */\n stype = CELL;\n } else if (CCTK_EQUALS (staggertype, \"face\")) {\n /* face */\n stype = FACE;\n } else if (CCTK_EQUALS (staggertype, \"edge\")) {\n /* edge */\n stype = EDGE;\n } else if (CCTK_EQUALS (staggertype, \"vertex\")) {\n /* vertex */\n stype = VERTEX;\n } else {\n char * groupname = CCTK_GroupName(gi);\n assert (groupname);\n CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Illegal stagger type \\\"%s\\\" for group \\\"%s\\\"\",\n staggertype, groupname);\n free (groupname);\n }\n \n \n \n /* Reflection symmetry information */\n \n const int map = MultiPatch_GetMap(cctkGH);\n int type[6];\n int sym_dir[6];\n int overlap;\n ierr += MultiPatch_GetSymmetrySpecification(map, 6, type, &overlap, sym_dir);\n \n /* extract symmetry direction */\n \n for (dir=0; dir<3; ++dir) {\n for (face=0; face<2; ++face) {\n const int real_dir = sym_dir[2*dir+face];\n do_reflection[2*dir+face] = (reflection_x && real_dir == 0) || (reflection_y && real_dir == 1) || (reflection_z && real_dir == 2);\n if (do_reflection[2*dir+face] && type[2*dir+face] != 1) {\n CCTK_WARN(0, \"Reflection symmetry cannot be applied! Patch system not compatible with that!\");\n }\n }\n }\n \n /*\n do_reflection[0] = type[0] == 1 ? 1 : 0;\n do_reflection[1] = type[1] == 1 ? 1 : 0;\n do_reflection[2] = type[2] == 1 ? 1 : 0;\n do_reflection[3] = type[3] == 1 ? 1 : 0;\n do_reflection[4] = type[4] == 1 ? 1 : 0;\n do_reflection[5] = type[5] == 1 ? 1 : 0;\n */\n \n do_stagger_grid[0] = stagger;\n do_stagger_grid[1] = stagger;\n do_stagger_grid[2] = stagger;\n do_stagger_grid[3] = stagger;\n do_stagger_grid[4] = stagger;\n do_stagger_grid[5] = stagger;\n \n int bbox[6];\n ierr += MultiPatch_GetBbox(cctkGH, 6, bbox);\n \n /* Loop over all directions and faces */\n for (dir=0; dir<3; ++dir) {\n for (face=0; face<2; ++face) {\n /* If there is a reflection symmetry on that face */\n if (do_reflection[2*dir+face]) {\n /* If we have the outer boundary of that face */\n if (cctkGH->cctk_bbox[2*dir+face] && bbox[2*dir+face]) {\n \n const int real_dir = sym_dir[2*dir+face];\n \n /* Find parity */\n parity = tensorparity;\n switch (ttype) {\n case SCALAR:\n parity *= +1;\n break;\n case VECTOR:\n parity *= real_dir == tcomponent ? -1 : +1;\n break;\n case SYMTENSOR:\n switch (tcomponent) {\n case 0: parity *= +1; break;\n case 1: parity *= (real_dir == 0 || real_dir == 1) ? -1 : +1; break;\n case 2: parity *= (real_dir == 0 || real_dir == 2) ? -1 : +1; break;\n case 3: parity *= +1; break;\n case 4: parity *= (real_dir == 1 || real_dir == 2) ? -1 : +1; break;\n case 5: parity *= +1; break;\n default: assert (0);\n }\n break;\n case SYMTENSOR3:\n switch (tcomponent % 6) {\n case 0: parity *= +1; break;\n case 1: parity *= (real_dir == 0 || real_dir == 1) ? -1 : +1; break;\n case 2: parity *= (real_dir == 0 || real_dir == 2) ? -1 : +1; break;\n case 3: parity *= +1; break;\n case 4: parity *= (real_dir == 1 || real_dir == 2) ? -1 : +1; break;\n case 5: parity *= +1; break;\n default: assert (0);\n }\n switch (tcomponent / 6) {\n case 0: parity *= real_dir == 0 ? -1 : +1; break;\n case 1: parity *= real_dir == 1 ? -1 : +1; break;\n case 2: parity *= real_dir == 2 ? -1 : +1; break;\n default: assert (0);\n }\n break;\n case TENSOR:\n switch (tcomponent) {\n case 0: parity *= +1; break;\n case 1: parity *= (real_dir == 0 || real_dir == 1) ? -1 : +1; break;\n case 2: parity *= (real_dir == 0 || real_dir == 2) ? -1 : +1; break;\n case 3: parity *= (real_dir == 1 || real_dir == 0) ? -1 : +1; break;\n case 4: parity *= +1; break;\n case 5: parity *= (real_dir == 1 || real_dir == 2) ? -1 : +1; break;\n case 6: parity *= (real_dir == 2 || real_dir == 0) ? -1 : +1; break;\n case 7: parity *= (real_dir == 2 || real_dir == 1) ? -1 : +1; break;\n case 8: parity *= +1; break;\n default: assert (0);\n }\n break;\n case WEYLSCALARS_REAL: {\n static int const weylparities[10][3] =\n {{+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1},\n {+1,+1,+1},\n {-1,-1,-1}};\n parity *= weylparities[tcomponent][real_dir];\n break;\n }\n case MANUALCARTESIAN:\n parity = manual_parities[real_dir];\n break;\n default:\n assert (0);\n }\n \n /* Find staggering */\n do_stagger = do_stagger_grid[2*dir+face];\n switch (stype) {\n case CELL:\n /* do nothing */\n break;\n case FACE:\n assert (face == 0); /* assume lower face */\n assert (do_stagger); /* assume cell-centered grid */\n assert (ttype == VECTOR); /* TODO: support other tensor types */\n if (dir == tcomponent) do_stagger = !do_stagger;\n break;\n case EDGE:\n assert (face == 0); /* assume lower face */\n assert (do_stagger); /* assume cell-centered grid */\n assert (ttype == VECTOR); /* TODO: support other tensor types */\n if (dir != tcomponent) do_stagger = !do_stagger;\n break;\n case VERTEX:\n assert (face == 0); /* assume lower face */\n assert (do_stagger); /* assume cell-centered grid */\n do_stagger = !do_stagger;\n break;\n default:\n assert (0);\n }\n \n /* Find region extent */\n for (d=0; d<3; ++d) {\n ash[d] = cctkGH->cctk_ash[d];\n imin[d] = 0;\n imax[d] = cctkGH->cctk_lsh[d];\n ioff[d] = 0;\n idir[d] = 1;\n }\n /* To determine the correct expressions for ioff below,\n * consider the definitions of iimin and iimax in the macro\n * COPY_PRE above:\n *\n * iioff = ioff + (1 - idir) * imin\n * iimin = iioff + idir * imin\n * iimax = iioff + idir * imax\n *\n * We need idir = -1 since the loop copying into the\n * symmetry zones traverses the grid points in opposite\n * directions.\n *\n * Using the expressions above, one chooses the desired\n * values of iimin and iimax, and can then solve the\n * equations above for ioff.\n */\n if (face == 0) {\n imax[dir] = cctkGH->cctk_nghostzones[dir];\n ioff[dir] = (+ 2*(cctkGH->cctk_nghostzones[dir]) - 1 \n + (do_stagger ? 0 : 1));\n idir[dir] = -1;\n } else {\n imin[dir] = cctkGH->cctk_lsh[dir] - (cctkGH->cctk_nghostzones[dir]);\n ioff[dir] = - 1 - (do_stagger ? 0 : 1); \n idir[dir] = -1;\n }\n \n /* Ensure that there are sufficient interior zones, since\n this thorn does not support filling symmetry zones from\n other symmetry zones */\n {\n int const have_points = cctkGH->cctk_gsh[dir];\n int const need_points =\n 3 * (cctkGH->cctk_nghostzones[dir])\n + !do_stagger_grid[2*dir] + !do_stagger_grid[2*dir+1];\n if (need_points > have_points) {\n CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Cannot apply symmetry boundary zones in the %s %c direction, since there seem to be more symmetry zones than interior zones\",\n (face==0 ? \"lower\" : \"upper\"),\n \"xyz\"[dir]);\n }\n }\n \n /* Copy region */\n switch (group.vartype) {\n \n#define ARGS varptr, varptr, \\\n ash[0], ash[1], ash[2], \\\n imin[0], imin[1], imin[2], \\\n imax[0], imax[1], imax[2], \\\n ioff[0], ioff[1], ioff[2], \\\n idir[0], idir[1], idir[2], \\\n parity\n\n#ifdef HAVE_CCTK_INT1\n case CCTK_VARIABLE_INT1:\n#ifdef CCTK_INTEGER_PRECISION_1\n case CCTK_VARIABLE_INT:\n#endif\n copy_CCTK_INT1 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_INT2\n case CCTK_VARIABLE_INT2:\n#ifdef CCTK_INTEGER_PRECISION_2\n case CCTK_VARIABLE_INT:\n#endif\n copy_CCTK_INT2 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_INT4\n case CCTK_VARIABLE_INT4:\n#ifdef CCTK_INTEGER_PRECISION_4\n case CCTK_VARIABLE_INT:\n#endif\n copy_CCTK_INT4 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_INT8\n case CCTK_VARIABLE_INT8:\n#ifdef CCTK_INTEGER_PRECISION_8\n case CCTK_VARIABLE_INT:\n#endif\n copy_CCTK_INT8 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_INT16\n case CCTK_VARIABLE_INT16:\n#ifdef CCTK_INTEGER_PRECISION_16\n case CCTK_VARIABLE_INT:\n#endif\n copy_CCTK_INT16 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_REAL4\n case CCTK_VARIABLE_REAL4:\n#ifdef CCTK_REAL_PRECISION_4\n case CCTK_VARIABLE_REAL:\n#endif\n copy_CCTK_REAL4 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_REAL8\n case CCTK_VARIABLE_REAL8:\n#ifdef CCTK_REAL_PRECISION_8\n case CCTK_VARIABLE_REAL:\n#endif\n copy_CCTK_REAL8 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_REAL16\n case CCTK_VARIABLE_REAL16:\n#ifdef CCTK_REAL_PRECISION_16\n case CCTK_VARIABLE_REAL:\n#endif\n copy_CCTK_REAL16 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_COMPLEX8\n case CCTK_VARIABLE_COMPLEX8:\n#ifdef CCTK_COMPLEX_PRECISION_8\n case CCTK_VARIABLE_COMPLEX:\n#endif\n copy_CCTK_COMPLEX8 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_COMPLEX16\n case CCTK_VARIABLE_COMPLEX16:\n#ifdef CCTK_COMPLEX_PRECISION_16\n case CCTK_VARIABLE_COMPLEX:\n#endif\n copy_CCTK_COMPLEX16 (ARGS);\n break;\n#endif\n \n#ifdef HAVE_CCTK_COMPLEX32\n case CCTK_VARIABLE_COMPLEX32:\n#ifdef CCTK_COMPLEX_PRECISION_32\n case CCTK_VARIABLE_COMPLEX:\n#endif\n copy_CCTK_COMPLEX32 (ARGS);\n break;\n#endif\n \n#undef ARGS\n \n default:\n CCTK_WARN (0, \"Unsupported variable type\");\n }\n \n } /* if cctk_bbox */\n } /* if do_reflection */\n } /* for face */\n } /* for dir */\n \n /* Success */\n return 0;\n}\n\n\n\n/* When CoordBase is used to specify the location of the boundary\n points, then ensure that the CoordBase parameters and this thorn's\n parameters are consistent. */\nstatic\nvoid\nCheckBoundaryParameters (cGH const * restrict const cctkGH,\n int const vi,\n int const * restrict const stencil)\n{\n DECLARE_CCTK_PARAMETERS;\n \n static int did_check = 0;\n \n int type; /* Parameter type */\n void const * ptr; /* Pointer to parameter value */\n char const * coordtype; /* CartGrid3D::type */\n \n int dim; /* Number of dimensions of vi */\n \n CCTK_INT * restrict nboundaryzones; /* CoordBase boundary location */\n CCTK_INT * restrict is_internal;\n CCTK_INT * restrict is_staggered;\n CCTK_INT * restrict shiftout;\n \n int do_reflection[6]; /* This thorn's parameters */\n int do_stagger_grid[6];\n \n int d;\n int ierr;\n \n \n \n /* Check only once to save time */\n // TODO: This doesn't work with multiple maps!\n //if (did_check) return;\n \n /* Check only for grid functions */\n if (CCTK_GroupTypeFromVarI (vi) != CCTK_GF) return;\n \n did_check = 1;\n \n /* Check whether Coordinates is active */\n if (! CCTK_IsThornActive (\"CartGrid3D\")) return;\n \n /* Check whether CoordBase is used */\n ptr = CCTK_ParameterGet (\"type\", \"CartGrid3D\", & type);\n assert (ptr != 0);\n assert (type == PARAMETER_KEYWORD);\n coordtype = * (char const * const *) ptr;\n if (! CCTK_EQUALS (coordtype, \"multipatch\")) return;\n \n /* Get the boundary specification */\n dim = CCTK_GroupDimFromVarI (vi);\n assert (dim >= 0);\n nboundaryzones = malloc (2*dim * sizeof *nboundaryzones);\n is_internal = malloc (2*dim * sizeof *is_internal);\n is_staggered = malloc (2*dim * sizeof *is_staggered);\n shiftout = malloc (2*dim * sizeof *shiftout);\n const int map = MultiPatch_GetMap(cctkGH);\n ierr = MultiPatch_GetBoundarySpecification\n (map, 2*dim, nboundaryzones, is_internal, is_staggered, shiftout);\n assert (! ierr);\n \n /* Reflection symmetry information */\n assert(dim == 3);\n int btype[6];\n int sym_dir[6];\n int overlap;\n ierr += MultiPatch_GetSymmetrySpecification(map, 6, btype, &overlap, sym_dir);\n \n do_reflection[0] = btype[0] == 1 ? 1 : 0;\n do_reflection[1] = btype[1] == 1 ? 1 : 0;\n do_reflection[2] = btype[2] == 1 ? 1 : 0;\n do_reflection[3] = btype[3] == 1 ? 1 : 0;\n do_reflection[4] = btype[4] == 1 ? 1 : 0;\n do_reflection[5] = btype[5] == 1 ? 1 : 0;\n \n do_stagger_grid[0] = stagger;\n do_stagger_grid[1] = stagger;\n do_stagger_grid[2] = stagger;\n do_stagger_grid[3] = stagger;\n do_stagger_grid[4] = stagger;\n do_stagger_grid[5] = stagger;\n \n /* Check the boundary sizes */\n for (d=0; d<6; ++d) {\n if (do_reflection[d]) {\n char const dir = \"xyz\"[d/2];\n char const * const face = (d%2==0) ? \"lower\" : \"upper\";\n if (stencil[d/2] != nboundaryzones[d]) {\n CCTK_VWarn (CCTK_WARN_ABORT,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"The %s %c face is a symmetry boundary. Since there are %d ghost zones in the %c direction, the corresponding Coordinates boundary width must also be %d. The boundary width is currently %d.\",\n face, dir,\n stencil[d/2], dir, stencil[d/2],\n (int) nboundaryzones[d]);\n }\n if (is_internal[d]) {\n CCTK_VWarn (CCTK_WARN_ABORT,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"The %s %c face is a symmetry boundary. The corresponding Coordinates boundary must not be internal.\",\n face, dir);\n }\n if (do_stagger_grid[d] != is_staggered[d]) {\n CCTK_VWarn (CCTK_WARN_ABORT,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"The %s %c face of map %d is a symmetry boundary. The symmetry condition and the corresponding Coordinates boundary must either be both staggered or both not staggered.\",\n face, dir, map);\n }\n /*if ((do_stagger_grid[d] ? 0 : 1) != shiftout[d]) {\n CCTK_VWarn (CCTK_WARN_ABORT,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"The %s %c face is a symmetry boundary. If the symmetry condition is staggered, then the corresponding CoordBase shiftout must be 0; otherwise it must be 1.\",\n face, dir);\n }*/\n }\n }\n \n /* Free memory */\n free (nboundaryzones);\n free (is_internal);\n free (is_staggered);\n free (shiftout);\n}\n\n\n\nvoid\nCoordinatesSymmetry_Apply (CCTK_ARGUMENTS)\n{\n DECLARE_CCTK_ARGUMENTS;\n DECLARE_CCTK_PARAMETERS;\n \n int nvars;\n CCTK_INT * restrict indices;\n CCTK_INT * restrict faces;\n CCTK_INT * restrict widths;\n CCTK_INT * restrict tables;\n int vi;\n int dim;\n int * restrict stencil;\n int i;\n int istat;\n int ierr;\n \n if (verbose) {\n int reflevel = GetRefinementLevel(cctkGH);\n int map = MultiPatch_GetMap(cctkGH);\n \n printf(\"Applying reflecting BCs on map %d reflevel %d\\n\", map, reflevel);\n }\n \n nvars = Boundary_SelectedGVs (cctkGH, 0, NULL, NULL, NULL, NULL, NULL);\n if (nvars < 0) {\n CCTK_WARN (0, \"Internal error in Boundary_SelectedGVs\");\n }\n \n if (nvars == 0) {\n /* Nothing to do */\n return;\n }\n \n indices = malloc (nvars * sizeof *indices);\n if (! indices) {\n CCTK_WARN (0, \"Out of memory\");\n }\n faces = malloc (nvars * sizeof *faces);\n if (! faces) {\n CCTK_WARN (0, \"Out of memory\");\n }\n widths = malloc (nvars * sizeof *widths);\n if (! widths) {\n CCTK_WARN (0, \"Out of memory\");\n }\n tables = malloc (nvars * sizeof *tables);\n if (! tables) {\n CCTK_WARN (0, \"Out of memory\");\n }\n \n istat = Boundary_SelectedGVs\n (cctkGH, nvars, indices, faces, widths, tables, 0);\n if (istat != nvars) {\n CCTK_WARN (0, \"Internal error in Boundary_SelectedGVs\");\n }\n \n for (i=0; i<nvars; ++i) {\n vi = indices[i];\n if (vi < 0 || vi >= CCTK_NumVars()) {\n CCTK_WARN (0, \"Illegal variable index\");\n }\n \n if (widths[i] < 0) {\n CCTK_WARN (0, \"Illegal boundary width\");\n }\n \n dim = CCTK_GroupDimFromVarI (vi);\n if (dim < 0) {\n CCTK_WARN (0, \"Illegal dimension\");\n }\n \n stencil = malloc (dim * sizeof *stencil);\n if (! stencil) {\n CCTK_WARN (0, \"Out of memory\");\n }\n ierr = CCTK_GroupnghostzonesVI (cctkGH, dim, stencil, vi);\n if (ierr) {\n CCTK_WARN (0, \"Internal error in CCTK_GroupnghostzonesVI\");\n }\n \n CheckBoundaryParameters (cctkGH, vi, stencil);\n \n ierr = BndReflectVI (cctkGH, vi);\n if (ierr) {\n CCTK_WARN (0, \"Internal error in BndReflectVI\");\n }\n \n free (stencil);\n }\n \n free (indices);\n free (faces);\n free (widths);\n free (tables);\n}\n"
|
| 13 |
+
},
|
| 14 |
+
"test": {},
|
| 15 |
+
"doc": {}
|
| 16 |
+
}
|
Llama_GlobalDerivative.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Llama_Interpolate2.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thorn_name": "Llama/Interpolate2",
|
| 3 |
+
"url": "https://bitbucket.org/llamacode/llama.git",
|
| 4 |
+
"configuration": "REQUIRES Carpet TGRtensor LAPACK LoopControl\n\nREQUIRES THORNS: CarpetInterp2\n",
|
| 5 |
+
"interface": "IMPLEMENTS: Interpolate\n\nINHERITS: Coordinates grid\n\nUSES INCLUDE: tensortypes.h\nUSES INCLUDE: loopcontrol.h\n\nUSES INCLUDE: carpetinterp2.hh\n\n\n\nCCTK_INT FUNCTION \\\n GetRefinementLevel \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nREQUIRES FUNCTION GetRefinementLevel\n\n\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetMap \\\n (CCTK_POINTER_TO_CONST IN cctkGH)\nREQUIRES FUNCTION MultiPatch_GetMap\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetBbox \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY bbox)\nREQUIRES FUNCTION MultiPatch_GetBbox \n\nCCTK_INT FUNCTION \\\n MultiPatch_GetSymmetryBoundaries \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY symmbnd)\nREQUIRES FUNCTION MultiPatch_GetSymmetryBoundaries\n\nCCTK_INT FUNCTION \\\n MultiPatch_GetBoundarySpecification \\\n (CCTK_INT IN map, \\\n CCTK_INT IN size, \\\n CCTK_INT OUT ARRAY nboundaryzones, \\\n CCTK_INT OUT ARRAY is_internal, \\\n CCTK_INT OUT ARRAY is_staggered, \\\n CCTK_INT OUT ARRAY shiftout)\nREQUIRES FUNCTION MultiPatch_GetBoundarySpecification\n\nCCTK_INT FUNCTION \\\n MultiPatch_GlobalToLocal \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN ndims, \\\n CCTK_INT IN npoints, \\\n CCTK_POINTER_TO_CONST IN globalcoords, \\\n CCTK_INT ARRAY OUT patch, \\\n CCTK_POINTER IN localcoords, \\\n CCTK_POINTER IN dadx, \\\n CCTK_POINTER IN ddadxdx)\nUSES FUNCTION MultiPatch_GlobalToLocal\n\n\n\n#CCTK_INT FUNCTION \\\n# DriverInterpolate \\\n# (CCTK_POINTER_TO_CONST IN cctkGH, \\\n# CCTK_INT IN N_dims, \\\n# CCTK_INT IN local_interp_handle, \\\n# CCTK_INT IN param_table_handle, \\\n# CCTK_INT IN coord_system_handle, \\\n# CCTK_INT IN N_interp_points, \\\n# CCTK_INT IN interp_coords_type, \\\n# CCTK_POINTER_TO_CONST ARRAY IN interp_coords, \\\n# CCTK_INT IN N_input_arrays, \\\n# CCTK_INT ARRAY IN input_array_indices, \\\n# CCTK_INT IN N_output_arrays, \\\n# CCTK_INT ARRAY IN output_array_types, \\\n# CCTK_POINTER ARRAY IN output_arrays)\n#USES FUNCTION DriverInterpolate\n\n\n\nCCTK_INT FUNCTION \\\n Boundary_SelectVarForBC \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN faces, \\\n CCTK_INT IN boundary_width, \\\n CCTK_INT IN table_handle, \\\n CCTK_STRING IN var_name, \\\n CCTK_STRING IN bc_name)\nUSES FUNCTION Boundary_SelectVarForBC\n\nCCTK_INT FUNCTION \\\n Boundary_SelectedGVs \\\n (CCTK_POINTER_TO_CONST IN cctkGH, \\\n CCTK_INT IN array_size, \\\n CCTK_INT ARRAY OUT var_indicies, \\\n CCTK_INT ARRAY OUT faces, \\\n CCTK_INT ARRAY OUT boundary_widths, \\\n CCTK_INT ARRAY OUT table_handles, \\\n CCTK_STRING IN bc_name)\nREQUIRES FUNCTION Boundary_SelectedGVs\n\n\n\nPUBLIC:\nCCTK_INT source_patch TYPE=gf TAGS='Checkpoint=\"no\" Prolongation=\"none\"'\n{\n Sn\n} \"source patch number, -1 for interior points, -2 for outer boundary points, -3 for inter-processor ghost points, -4 for symmetry boundary points\"\n\n\n\nPRIVATE:\nCCTK_REAL test TYPE=gf TAGS='tensortypealias=\"Scalar\" Checkpoint=\"no\" Prolongation=\"none\"' \"Test grid function\"\n",
|
| 6 |
+
"params": "",
|
| 7 |
+
"schedule": "STORAGE: source_patch\n\nSCHEDULE Interpolate2Init AT basegrid AFTER (ChoosePatchSystem CorrectCoordinates SpatialCoordinates Coordinates_SetGlobalCoords_Group)\n{\n LANG: C\n READS: grid::coordinates\n READS: Coordinates::interpolate_boundary_points\n READS: Coordinates::jacobian\n WRITES: Sn(everywhere)\n} \"Initialise interpolating inter-patch boundaries\"\n\n\n\nif (continue_if_selftest_fails)\n{\n STORAGE: test\n}\n\nSCHEDULE GROUP Interpolate2Test AT basegrid AFTER Interpolate2Init\n{\n STORAGE: test\n} \"Test interpolating inter-patch boundaries\"\n\nSCHEDULE Interpolate2TestInit IN Interpolate2Test\n{\n LANG: C\n READS: grid::coordinates\n READS: Sn(everywhere)\n WRITES: test(everywhere)\n} \"Test: Initialise test grid function\"\n\nSCHEDULE Interpolate2TestSelectBCs IN Interpolate2Test AFTER Interpolate2TestInit\n{\n LANG: C\n OPTIONS: level\n SYNC: test\n} \"Test: Interpolate test grid function\"\n\nSCHEDULE GROUP ApplyBCs AS Interpolate2TestApplyBCs IN Interpolate2Test AFTER Interpolate2TestSelectBCs\n{\n OPTIONS: level\n} \"Test: Interpolate test grid function\"\n\nSCHEDULE Interpolate2TestCheck IN Interpolate2Test AFTER Interpolate2TestApplyBCs\n{\n LANG: C\n READS: grid::coordinates\n READS: Sn(everywhere)\n READS: test(everywhere)\n} \"Test: Check test grid function\"\n\n\n\nSCHEDULE Interpolate2ApplyBC IN BoundaryConditions\n{\n LANG: C\n OPTIONS: level\n READS: grid::coordinates\n READS: Coordinates::jacobian\n READS: Sn\n} \"Apply interpolating inter-patch boundaries\"\n",
|
| 8 |
+
"src": {
|
| 9 |
+
"make.code.defn": "# -*-Makefile-*-\n\nSRCS = init.cc interpolate.cc calc_inv3.F90 test.cc\n",
|
| 10 |
+
"test.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#include <cassert>\n\n#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include <loopcontrol.h>\n\n#include \"mask.h\"\n\n#ifndef DECLARE_CCTK_ARGUMENTS_CHECKED\n#define DECLARE_CCTK_ARGUMENTS_CHECKED(func) DECLARE_CCTK_ARGUMENTS\n#endif\n\n\n\nnamespace Interpolate2 {\n \n using namespace std;\n \n \n \n extern \"C\"\n void\n Interpolate2TestInit (CCTK_ARGUMENTS)\n {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2TestInit);\n DECLARE_CCTK_PARAMETERS;\n \n int const reflevel = GetRefinementLevel (cctkGH);\n // int const map = MultiPatch_GetMap (cctkGH);\n \n bool have_interpatch_boundary = false;\n#pragma omp parallel reduction(||: have_interpatch_boundary)\n LC_LOOP3 (Interpolate2TestInit,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n // Initialise all interior grid points with zero, and all\n // inter-patch boundary points with a non-zero value.\n if (Sn[ind3d] >= 0) {\n have_interpatch_boundary = true;\n test[ind3d] = poison;\n // test[ind3d] = (((1.0 * 100 + map) * 100 + i) * 100 + j) * 100 + k;\n } else {\n // Interior points, outer boundary points, and ghost points\n // are all legal sources for interpolation\n test[ind3d] = 0.0;\n }\n } LC_ENDLOOP3 (Interpolate2TestInit);\n \n if (reflevel > 0 and have_interpatch_boundary) {\n CCTK_VWarn (CCTK_WARN_ABORT,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Refinement level %d contains inter-patch boundaries; this is currently not supported\",\n reflevel);\n }\n }\n \n \n \n extern \"C\"\n void\n Interpolate2TestSelectBCs (CCTK_ARGUMENTS)\n {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2TestSelectBCs);\n DECLARE_CCTK_PARAMETERS;\n \n CCTK_INT const faces = CCTK_ALL_FACES;\n CCTK_INT const boundary_width = 0;\n CCTK_INT const table_handle = -1;\n \n CCTK_INT const ierr =\n Boundary_SelectVarForBC (cctkGH, faces, boundary_width, table_handle,\n \"Interpolate2::Test\", \"none\");\n assert (not ierr);\n }\n \n \n \n extern \"C\"\n void\n Interpolate2TestCheck (CCTK_ARGUMENTS)\n {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2TestCheck);\n DECLARE_CCTK_PARAMETERS;\n \n int const reflevel = GetRefinementLevel (cctkGH);\n int const map = MultiPatch_GetMap(cctkGH);\n \n int error_points = 0;\n\n LC_LOOP3 (Interpolate2TestCheck,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n // if (fabs(test[ind3d]) > 1e-6) {\n if (test[ind3d] != 0.0) {\n ++ error_points;\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Grid point [rl=%d,m=%d:%d,%d,%d] at (%g,%g,%g) is interpolated from an inter-patch boundary point (source_patch=%d, test value=%.17g)\",\n reflevel, map, (int) i, (int) j, (int) k,\n (double) x[ind3d], (double) y[ind3d], (double) z[ind3d],\n (int) Sn[ind3d], (double) test[ind3d]);\n }\n } LC_ENDLOOP3 (Interpolate2TestCheck);\n \n if (error_points > 0) {\n int const warnlevel =\n continue_if_selftest_fails ? CCTK_WARN_ALERT : CCTK_WARN_ABORT;\n CCTK_VWarn (warnlevel,\n __LINE__, __FILE__, CCTK_THORNSTRING,\n \"There were %d grid points which are interpolated from boundary points. You may need to increase Coordinates::additional_overlap_size.\",\n error_points\n );\n }\n }\n \n} // namespace Interpolate2\n",
|
| 11 |
+
"mask.h": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#ifndef INTERPOLATE2_MASK_H\n#define INTERPOLATE2_MASK_H\n\n/* Note: These values must be consistent with the declaration of the\n group source_patch in interface.ccl */\n#define SOURCE_PATCH_INTERIOR -1\n#define SOURCE_PATCH_OUTER -2\n#define SOURCE_PATCH_GHOST -3\n#define SOURCE_PATCH_SYMMETRY -4\n\n#endif /* #ifndef INTERPOLATE2_MASK_H */\n",
|
| 12 |
+
"interpolate.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#include <cassert>\n#include <cmath>\n#include <cstdlib>\n#include <cstring>\n#include <list>\n#include <vector>\n\n#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n#include <util_Table.h>\n\n#include <carpet.hh>\n#include <loopcontrol.h>\n\n#include <carpetinterp2.hh>\n\n#ifndef DECLARE_CCTK_ARGUMENTS_CHECKED\n#define DECLARE_CCTK_ARGUMENTS_CHECKED(func) DECLARE_CCTK_ARGUMENTS\n#endif\n\n\n\nnamespace Interpolate2 {\n \n using namespace std;\n using namespace Carpet;\n using namespace CarpetInterp2;\n \n \n \n struct jacobian_t {\n CCTK_REAL J[3][3]; // J[a][b]\n CCTK_REAL det() const\n {\n return fabs(+ J[0][0]*(+ J[1][1]*J[2][2]\n - J[1][2]*J[2][1])\n + J[0][1]*(+ J[1][2]*J[2][0]\n - J[1][0]*J[2][2])\n + J[0][2]*(+ J[1][0]*J[2][1]\n - J[1][1]*J[2][0]));\n }\n };\n \n struct scatter_setup_t {\n int m; // map\n int c; // component\n vector<int> indices; // 3D indices of grid points\n int npoints;\n };\n \n template <typename FASTERP>\n struct interp2_setup_gen_t {\n list<scatter_setup_t> scatter_setups;\n FASTERP * fasterp_setup;\n // Jacobians for transforming local components\n vector<jacobian_t> jacobian_th; // J[a][b] = d[there]^a / d[here]^b\n vector<jacobian_t> jacobian_ht; // J[a][b] = d[here]^a / d[there]^b\n int npoints;\n \n interp2_setup_gen_t () : fasterp_setup (NULL), npoints (0) {}\n ~interp2_setup_gen_t () { if (fasterp_setup) delete fasterp_setup; }\n \n // Forbid copying\n private:\n interp2_setup_gen_t (interp2_setup_gen_t const &);\n interp2_setup_gen_t& operator= (interp2_setup_gen_t const &);\n };\n \n typedef interp2_setup_gen_t<fasterp_setup_t> interp2_setup_t;\n \n typedef interp2_setup_gen_t<fasterp_eno2_setup_t> interp2_setup_eno2_t;\n \n \n \n // LAPACK wrapper to invert generic 3x3 matrices\n extern \"C\" CCTK_FCALL void CCTK_FNAME(IP2_calc_inv3)\n (CCTK_REAL const * restrict g3, CCTK_REAL * restrict gu3);\n \n \n \n // Global variable containing the interpolation setups.\n // This is the standard Lagrange interpolator\n vector<interp2_setup_t *> interp2_setups;\n \n // This is a 1st-order Lagrange matter interpolator.\n vector<interp2_setup_t *> interp2_setups_matter_1st;\n \n // This is a 2nd-order ENO matter interpolator.\n vector<interp2_setup_eno2_t *> interp2_setups_matter_2nd;\n \n \n \n // Calculate Jacobians of the coordinate transformations\n template <typename FASTERP>\n static void\n setup_coordinate_transformation (CCTK_ARGUMENTS,\n interp2_setup_gen_t<FASTERP> & interp2_setup)\n {\n // Do nothing if the coordinates have already been set up\n if (not interp2_setup.jacobian_ht.empty() or interp2_setup.npoints == 0) {\n return;\n }\n \n // Allocate memory for the Jacobians\n interp2_setup.jacobian_ht.resize (interp2_setup.npoints);\n interp2_setup.jacobian_th.resize (interp2_setup.npoints);\n \n // Loop over all components and maps\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup.scatter_setups.begin();\n int pos = 0;\n BEGIN_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n // Obtain global coordinates for all grid points\n vector<CCTK_REAL> globalcoords[3];\n CCTK_REAL * globalcoords_ptr[3];\n for (int d=0; d<3; ++d) {\n globalcoords[d].resize (scatter_setup.npoints);\n globalcoords_ptr[d] = &globalcoords[d].front();\n }\n for (int i=0; i<scatter_setup.npoints; ++i) {\n int const ind3d = scatter_setup.indices.AT(i);\n globalcoords[0].AT(i) = x[ind3d];\n globalcoords[1].AT(i) = y[ind3d];\n globalcoords[2].AT(i) = z[ind3d];\n }\n \n // Allocate memory for patch numbers, local coordinates, and\n // the \"other\" Jacobian of these grid points (i.e., where\n // they are interpolated from)\n vector<CCTK_INT> patch (scatter_setup.npoints);\n CCTK_INT * const patch_ptr = &patch.front();\n CCTK_REAL * localcoords_ptr[3];\n vector<CCTK_REAL> localcoords[3];\n for (int d=0; d<3; ++d) {\n localcoords[d].resize (scatter_setup.npoints);\n localcoords_ptr[d] = &localcoords[d].front();\n }\n vector<CCTK_REAL> dadx[3][3]; // dadx[d][e] = J.J[d][e]\n CCTK_REAL * dadx_ptr[9];\n for (int d=0; d<3; ++d) {\n for (int e=0; e<3; ++e) {\n dadx[e][d].resize (scatter_setup.npoints);\n dadx_ptr[d*3+e] = &dadx[e][d].front();\n }\n }\n \n // Calculate patch numbers, local coordinates, and the\n // \"other\" Jacobian of these grid points\n int const ierr = MultiPatch_GlobalToLocal\n (cctkGH, 3, scatter_setup.npoints,\n globalcoords_ptr,\n patch_ptr, localcoords_ptr, dadx_ptr, NULL);\n assert (not ierr);\n \n // Set up pointers to the \"local\" Jacobians, which are\n // stored in grid functions\n CCTK_REAL const * restrict Jh_ptr[3][3];\n // Jh[a][b] = d[local]^a/d[global]^b\n Jh_ptr[0][0] = J11;\n Jh_ptr[0][1] = J12;\n Jh_ptr[0][2] = J13;\n Jh_ptr[1][0] = J21;\n Jh_ptr[1][1] = J22;\n Jh_ptr[1][2] = J23;\n Jh_ptr[2][0] = J31;\n Jh_ptr[2][1] = J32;\n Jh_ptr[2][2] = J33;\n \n // Calculate the combined Jacobian for all grid points\n for (int i=0; i<scatter_setup.npoints; ++i) {\n int const ind3d = scatter_setup.indices.AT(i);\n \n // reference to the combined Jacobians\n jacobian_t & Jht = interp2_setup.jacobian_ht.AT(pos+i);\n jacobian_t & Jth = interp2_setup.jacobian_th.AT(pos+i);\n \n // the \"here\" (local) Jacobian for this grid point\n jacobian_t Jh;\n for (int d=0; d<3; ++d) {\n for (int e=0; e<3; ++e) {\n Jh.J[d][e] = Jh_ptr[d][e][ind3d];\n }\n }\n \n // the \"there\" (other) Jacobian for this grid point --\n // actually, the inverse of what we need later\n jacobian_t Jti;\n for (int d=0; d<3; ++d) {\n for (int e=0; e<3; ++e) {\n Jti.J[d][e] = dadx[d][e][i];\n }\n }\n \n // the \"there\" Jacobian\n jacobian_t Jt;\n \n // Calculate the \"there\" Jacobian by calling LAPACK to\n // invert the inverse Jacobian\n CCTK_FNAME(IP2_calc_inv3) (&Jti.J[0][0], &Jt.J[0][0]);\n \n // These are our definitions and their transformation\n // rules:\n \n // Jti^a_b = d[there]^a/d[global]^b\n // Jt^a_b = d[global]^a/d[there]^b\n \n // Jh^a_b = d[here]^a/d[global]^b\n \n // Jht^a_b = d[here]^a/d[there]^b\n // = d[here]^a/d[global]^c d[global]^c/d[there]^b\n // = Jh^a_c Jt^c_b\n \n // Calculate the above\n for (int d=0; d<3; ++d) {\n for (int e=0; e<3; ++e) {\n Jht.J[d][e] = 0;\n for (int f=0; f<3; ++f) {\n Jht.J[d][e] += Jh.J[d][f] * Jt.J[f][e];\n }\n }\n }\n \n // Invert this to obtain the inverse combined Jacobian\n CCTK_FNAME(IP2_calc_inv3) (&Jht.J[0][0], &Jth.J[0][0]);\n \n } // for i\n \n } // DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC)\n \n ++ scatter_setup_it;\n pos += scatter_setup.npoints;\n } END_LOCAL_COMPONENT_LOOP;\n } END_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup.scatter_setups.end());\n assert (pos == interp2_setup.npoints);\n }\n \n \n \n // Transform the coordinates in the interpolated grid points\n template <typename FASTERP>\n static void\n transform_coordinates (CCTK_ARGUMENTS,\n int const nvars,\n vector<CCTK_INT> const & indices,\n vector<CCTK_REAL *> const & values,\n interp2_setup_gen_t<FASTERP> & interp2_setup)\n {\n // Loop over all interpolated variables\n for (int n = 0; n < nvars; ++ n) {\n \n // Get some information for these variables\n int const vi = indices.AT(n);\n assert (vi>=0 and vi<CCTK_NumVars());\n int const gi = CCTK_GroupIndexFromVarI (vi);\n assert (gi>=0 and gi<CCTK_NumGroups());\n int const v0 = CCTK_FirstVarIndexI (gi);\n assert (v0>=0 and v0<=vi);\n \n cGroup groupdata;\n {\n int const ierr = CCTK_GroupData (gi, &groupdata);\n assert (not ierr);\n }\n \n char jacobian[100];\n {\n int const ierr = Util_TableGetString\n (groupdata.tagstable, sizeof jacobian, jacobian, \"jacobian\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n strcpy (jacobian, \"\");\n } else if (ierr<0) {\n char * const fullname = CCTK_FullName (vi);\n CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error while getting entry \\\"jacobian\\\" from tags table of variable \\\"%s\\\"\",\n fullname);\n free (fullname);\n }\n }\n \n // If the grid variable does not have a Jacobian in its tags, do\n // nothing\n if (strcmp (jacobian, \"\") != 0) {\n \n // Set up the coordinate transformation\n setup_coordinate_transformation (CCTK_PASS_CTOC, interp2_setup);\n \n // Find the tensor type\n char tensortypealias[100];\n // Only scalars, vectors, and co-vectors are supported yet, as\n // this is what hydro needs. Support for other types could\n // easily be added.\n enum tensortype_t { tt_unknown, tt_scalar, tt_d, tt_u };\n tensortype_t tensortype;\n {\n int const ierr = Util_TableGetString\n (groupdata.tagstable,\n sizeof tensortypealias, tensortypealias, \"tensortypealias\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n tensortype = tt_unknown;\n } else if (ierr<0) {\n CCTK_VERROR(\"Could not obtain 'tensortypealias' tag: %d\", ierr);\n } else {\n if (CCTK_EQUALS (tensortypealias, \"scalar\")) {\n tensortype = tt_scalar;\n } else if (CCTK_EQUALS (tensortypealias, \"d\")) {\n tensortype = tt_d;\n } else if (CCTK_EQUALS (tensortypealias, \"u\")) {\n tensortype = tt_u;\n } else {\n tensortype = tt_unknown;\n }\n }\n }\n \n CCTK_REAL tensorweight = NAN;\n {\n int const ierr = Util_TableGetReal\n (groupdata.tagstable,\n &tensorweight, \"tensorweight\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n tensorweight = 0;\n } else if (ierr<0) {\n CCTK_VERROR(\"Could not obtain 'tensorweight' tag: %d\", ierr);\n } else {\n // nothing to do anymore\n }\n }\n \n switch (tensortype) {\n \n case tt_scalar: {\n // do nothing, if tensorweight == 0\n if (tensorweight == 0.0) break;\n for (int i=0; i<interp2_setup.npoints; ++i) {\n jacobian_t const & J = interp2_setup.jacobian_th.AT(i);\n values.at(n)[i] *= pow(J.det(), tensorweight);\n }\n break;\n }\n \n case tt_d: {\n assert (groupdata.numvars == 3);\n if (vi == v0) {\n \n // find all components\n int comp[3];\n for (int d=0; d<3; ++d) {\n for (int nn=0; nn<nvars; ++nn) {\n if (indices.AT(nn) == v0+d) {\n comp[d] = nn;\n goto found_d;\n }\n }\n CCTK_VERROR(\"Could not find x,y,z components for group '%s' among the interpolated variables\",\n CCTK_GroupNameFromVarI(v0));\n found_d:;\n }\n \n // get variable pointers\n assert (groupdata.vartype == CCTK_VARIABLE_REAL);\n CCTK_REAL * restrict ptrs[3];\n for (int d=0; d<3; ++d) {\n ptrs[d] = values.at(comp[d]);\n assert (interp2_setup.npoints==0 or ptrs[d]);\n }\n \n // transform all interpolated points\n for (int i=0; i<interp2_setup.npoints; ++i) {\n CCTK_REAL there[3];\n for (int d=0; d<3; ++d) {\n there[d] = ptrs[d][i];\n }\n jacobian_t const & J = interp2_setup.jacobian_th.AT(i);\n CCTK_REAL here[3];\n for (int d=0; d<3; ++d) {\n here[d] = 0;\n for (int e=0; e<3; ++e) {\n // [here]_d = d[there]^e/d[here]^d [there]_e\n here[d] += J.J[e][d] * there[e];\n }\n }\n jacobian_t const & Jdet = interp2_setup.jacobian_th.AT(i);\n const CCTK_REAL det =\n tensorweight == 0 ? 1.0 : pow(Jdet.det(), tensorweight);\n for (int d=0; d<3; ++d) {\n ptrs[d][i] = here[d] * det;\n }\n }\n \n } // if vi==v0\n break;\n } // case tt_d\n \n case tt_u: {\n assert (groupdata.numvars == 3);\n if (vi == v0) {\n \n // find all components\n int comp[3];\n for (int d=0; d<3; ++d) {\n for (int nn=0; nn<nvars; ++nn) {\n if (indices.AT(nn) == v0+d) {\n comp[d] = nn;\n goto found_u;\n }\n }\n CCTK_VERROR(\"Could not find x,y,z components for group '%s' among the interpolated variables\",\n CCTK_GroupNameFromVarI(v0));\n found_u:;\n }\n \n // get variable pointers\n assert (groupdata.vartype == CCTK_VARIABLE_REAL);\n CCTK_REAL * restrict ptrs[3];\n for (int d=0; d<3; ++d) {\n ptrs[d] = values.at(comp[d]);\n assert (interp2_setup.npoints==0 or ptrs[d]);\n }\n \n // transform all interpolated points\n for (int i=0; i<interp2_setup.npoints; ++i) {\n CCTK_REAL there[3];\n for (int d=0; d<3; ++d) {\n there[d] = ptrs[d][i];\n }\n jacobian_t const & J = interp2_setup.jacobian_ht.AT(i);\n CCTK_REAL here[3];\n for (int d=0; d<3; ++d) {\n here[d] = 0;\n for (int e=0; e<3; ++e) {\n // [here]^d = d[here]^d/d[there]^e [there]^e\n here[d] += J.J[d][e] * there[e];\n }\n }\n jacobian_t const & Jdet = interp2_setup.jacobian_th.AT(i);\n const CCTK_REAL det =\n tensorweight == 0 ? 1.0 : pow(Jdet.det(), tensorweight);\n for (int d=0; d<3; ++d) {\n ptrs[d][i] = here[d] * det;\n }\n }\n \n } // if vi==v0\n break;\n } // case tt_u\n \n default: {\n char * const fullname = CCTK_FullName (vi);\n CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Unknown or unsupported tensor type alias \\\"%s\\\" for variable \\\"%s\\\"\",\n tensortypealias, fullname);\n free (fullname);\n }\n \n } // switch tensortype\n \n } // if jacobian != \"\"\n \n } // for n\n }\n \n \n \n extern \"C\"\n void\n Interpolate2ApplyBC (CCTK_ARGUMENTS)\n {\n DECLARE_CCTK_PARAMETERS;\n\n assert (cctkGH);\n \n assert (cctkGH->cctk_dim == 3);\n \n \n \n int nvars = Boundary_SelectedGVs (cctkGH, 0, 0, 0, 0, 0, 0);\n assert (nvars>=0);\n if (verbose) CCTK_VInfo (CCTK_THORNSTRING,\n \"Interpolating to %d variables\", nvars);\n if (nvars == 0) return;\n \n vector<CCTK_INT> indices (nvars);\n vector<CCTK_INT> faces (nvars);\n vector<CCTK_INT> widths (nvars);\n vector<CCTK_INT> tables (nvars);\n \n {\n int const iret =\n Boundary_SelectedGVs\n (cctkGH, nvars,\n & indices.front(), & faces.front(), & widths.front(), & tables.front(),\n 0);\n assert (iret == nvars);\n }\n \n // Initially, we assume no matter variables, i.e. we use the standard interpolator!\n int nvars_matter = 0;\n vector<CCTK_INT> indices_matter (0);\n \n // Check all variables and get interpolator\n for (int i=0; i<nvars; ++i) {\n \n int const vi = indices[i];\n assert (vi>=0 and vi<CCTK_NumVars());\n \n assert (widths[i] >= 0);\n \n int const gi = CCTK_GroupIndexFromVarI (vi);\n assert (gi>=0 and gi<CCTK_NumGroups());\n \n cGroup group;\n int const ierr = CCTK_GroupData (gi, &group);\n assert (not ierr);\n \n assert (group.grouptype == CCTK_GF);\n assert (group.vartype == CCTK_VARIABLE_REAL);\n assert (group.disttype == CCTK_DISTRIB_DEFAULT);\n \n // If requested, get interpolator from variables and sort variable indices accordingly\n if (interpolator_order_matter >= 0)\n {\n char interpolator[100];\n int const ierr = Util_TableGetString\n (group.tagstable, sizeof interpolator, interpolator, \"interpolator\");\n if (ierr == UTIL_ERROR_TABLE_NO_SUCH_KEY) {\n strcpy (interpolator, \"\");\n } else if (ierr<0) {\n char * const fullname = CCTK_FullName (vi);\n CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"Error while getting entry \\\"interpolator\\\" from tags table of variable \\\"%s\\\"\",\n fullname);\n free (fullname);\n }\n if (CCTK_EQUALS(interpolator, \"matter\"))\n {\n // remove var from standard Lagrange interpolation\n // and add to matter interpolator!\n --nvars;\n ++nvars_matter;\n indices_matter.push_back(indices[i]);\n indices.erase(indices.begin()+i);\n --i;\n }\n }\n \n }\n \n \n \n // Work only on the coarsest grid\n if (Carpet::reflevel > 0) return;\n \n \n // Check, if standard Lagrange interpolator has\n // something to do, or if it is the matter interpolator\n // that needs to do all the work!\n if (nvars != 0)\n {\n \n // Adjust size of interpolation setups\n interp2_setups.resize (Carpet::maxreflevels, NULL);\n \n \n \n assert (is_level_mode());\n if (not interp2_setups.AT(Carpet::reflevel) or\n interp2_setups.AT(Carpet::reflevel)->fasterp_setup->outofdate()) {\n if (interp2_setups.AT(Carpet::reflevel))\n delete interp2_setups.AT(Carpet::reflevel);\n interp2_setups.AT(Carpet::reflevel) = new interp2_setup_t;\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Setting up interpolation for level %d\", Carpet::reflevel);\n }\n interp2_setup_t & interp2_setup = * interp2_setups.AT(Carpet::reflevel);\n \n if (not interp2_setup.fasterp_setup) {\n if (verbose) CCTK_INFO (\"Preparing setting up interpolation\");\n \n assert (interp2_setup.scatter_setups.empty());\n assert (interp2_setup.npoints == 0);\n \n // Count points\n if (verbose) CCTK_INFO (\"Counting grid points\");\n \n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n int npoints = 0;\n#pragma omp parallel reduction (+: npoints)\n LC_LOOP3 (count_points,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n ++ npoints;\n }\n } LC_ENDLOOP3 (count_points);\n \n scatter_setup_t scatter_setup;\n scatter_setup.m = Carpet::map;\n scatter_setup.c = Carpet::component;\n scatter_setup.npoints = npoints;\n \n interp2_setup.scatter_setups.push_back (scatter_setup);\n interp2_setup.npoints += scatter_setup.npoints;\n \n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n \n // Allocate storage for coordinates and values\n fasterp_glocs_t locations (interp2_setup.npoints);\n \n // Collect coordinates\n if (verbose) CCTK_INFO (\"Collecting coordinates\");\n \n list<scatter_setup_t>::iterator scatter_setup_it =\n interp2_setup.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup.scatter_setups.end());\n scatter_setup_t & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n int const di = 1;\n assert(di ==\n CCTK_GFINDEX3D(cctkGH, 1,0,0) - CCTK_GFINDEX3D(cctkGH, 0,0,0));\n int const dj =\n CCTK_GFINDEX3D(cctkGH, 0,1,0) - CCTK_GFINDEX3D(cctkGH, 0,0,0);\n \n scatter_setup.indices.reserve (scatter_setup.npoints);\n \n // This loop is not parallel\n //#pragma omp parallel reduction (+: pos)\n LC_LOOP3 (collect_coordinates,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_ash[0], cctk_ash[1], cctk_ash[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n locations.coords[0].AT(pos) = x[ind3d];\n locations.coords[1].AT(pos) = y[ind3d];\n locations.coords[2].AT(pos) = z[ind3d];\n if (shift_edges) {\n bool const ilo = cctk_lbnd[0] + i == 0;\n bool const jlo = cctk_lbnd[1] + j == 0;\n bool const klo = cctk_lbnd[2] + k == 0;\n bool const ihi = cctk_lbnd[0] + i == cctk_gsh[0]-1;\n bool const jhi = cctk_lbnd[1] + j == cctk_gsh[1]-1;\n bool const khi = cctk_lbnd[2] + k == cctk_gsh[2]-1;\n if (ilo && (jlo || jhi || klo || khi)) {\n locations.coords[0].AT(pos) = x[ind3d+di];\n locations.coords[1].AT(pos) = y[ind3d+di];\n locations.coords[2].AT(pos) = z[ind3d+di];\n } else if (ihi && (jlo || jhi || klo || khi)) {\n locations.coords[0].AT(pos) = x[ind3d-di];\n locations.coords[1].AT(pos) = y[ind3d-di];\n locations.coords[2].AT(pos) = z[ind3d-di];\n } else if (jlo && (klo || khi)) {\n locations.coords[0].AT(pos) = x[ind3d+dj];\n locations.coords[1].AT(pos) = y[ind3d+dj];\n locations.coords[2].AT(pos) = z[ind3d+dj];\n } else if (jhi && (klo || khi)) {\n locations.coords[0].AT(pos) = x[ind3d-dj];\n locations.coords[1].AT(pos) = y[ind3d-dj];\n locations.coords[2].AT(pos) = z[ind3d-dj];\n }\n } // if shift_edges\n scatter_setup.indices.push_back (ind3d);\n ++ pos;\n }\n } LC_ENDLOOP3 (collect_coordinates);\n \n assert (int(scatter_setup.indices.size()) == scatter_setup.npoints);\n\n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup.scatter_setups.end());\n assert (pos == interp2_setup.npoints);\n \n // Create the interpolation setup\n if (verbose) {\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Creating interpolation setup for %d grid points\",\n interp2_setup.npoints);\n }\n \n assert (not interp2_setup.fasterp_setup);\n interp2_setup.fasterp_setup =\n new fasterp_setup_t (cctkGH, locations, interpolator_order);\n \n } // if not interp2_setup.fasterp_setup\n \n \n \n // Poison boundaries, so that they are not accidentally used as\n // interpolation source\n if (verbose) CCTK_INFO (\"Poisoning inter-patch boundaries\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup.scatter_setups.begin();\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars; ++ n) {\n \n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices.AT(n)));\n assert (var);\n \n#pragma omp parallel for\n for (int i=0; i<int(scatter_setup.indices.size()); ++i) {\n var[scatter_setup.indices.AT(i)] = NAN; // poison;\n }\n \n#if 0\n#pragma omp parallel\n LC_LOOP3 (check_poison_before,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_ash[0], cctk_ash[1], cctk_ash[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n assert(CCTK_isnan(var[ind3d]) || fabs(var[ind3d]) >= 1.0e+10);\n } else {\n assert(!CCTK_isnan(var[ind3d]) && fabs(var[ind3d]) <= 1.0e+100);\n }\n } LC_ENDLOOP3 (check_poison_before);\n#endif\n \n } // for n\n \n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup.scatter_setups.end());\n }\n \n \n \n // Interpolate\n if (verbose) CCTK_INFO (\"Interpolating\");\n \n vector<int> varinds (nvars);\n for (int n=0; n<nvars; ++n) {\n varinds.AT(n) = indices.AT(n);\n }\n \n vector<vector<CCTK_REAL> > valuess (nvars);\n vector<CCTK_REAL *> values (nvars);\n for (int n=0; n<nvars; ++n) {\n valuess.AT(n).resize (interp2_setup.npoints, NAN); // poison;\n values.AT(n) = & valuess.AT(n).front();\n }\n \n interp2_setup.fasterp_setup->interpolate (cctkGH, varinds, values);\n \n \n \n // Transform coordinates in result\n if (verbose) CCTK_INFO (\"Transforming coordinates\");\n \n transform_coordinates (CCTK_PASS_CTOC, nvars, indices, values, interp2_setup);\n \n \n \n // Write back result\n if (verbose) CCTK_INFO (\"Writing back interpolation result\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars; ++ n) {\n \n if (verbose) {\n char * restrict const fullname = CCTK_FullName (indices.AT(n));\n const int patch = MultiPatch_GetMap(cctkGH);\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Filling variable #%d %s patch %d\",\n n, fullname, patch);\n free (fullname);\n }\n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices.AT(n)));\n assert (var);\n \n if (interpolate_zero) {\n // for debugging only\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = 0.0;\n }\n \n } else {\n // regular case\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = valuess.AT(n).AT(pos + i);\n }\n \n }\n \n } // for n\n \n ++ scatter_setup_it;\n pos += scatter_setup.npoints;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup.scatter_setups.end());\n assert (pos == interp2_setup.npoints);\n }\n \n } // nvars != 0\n \n \n // Treat matter variables differently...?\n if (interpolator_order_matter < 0) {\n if (verbose) CCTK_INFO (\"Done.\");\n return;\n }\n \n // ...no? Then let's do special matter interpolation!\n \n /////////////////////////////////////////////////////////////////////////////////////\n //\n // Standard Lagrange interpolation ends.\n // Below, we exclusively interpolate matter variables with another interp_setup!\n //\n ////////////////////////////////////////////////////////////////////////////////////\n \n \n \n if (verbose) CCTK_VInfo (CCTK_THORNSTRING,\n \"Interpolating to %d matter variables\", nvars_matter);\n if (nvars_matter == 0) {\n if (verbose) CCTK_INFO (\"Done.\");\n return;\n }\n \n //\n // 1st-order Lagrange interpolation!\n //\n \n if (interpolator_order_matter == 1)\n {\n \n typedef interp2_setup_t interp2_setup_matter_t;\n \n // Adjust size of interpolation setups\n interp2_setups_matter_1st.resize (Carpet::maxreflevels, NULL);\n \n \n \n assert (is_level_mode());\n if (not interp2_setups_matter_1st.AT(Carpet::reflevel) or\n interp2_setups_matter_1st.AT(Carpet::reflevel)->fasterp_setup->outofdate()) {\n if (interp2_setups_matter_1st.AT(Carpet::reflevel))\n delete interp2_setups_matter_1st.AT(Carpet::reflevel);\n interp2_setups_matter_1st.AT(Carpet::reflevel) = new interp2_setup_matter_t;\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Setting up matter interpolation for level %d\", Carpet::reflevel);\n }\n interp2_setup_matter_t & interp2_setup_matter = * interp2_setups_matter_1st.AT(Carpet::reflevel);\n \n if (not interp2_setup_matter.fasterp_setup) {\n if (verbose) CCTK_INFO (\"Preparing setting up matter interpolation\");\n \n assert (interp2_setup_matter.scatter_setups.empty());\n assert (interp2_setup_matter.npoints == 0);\n \n // Count points\n if (verbose) CCTK_INFO (\"Counting grid points for matter interpolation\");\n \n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n int npoints = 0;\n#pragma omp parallel reduction (+: npoints)\n LC_LOOP3 (count_points,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n ++ npoints;\n }\n } LC_ENDLOOP3 (count_points);\n \n scatter_setup_t scatter_setup;\n scatter_setup.m = Carpet::map;\n scatter_setup.c = Carpet::component;\n scatter_setup.npoints = npoints;\n \n interp2_setup_matter.scatter_setups.push_back (scatter_setup);\n interp2_setup_matter.npoints += scatter_setup.npoints;\n \n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n \n // Allocate storage for coordinates and values\n fasterp_glocs_t locations (interp2_setup_matter.npoints);\n \n // Collect coordinates\n if (verbose) CCTK_INFO (\"Collecting coordinates for matter interpolation\");\n \n list<scatter_setup_t>::iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n scatter_setup.indices.reserve (scatter_setup.npoints);\n \n // This loop is not parallel\n //#pragma omp parallel reduction (+: pos)\n LC_LOOP3 (collect_coordinates,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_ash[0], cctk_ash[1], cctk_ash[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n locations.coords[0].AT(pos) = x[ind3d];\n locations.coords[1].AT(pos) = y[ind3d];\n locations.coords[2].AT(pos) = z[ind3d];\n scatter_setup.indices.push_back (ind3d);\n ++ pos;\n }\n } LC_ENDLOOP3 (collect_coordinates);\n \n assert (int(scatter_setup.indices.size()) == scatter_setup.npoints);\n \n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n assert (pos == interp2_setup_matter.npoints);\n \n // Create the interpolation setup\n if (verbose) {\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Creating matter interpolation setup for %d grid points\",\n interp2_setup_matter.npoints);\n }\n \n assert (not interp2_setup_matter.fasterp_setup);\n interp2_setup_matter.fasterp_setup =\n new fasterp_setup_t (cctkGH, locations, interpolator_order_matter);\n \n } // if not interp2_setup_matter.fasterp_setup\n \n \n \n // Poison boundaries, so that they are not accidentally used as\n // interpolation source\n if (verbose) CCTK_INFO (\"Poisoning inter-patch boundaries (matter interpolator)\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars_matter; ++ n) {\n \n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices_matter.AT(n)));\n assert (var);\n \n#pragma omp parallel for\n for (int i=0; i<int(scatter_setup.indices.size()); ++i) {\n var[scatter_setup.indices.AT(i)] = poison;\n }\n \n } // for n\n \n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n }\n \n \n \n // Interpolate\n if (verbose) CCTK_INFO (\"Interpolating with matter interpolator\");\n \n vector<int> varinds (nvars_matter);\n for (int n=0; n<nvars_matter; ++n) {\n varinds.AT(n) = indices_matter.AT(n);\n }\n \n vector<vector<CCTK_REAL> > valuess (nvars_matter);\n vector<CCTK_REAL *> values (nvars_matter);\n for (int n=0; n<nvars_matter; ++n) {\n valuess.AT(n).resize (interp2_setup_matter.npoints);\n#ifndef NDEBUG\n#pragma omp parallel for\n for (int i=0; i<int(valuess.AT(n).size()); ++i) {\n valuess.AT(n).AT(i) = poison;\n }\n#endif\n values.AT(n) = & valuess.AT(n).front();\n }\n \n interp2_setup_matter.fasterp_setup->interpolate (cctkGH, varinds, values);\n \n \n \n // Transform coordinates in result\n if (verbose) CCTK_INFO (\"Transforming coordinates of matter variables\");\n \n transform_coordinates (CCTK_PASS_CTOC, nvars_matter, indices_matter, values, interp2_setup_matter);\n \n \n \n // Write back result\n if (verbose) CCTK_INFO (\"Writing back matter interpolation result\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars_matter; ++ n) {\n \n if (verbose) {\n char * restrict const fullname = CCTK_FullName (indices_matter.AT(n));\n const int patch = MultiPatch_GetMap(cctkGH);\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Filling matter variable #%d %s patch %d\",\n n, fullname, patch);\n free (fullname);\n }\n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices_matter.AT(n)));\n assert (var);\n \n if (interpolate_zero) {\n // for debugging only\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = 0.0;\n }\n \n } else {\n // regular case\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = valuess.AT(n).AT(pos + i);\n }\n \n }\n \n } // for n\n \n ++ scatter_setup_it;\n pos += scatter_setup.npoints;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n assert (pos == interp2_setup_matter.npoints);\n }\n \n } // end 1st-order Lagrange\n \n \n //\n // 2nd-order ENO interpolation!\n //\n \n else if (interpolator_order_matter == 2)\n {\n \n typedef interp2_setup_eno2_t interp2_setup_matter_t;\n \n // Adjust size of interpolation setups\n interp2_setups_matter_2nd.resize (Carpet::maxreflevels, NULL);\n \n \n \n assert (is_level_mode());\n if (not interp2_setups_matter_2nd.AT(Carpet::reflevel) or\n interp2_setups_matter_2nd.AT(Carpet::reflevel)->fasterp_setup->outofdate()) {\n if (interp2_setups_matter_2nd.AT(Carpet::reflevel))\n delete interp2_setups_matter_2nd.AT(Carpet::reflevel);\n interp2_setups_matter_2nd.AT(Carpet::reflevel) = new interp2_setup_matter_t;\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Setting up matter interpolation for level %d\", Carpet::reflevel);\n }\n interp2_setup_matter_t & interp2_setup_matter = * interp2_setups_matter_2nd.AT(Carpet::reflevel);\n \n if (not interp2_setup_matter.fasterp_setup) {\n if (verbose) CCTK_INFO (\"Preparing setting up matter interpolation\");\n \n assert (interp2_setup_matter.scatter_setups.empty());\n assert (interp2_setup_matter.npoints == 0);\n \n // Count points\n if (verbose) CCTK_INFO (\"Counting grid points for matter interpolation\");\n \n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n int npoints = 0;\n#pragma omp parallel reduction (+: npoints)\n LC_LOOP3 (count_points,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_ash[0], cctk_ash[1], cctk_ash[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n ++ npoints;\n }\n } LC_ENDLOOP3 (count_points);\n \n scatter_setup_t scatter_setup;\n scatter_setup.m = Carpet::map;\n scatter_setup.c = Carpet::component;\n scatter_setup.npoints = npoints;\n \n interp2_setup_matter.scatter_setups.push_back (scatter_setup);\n interp2_setup_matter.npoints += scatter_setup.npoints;\n \n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n \n // Allocate storage for coordinates and values\n fasterp_glocs_t locations (interp2_setup_matter.npoints);\n \n // Collect coordinates\n if (verbose) CCTK_INFO (\"Collecting coordinates for matter interpolation\");\n \n list<scatter_setup_t>::iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n scatter_setup.indices.reserve (scatter_setup.npoints);\n \n // This loop is not parallel\n //#pragma omp parallel reduction (+: pos)\n LC_LOOP3 (collect_coordinates,\n i, j, k,\n 0, 0, 0,\n cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],\n cctk_ash[0], cctk_ash[1], cctk_ash[2])\n {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n if (Sn[ind3d] >= 0) {\n locations.coords[0].AT(pos) = x[ind3d];\n locations.coords[1].AT(pos) = y[ind3d];\n locations.coords[2].AT(pos) = z[ind3d];\n scatter_setup.indices.push_back (ind3d);\n ++ pos;\n }\n } LC_ENDLOOP3 (collect_coordinates);\n \n assert (int(scatter_setup.indices.size()) == scatter_setup.npoints);\n \n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n assert (pos == interp2_setup_matter.npoints);\n \n // Create the interpolation setup\n if (verbose) {\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Creating matter interpolation setup for %d grid points\",\n interp2_setup_matter.npoints);\n }\n \n assert (not interp2_setup_matter.fasterp_setup);\n interp2_setup_matter.fasterp_setup =\n new fasterp_eno2_setup_t (cctkGH, locations, interpolator_order_matter);\n \n } // if not interp2_setup_matter.fasterp_setup\n \n \n \n // Poison boundaries, so that they are not accidentally used as\n // interpolation source\n if (verbose) CCTK_INFO (\"Poisoning inter-patch boundaries (matter interpolator)\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars_matter; ++ n) {\n \n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices_matter.AT(n)));\n assert (var);\n \n#pragma omp parallel for\n for (int i=0; i<int(scatter_setup.indices.size()); ++i) {\n var[scatter_setup.indices.AT(i)] = poison;\n }\n \n } // for n\n \n ++ scatter_setup_it;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n }\n \n \n \n // Interpolate\n if (verbose) CCTK_INFO (\"Interpolating with matter interpolator\");\n \n vector<int> varinds (nvars_matter);\n for (int n=0; n<nvars_matter; ++n) {\n varinds.AT(n) = indices_matter.AT(n);\n }\n \n vector<vector<CCTK_REAL> > valuess (nvars_matter);\n vector<CCTK_REAL *> values (nvars_matter);\n for (int n=0; n<nvars_matter; ++n) {\n valuess.AT(n).resize (interp2_setup_matter.npoints);\n#ifndef NDEBUG\n#pragma omp parallel for\n for (int i=0; i<int(valuess.AT(n).size()); ++i) {\n valuess.AT(n).AT(i) = poison;\n }\n#endif\n values.AT(n) = & valuess.AT(n).front();\n }\n \n interp2_setup_matter.fasterp_setup->interpolate (cctkGH, varinds, values);\n \n \n \n // Transform coordinates in result\n if (verbose) CCTK_INFO (\"Transforming coordinates of matter variables\");\n \n transform_coordinates (CCTK_PASS_CTOC, nvars_matter, indices_matter, values, interp2_setup_matter);\n \n \n \n // Write back result\n if (verbose) CCTK_INFO (\"Writing back matter interpolation result\");\n \n {\n list<scatter_setup_t>::const_iterator scatter_setup_it =\n interp2_setup_matter.scatter_setups.begin();\n int pos = 0;\n BEGIN_LOCAL_MAP_LOOP (cctkGH, CCTK_GF) {\n BEGIN_LOCAL_COMPONENT_LOOP (cctkGH, CCTK_GF) {\n assert (scatter_setup_it != interp2_setup_matter.scatter_setups.end());\n scatter_setup_t const & scatter_setup = *scatter_setup_it;\n assert (scatter_setup.m == Carpet::map);\n assert (scatter_setup.c == Carpet::component);\n \n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2ApplyBC);\n \n for (int n = 0; n < nvars_matter; ++ n) {\n \n if (verbose) {\n char * restrict const fullname = CCTK_FullName (indices_matter.AT(n));\n const int patch = MultiPatch_GetMap(cctkGH);\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Filling matter variable #%d %s patch %d\",\n n, fullname, patch);\n free (fullname);\n }\n CCTK_REAL * restrict const var =\n static_cast <CCTK_REAL *>\n (CCTK_VarDataPtrI (cctkGH, 0, indices_matter.AT(n)));\n assert (var);\n \n if (interpolate_zero) {\n // for debugging only\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = 0.0;\n }\n \n } else {\n // regular case\n \n#pragma omp parallel for\n for (int i=0; i<scatter_setup.npoints; ++i) {\n#ifdef DEBUG\n assert (Sn[scatter_setup.indices.AT(i)] >= 0);\n#endif\n var[scatter_setup.indices.AT(i)] = valuess.AT(n).AT(pos + i);\n }\n \n }\n \n } // for n\n \n ++ scatter_setup_it;\n pos += scatter_setup.npoints;\n } END_LOCAL_COMPONENT_LOOP;\n } END_LOCAL_MAP_LOOP;\n assert (scatter_setup_it == interp2_setup_matter.scatter_setups.end());\n assert (pos == interp2_setup_matter.npoints);\n }\n \n } // end 2nd-order ENO\n \n else \n {\n CCTK_WARN(0, \"Matter interpolation order not supported!\");\n }\n \n if (verbose) CCTK_INFO (\"Done with matter interpolation.\");\n }\n \n \n} // namespace Interpolate2\n",
|
| 13 |
+
"calc_inv3.F90": "#include \"cctk.h\"\n\nsubroutine IP2_calc_inv3 (g3, gu3)\n use matinv\n implicit none\n CCTK_REAL, intent(in) :: g3(3,3)\n CCTK_REAL, intent(out) :: gu3(3,3)\n call calc_inv3 (g3, gu3)\nend subroutine IP2_calc_inv3\n",
|
| 14 |
+
"init.cc": "\n/* Copyright 2013 Peter Diener, Nils Dorband, Roland Haas, Ian Hinder,\nChristian Ott, Denis Pollney, Thomas Radke, Christian Reisswig, Erik\nSchnetter, Barry Wardell and Burkhard Zink\n\nThis file is part of Llama.\n\nLlama is free software: you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation, either version 2 of the License, or (at your\noption) any later version.\n\nLlama is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Llama. If not, see <http://www.gnu.org/licenses/>. */\n\n#include <cassert>\n#include <cmath>\n#include <vector>\n#include <iostream>\n\n#include <cctk.h>\n#include <cctk_Arguments.h>\n#include <cctk_Parameters.h>\n\n#include \"mask.h\"\n\n#ifndef DECLARE_CCTK_ARGUMENTS_CHECKED\n#define DECLARE_CCTK_ARGUMENTS_CHECKED(func) DECLARE_CCTK_ARGUMENTS\n#endif\n\n\n\nnamespace Interpolate2 {\n \n using namespace std;\n \n \n \n extern \"C\"\n void\n Interpolate2Init (CCTK_ARGUMENTS)\n {\n DECLARE_CCTK_ARGUMENTS_CHECKED(Interpolate2Init );\n DECLARE_CCTK_PARAMETERS;\n \n \n \n // Find the interpolation sources for each of my grid points\n \n assert (cctk_dim == 3);\n CCTK_INT const npoints = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2];\n \n vector<CCTK_POINTER_TO_CONST> globalcoords (cctk_dim);\n globalcoords.at(0) = x;\n globalcoords.at(1) = y;\n globalcoords.at(2) = z;\n \n {\n CCTK_INT const ierr =\n MultiPatch_GlobalToLocal (cctkGH, cctk_dim, npoints,\n & globalcoords.front(),\n Sn,\n NULL,\n NULL,\n NULL);\n assert (not ierr);\n }\n \n \n \n // Get some information about this patch\n \n CCTK_INT const map = MultiPatch_GetMap (cctkGH);\n assert (map >= 0);\n \n CCTK_INT nboundaryzones[6];\n CCTK_INT is_internal[6];\n CCTK_INT is_staggered[6];\n CCTK_INT shiftout[6];\n {\n CCTK_INT const ierr = MultiPatch_GetBoundarySpecification\n (map, 6,\n nboundaryzones, is_internal, is_staggered, shiftout);\n assert (not ierr);\n }\n \n if (CCTK_MyProc(cctkGH) == 0) {\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n if (nboundaryzones[2*d+f] < cctk_nghostzones[d]) {\n CCTK_VWarn (CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,\n \"The %s %c boundary on patch %d has fewer boundary zones than ghost zones. This may trip the local interpolator later on. If so, and if this is not an error, then please report this, this can be corrected.\",\n (f==0 ? \"lower\" : \"upper\"), \"xyz\"[d],\n (int) map);\n }\n }\n }\n }\n \n CCTK_INT bbox[6];\n {\n CCTK_INT const ierr = MultiPatch_GetBbox (cctkGH, 6, bbox);\n assert (not ierr);\n }\n \n CCTK_INT symbnd[6];\n {\n CCTK_INT const ierr = MultiPatch_GetSymmetryBoundaries (cctkGH, 6, symbnd);\n assert (not ierr);\n }\n\n // Ignore all points which are not part of the inter-patch\n // boundary, and test the points which are on the inter-patch\n // boundary\n \n enum boundary_t { bnd_none, bnd_ip, bnd_mp, bnd_outer, bnd_symmetry };\n \n CCTK_REAL num_interior = 0;\n CCTK_REAL num_ip_boundary = 0;\n CCTK_REAL num_mp_boundary = 0;\n CCTK_REAL num_outer_boundary = 0;\n CCTK_REAL num_symm_boundary = 0;\n bool thereisaproblem = false;\n \n#pragma omp parallel for reduction(+: num_mp_boundary, num_outer_boundary, num_symm_boundary, num_interior, num_ip_boundary) reduction(|: thereisaproblem)\n for (int k=0; k<cctk_lsh[2]; ++k) {\n for (int j=0; j<cctk_lsh[1]; ++j) {\n for (int i=0; i<cctk_lsh[0]; ++i) {\n int const ind3d = CCTK_GFINDEX3D (cctkGH, i, j, k);\n int const ipos[3] = { i, j, k };\n \n // Find out whether this point is on an inter-processor\n // boundary, a multi-patch boundary, or on an outer boundary\n // of one of the faces.\n boundary_t boundary[3][2];\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n const bool is_interprocessor_boundary = not cctk_bbox[2*d+f];\n const bool is_outer_boundary = bbox[2*d+f];\n const bool is_symmetry_boundary = symbnd[2*d+f];\n // default value\n boundary[d][f] = bnd_none;\n if (is_interprocessor_boundary) {\n // inter-processor boundary\n if (f==0) {\n // lower boundary\n if (ipos[d] < cctk_nghostzones[d]) {\n boundary[d][f] = bnd_ip;\n }\n } else {\n // upper boundary\n if (ipos[d] >= cctk_lsh[d] - cctk_nghostzones[d]) {\n boundary[d][f] = bnd_ip;\n }\n }\n } else if (is_symmetry_boundary) {\n // outer (symmtry) boundary\n if (f==0) {\n // lower boundary\n if (ipos[d] < nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_symmetry;\n }\n } else {\n // upper boundary\n if (ipos[d] >= cctk_lsh[d] - nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_symmetry;\n }\n }\n } else if (is_outer_boundary) {\n // outer (physical) boundary\n if (f==0) {\n // lower boundary\n if (ipos[d] < nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_outer;\n }\n } else {\n // upper boundary\n if (ipos[d] >= cctk_lsh[d] - nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_outer;\n }\n }\n } else {\n // multi-patch boundary\n if (f==0) {\n // lower boundary\n if (ipos[d] < nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_mp;\n }\n } else {\n // upper boundary\n if (ipos[d] >= cctk_lsh[d] - nboundaryzones[2*d+f]) {\n boundary[d][f] = bnd_mp;\n }\n }\n }\n }\n }\n \n // Default value\n boundary_t this_boundary = bnd_none;\n \n // Apply a symmetry boundary condition to this point if it is\n // on an symmetry boundary in at least one direction.\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n if (boundary[d][f] == bnd_symmetry) {\n this_boundary = bnd_symmetry;\n }\n }\n }\n\n // Apply an outer boundary condition to this point if it is\n // on an outer boundary in at least one direction.\n if (this_boundary == bnd_none) {\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n if (boundary[d][f] == bnd_outer) {\n this_boundary = bnd_outer;\n }\n }\n }\n }\n \n // If this point is not on an outer boundary, then\n // interpolate it if it is on a multi-patch boundary.\n // If it is on an outer boundary, interpolate it anyway if\n // it is safe to do so and it is on a multi-patch boundary.\n // \n // Note that synchronisation happens before interpolation,\n // so that interpolated values cannot be synchronised.\n // (This may be something that can be optimised later on.)\n //\n // Note that this implicitly requires that either the outer\n // boundary condition is applied before the multi-patch\n // boundary condition (unlikely), or that the outer boundary\n // does not require a boundary condition (e.g. because is\n // evolved in time).\n if (this_boundary == bnd_none or\n (this_boundary == bnd_outer and *interpolate_boundary_points)) {\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n if (boundary[d][f] == bnd_mp) {\n this_boundary = bnd_mp;\n }\n }\n }\n }\n \n // Otherwise, synchronise a point if it is a ghost point in\n // at least one direction.\n if (this_boundary == bnd_none) {\n for (int d=0; d<3; ++d) {\n for (int f=0; f<2; ++f) {\n if (boundary[d][f] == bnd_ip) {\n this_boundary = bnd_ip;\n }\n }\n }\n }\n \n // If this is an interior point, then maybe we want to\n // interpolate anyway\n CCTK_REAL const xyr2 = pow(x[ind3d],2) + pow(y[ind3d],2);\n if (map == 0 and\n this_boundary == bnd_none and\n ((r[ind3d] >= fill_patch0_radius_min and\n r[ind3d] <= fill_patch0_radius_max) or\n (xyr2 >= pow(fill_patch0_xyradius_min,2) and\n xyr2 <= pow(fill_patch0_xyradius_max,2))))\n {\n this_boundary = bnd_mp;\n }\n \n switch (this_boundary) {\n case bnd_none:\n // Set the source patch to -1 to indicate that this point\n // should not be interpolated because it is in the\n // interior of the domain.\n Sn[ind3d] = SOURCE_PATCH_INTERIOR;\n ++ num_interior;\n break;\n case bnd_outer:\n // Set the source patch to -2 to indicate that this point\n // should not be interpolated, but an outer boundary\n // conditions should be applied.\n Sn[ind3d] = SOURCE_PATCH_OUTER;\n ++ num_outer_boundary;\n break;\n case bnd_symmetry:\n // Set the source patch to -4 to indicate that this point\n // should not be interpolated, but a symmetry boundary\n // conditions should be applied.\n Sn[ind3d] = SOURCE_PATCH_SYMMETRY;\n ++ num_symm_boundary;\n break;\n case bnd_mp:\n // This point needs to be interpolated. Check whether\n // this point can indeed be interpolated.\n thereisaproblem |= Sn[ind3d] < 0;\n ++ num_mp_boundary;\n break;\n case bnd_ip:\n // Set the source patch to -3 to indicate that this point\n // should not be interpolated, but should be synchronised\n // instead.\n Sn[ind3d] = SOURCE_PATCH_GHOST;\n ++ num_ip_boundary;\n break;\n default:\n assert (0);\n }\n \n }\n }\n }\n \n if (thereisaproblem) {\n CCTK_WARN (CCTK_WARN_ABORT,\n \"Cannot determine interpolation source patch for all grid points. Maybe the patches do not overlap enough?\");\n }\n \n // This cannot be done in local mode. If statistics should be\n // output, they need to be reduced in level or global mode.\n#if 0\n {\n CCTK_REAL local[4], global[4];\n local[0] = num_interior;\n local[1] = num_ip_boundary;\n local[2] = num_outer_boundary;\n local[3] = num_mp_boundary;\n int const sum = CCTK_ReductionArrayHandle (\"sum\");\n assert (sum >= 0);\n int const ierr =\n CCTK_ReduceLocArrayToArray1D\n (cctkGH, 0, sum, local, global, 4, CCTK_VARIABLE_REAL);\n assert (not ierr);\n if (CCTK_MyProc (cctkGH) == 0) {\n num_interior = global[0];\n num_ip_boundary = global[1];\n num_outer_boundary = global[2];\n num_mp_boundary = global[3];\n CCTK_REAL const num_total = cctk_gsh[0] * cctk_gsh[1] * cctk_gsh[2];\n CCTK_VInfo (CCTK_THORNSTRING,\n \"Llama global grid point statistics:\");\n CCTK_VInfo (CCTK_THORNSTRING,\n \" interior points: %8.1f (%4.1f%%)\",\n double (num_interior),\n double (num_interior/num_total*100));\n CCTK_VInfo (CCTK_THORNSTRING,\n \" inter-processor ghosts: %8.1f (%4.1f%%)\",\n double (num_ip_boundary),\n double (num_ip_boundary/num_total*100));\n CCTK_VInfo (CCTK_THORNSTRING,\n \" multi-patch boundary points: %8.1f (%4.1f%%)\",\n double (num_mp_boundary),\n double (num_mp_boundary/num_total*100));\n CCTK_VInfo (CCTK_THORNSTRING,\n \" outer boundary points: %8.1f (%4.1f%%)\",\n double (num_outer_boundary),\n double (num_outer_boundary/num_total*100));\n CCTK_VInfo (CCTK_THORNSTRING,\n \" total: %8.1f (%4.1f%%)\",\n double (num_total),\n double (100));\n }\n }\n#endif\n \n }\n \n \n \n} // namespace Interpolate2\n"
|
| 15 |
+
},
|
| 16 |
+
"test": {},
|
| 17 |
+
"doc": {
|
| 18 |
+
"documentation.tex": "\\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\\author{Erik Schnetter}\n\\title{Interpatch Interpolation}\n\n\\date{\\today}\n\n\\maketitle\n\n% START CACTUS THORNGUIDE\n\n\\begin{abstract}\nThe Interpolate2 thorn provides interpatch interpolation.\n\\end{abstract}\n\n\\section{Overview}\n\nThe interpolator works in several steps.\n\nIn the first step, during startup, it decides which points need to be\nset via interpolation. This is usually a layer N grid points deep at\nthe boundaries of the patches, excluding ghost zones, and also\nexcluding the outer boundaries.\n\nAfter each regridding, the Coordinates thorn iterates over these grid points, converts\ntheir locations to global coordinates, and finds out which patch ``owns''\neach location. It then assumes that this location is sufficiently far\nin the interior of the patch that one can apply a full interpolation\nstencil there. That is, the interpolation source must be surrounded by\nsufficiently many ghost zones, outer boundary points, or additional\noverlap points that the stencil does not include any other inter-patch\nboundary points. This condition depends, among other things, on the\ngrid spacings in the patches, and thus there is no generic rule. It is\ntested each time via a dummy interpolation.\n\nAt this point, Interpolate2 also calculates and stores the weights for the\ninterpolation stencils, because calculating them is somewhat\nexpensive. If the interpolation point is on a 2D plane, 1D line, or on\na grid point (with a small tolerance of about $10^{-12}$), then the\ninterpolation dimension is reduced, so that either 2D or 1D\ninterpolation is performed whenever possible, or even ``0D''\ninterpolation (i.e.~copying of grid points).\n\nFinally, each time the symmetry boundary conditions are applied, these\nstencils are evaluated and the result transferred (via MPI) to the\ntarget process.\n\nInterpolate2 provides the same interface as Interpolate, but it uses\nthe CarpetInterp2 thorn to perform the actual interpolation instead of\nCarpetInterp. This is more efficient.\n\n% END CACTUS THORNGUIDE\n\n\\end{document}\n"
|
| 19 |
+
}
|
| 20 |
+
}
|
Llama_LlamaWaveToy.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Llama_WaveExtractL.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|