aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknarf <knarf@053b05ff-9803-4dc7-a0e4-4b49d75fdb53>2010-01-26 23:38:51 +0000
committerknarf <knarf@053b05ff-9803-4dc7-a0e4-4b49d75fdb53>2010-01-26 23:38:51 +0000
commit9b80be1cf430d9f0d08af45ef939859f363f041e (patch)
tree812eedae8aad561b53664cab0a4de46301d85413
new thorn, to be used with the new HydroBase excision
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinUtils/SetMask_SphericalSurface/trunk@62 053b05ff-9803-4dc7-a0e4-4b49d75fdb53
-rw-r--r--README11
-rw-r--r--doc/documentation.tex144
-rw-r--r--interface.ccl7
-rw-r--r--param.ccl21
-rw-r--r--schedule.ccl8
-rw-r--r--src/SetMask.c47
-rw-r--r--src/make.code.defn7
7 files changed, 245 insertions, 0 deletions
diff --git a/README b/README
new file mode 100644
index 0000000..7b6d93d
--- /dev/null
+++ b/README
@@ -0,0 +1,11 @@
+Cactus Code Thorn SetMask_SphericalSurface
+Author(s) : Frank Löffler
+Maintainer(s): Frank Löffler
+Licence : GPLv2+
+--------------------------------------------------------------------------
+
+1. Purpose
+
+Sets a given mask according to given spherical surfaces and parameters.
+One example usage is to set the excision mask based on information from
+an apparent horizon finder which is stored as a spherical surface.
diff --git a/doc/documentation.tex b/doc/documentation.tex
new file mode 100644
index 0000000..72c4129
--- /dev/null
+++ b/doc/documentation.tex
@@ -0,0 +1,144 @@
+% *======================================================================*
+% Cactus Thorn template for ThornGuide documentation
+% Author: Ian Kelley
+% Date: Sun Jun 02, 2002
+% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $
+%
+% Thorn documentation in the latex file doc/documentation.tex
+% will be included in ThornGuides built with the Cactus make system.
+% The scripts employed by the make system automatically include
+% pages about variables, parameters and scheduling parsed from the
+% relevant thorn CCL files.
+%
+% This template contains guidelines which help to assure that your
+% documentation will be correctly added to ThornGuides. More
+% information is available in the Cactus UsersGuide.
+%
+% Guidelines:
+% - Do not change anything before the line
+% % START CACTUS THORNGUIDE",
+% except for filling in the title, author, date, etc. fields.
+% - Each of these fields should only be on ONE line.
+% - Author names should be separated with a \\ or a comma.
+% - You can define your own macros, but they must appear after
+% the START CACTUS THORNGUIDE line, and must not redefine standard
+% latex commands.
+% - To avoid name clashes with other thorns, 'labels', 'citations',
+% 'references', and 'image' names should conform to the following
+% convention:
+% ARRANGEMENT_THORN_LABEL
+% For example, an image wave.eps in the arrangement CactusWave and
+% thorn WaveToyC should be renamed to CactusWave_WaveToyC_wave.eps
+% - Graphics should only be included using the graphicx package.
+% More specifically, with the "\includegraphics" command. Do
+% not specify any graphic file extensions in your .tex file. This
+% will allow us to create a PDF version of the ThornGuide
+% via pdflatex.
+% - References should be included with the latex "\bibitem" command.
+% - Use \begin{abstract}...\end{abstract} instead of \abstract{...}
+% - Do not use \appendix, instead include any appendices you need as
+% standard sections.
+% - For the benefit of our Perl scripts, and for future extensions,
+% please use simple latex.
+%
+% *======================================================================*
+%
+% Example of including a graphic image:
+% \begin{figure}[ht]
+% \begin{center}
+% \includegraphics[width=6cm]{MyArrangement_MyThorn_MyFigure}
+% \end{center}
+% \caption{Illustration of this and that}
+% \label{MyArrangement_MyThorn_MyLabel}
+% \end{figure}
+%
+% Example of using a label:
+% \label{MyArrangement_MyThorn_MyLabel}
+%
+% Example of a citation:
+% \cite{MyArrangement_MyThorn_Author99}
+%
+% Example of including a reference
+% \bibitem{MyArrangement_MyThorn_Author99}
+% {J. Author, {\em The Title of the Book, Journal, or periodical}, 1 (1999),
+% 1--16. {\tt http://www.nowhere.com/}}
+%
+% *======================================================================*
+
+% If you are using CVS use this line to give version information
+% $Header: /cactusdevcvs/Cactus/doc/ThornGuide/template.tex,v 1.12 2004/01/07 20:12:39 rideout Exp $
+
+\documentclass{article}
+
+% Use the Cactus ThornGuide style file
+% (Automatically used from Cactus distribution, if you have a
+% thorn without the Cactus Flesh download this from the Cactus
+% homepage at www.cactuscode.org)
+\usepackage{../../../../doc/latex/cactus}
+
+\begin{document}
+
+% The author of the documentation
+\author{Frank Löffler \textless none\textgreater}
+
+% The title of the document (not necessarily the name of the Thorn)
+\title{SetMask\_SphericalSurface}
+
+% the date your document was last changed, if your document is in CVS,
+% please use:
+% \date{$ $Date: 2004/01/07 20:12:39 $ $}
+\date{January 26 2010}
+
+\maketitle
+
+% Do not delete next line
+% START CACTUS THORNGUIDE
+
+% Add all definitions used in this documentation here
+% \def\mydef etc
+
+% Add an abstract for this thorn's documentation
+\begin{abstract}
+
+\end{abstract}
+
+% The following sections are suggestive only.
+% Remove them or add your own.
+
+\section{Introduction}
+
+\section{Physical System}
+
+\section{Numerical Implementation}
+
+\section{Using This Thorn}
+
+\subsection{Obtaining This Thorn}
+
+\subsection{Basic Usage}
+
+\subsection{Special Behaviour}
+
+\subsection{Interaction With Other Thorns}
+
+\subsection{Examples}
+
+\subsection{Support and Feedback}
+
+\section{History}
+
+\subsection{Thorn Source Code}
+
+\subsection{Thorn Documentation}
+
+\subsection{Acknowledgements}
+
+
+\begin{thebibliography}{9}
+
+\end{thebibliography}
+
+% Do not delete next line
+% END CACTUS THORNGUIDE
+
+\end{document}
diff --git a/interface.ccl b/interface.ccl
new file mode 100644
index 0000000..cba914b
--- /dev/null
+++ b/interface.ccl
@@ -0,0 +1,7 @@
+# Interface definition for thorn SetMask_SphericalSurface
+
+implements: SetMask_SphericalSurface
+
+inherits: HydroBase SphericalSurface
+
+USES INCLUDE: HydroBase.h
diff --git a/param.ccl b/param.ccl
new file mode 100644
index 0000000..632eb70
--- /dev/null
+++ b/param.ccl
@@ -0,0 +1,21 @@
+# Parameter definitions for thorn SetMask_SphericalSurface
+
+STRING SetMask_MaskName "Full variable name of the mask to be set"
+{
+ ".+" :: "Any full Cactus variable name, GF of type CCTK_BYTE"
+} "HydroBase::hydro_excision_mask"
+
+BOOLEAN SetMask_ResetAll "'yes' (default): Overwrite complete mask, 'no': Only set excision points"
+{
+} "yes"
+
+CCTK_INT SetMask_SurfaceIndex[10] "Index of spherical surface to use to set mask"
+{
+ -1:* :: "-1 to disable (default), >=0 for index"
+} -1
+
+CCTK_REAL SetMask_RadiusFactor[10] "Factor to modify radius of surface for mask"
+{
+ 0:* :: "Some positive factor, default: 1"
+} 1
+
diff --git a/schedule.ccl b/schedule.ccl
new file mode 100644
index 0000000..02c47b9
--- /dev/null
+++ b/schedule.ccl
@@ -0,0 +1,8 @@
+# Schedule definitions for thorn SetMask_SphericalSurface
+
+schedule SetMask_SphericalSurface AT CCTK_POSTSTEP after SphericalSurface_HasBeenSet before HydroBase_ExcisionHasBeenSet
+{
+ LANG: C
+ options: global loop-local
+} "Set hydro_excision_mask according to spherical surface information"
+
diff --git a/src/SetMask.c b/src/SetMask.c
new file mode 100644
index 0000000..0e9cba9
--- /dev/null
+++ b/src/SetMask.c
@@ -0,0 +1,47 @@
+#include "cctk.h"
+#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
+
+#include "loopcontrol.h"
+#include "HydroBase.h"
+
+void SetMask_SphericalSurface (CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ CCTK_INT *mask = (CCTK_INT*) CCTK_VarDataPtr(cctkGH, 0, SetMask_MaskName);
+ if (!mask)
+ CCTK_WARN(0, "No such variable, or no storage enabled");
+
+ for (int smi = 0; smi < 10; smi++)
+ {
+ CCTK_INT sfi = SetMask_SurfaceIndex[smi];
+ if (sfi >= 0 && sf_active[sfi] && sf_valid[sfi] >= 0)
+ {
+ #pragma omp parallel
+ {
+ LC_LOOP3(setsurface, i,j,k, 0,0,0,
+ cctk_lsh[0], cctk_lsh[1], cctk_lsh[2],
+ cctk_lsh[0], cctk_lsh[1], cctk_lsh[2])
+ {
+ CCTK_INT i3D = CCTK_GFINDEX3D(cctkGH, i, j, k);
+ CCTK_REAL dist2 = (sf_centroid_x[sfi]-x[i3D]) * (sf_centroid_x[sfi]-x[i3D]) +
+ (sf_centroid_y[sfi]-y[i3D]) * (sf_centroid_y[sfi]-y[i3D]) +
+ (sf_centroid_z[sfi]-z[i3D]) * (sf_centroid_z[sfi]-z[i3D]);
+ if (dist2 < SetMask_RadiusFactor[smi] * sf_min_radius[sfi] *
+ SetMask_RadiusFactor[smi] * sf_min_radius[sfi])
+ {
+ mask[i3D] = HYDROEXCISION_EXCISED;
+ }
+ else if (SetMask_ResetAll)
+ {
+ mask[i3D] = HYDROEXCISION_NORMAL;
+ }
+ }
+ LC_ENDLOOP3(setsurface);
+ }
+ }
+ }
+}
+
diff --git a/src/make.code.defn b/src/make.code.defn
new file mode 100644
index 0000000..a9b7798
--- /dev/null
+++ b/src/make.code.defn
@@ -0,0 +1,7 @@
+# Main make.code.defn file for thorn SetMask_SphericalSurface
+
+# Source files in this directory
+SRCS = SetMask.c
+
+# Subdirectories containing source files
+SUBDIRS =