summaryrefslogtreecommitdiff
path: root/doc/UsersGuide
diff options
context:
space:
mode:
authorrhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-04-11 21:39:35 +0000
committerrhaas <rhaas@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-04-11 21:39:35 +0000
commitb118d936203905eb5e10f319ab634c144854a600 (patch)
tree7a3259ba4501976327fbd9b6db09533fc4789f09 /doc/UsersGuide
parentce35b1de9d17c8cec1fa6fc60d9b25ba1bfcb295 (diff)
add documenation on expression parser to UserGuide
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4798 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'doc/UsersGuide')
-rw-r--r--doc/UsersGuide/Notes.tex52
1 files changed, 52 insertions, 0 deletions
diff --git a/doc/UsersGuide/Notes.tex b/doc/UsersGuide/Notes.tex
index b2393291..ff0a6f42 100644
--- a/doc/UsersGuide/Notes.tex
+++ b/doc/UsersGuide/Notes.tex
@@ -1313,6 +1313,58 @@ consists of one or more parameter names, followed by
an `\texttt{=}', followed by the value(s) for this (these) parameter(s).
Note that all string parameters are case insensitive.
+Parameters statements of numeric or boolean type can use arithmetic
+expressions in place of explicit values. The usual arithmetic operations
+as well as C-like transcendental functions and relational operations are
+supported. Integer division is handled as in C, and any non-null value is
+interpreted as logical true, which the relational operators return as unity.
+Table~\ref{tab:expression_functions} lists the supported functions.
+Expressions can refer to already set parameters by using the fully qualified
+name \texttt{thorn::parameter} as described below.
+\begin{table}
+ \begin{tabular}{|ll@{\hspace{.5cm}}|ll|}
+ \hline
+ \multicolumn{2}{|c|}{Relational operators} & \multicolumn{2}{c|}{Mathematical functions} \\
+ \hline
+ \verb|=| & tests for equality & \verb|!| & logical not\\
+ \hline
+ \verb|<| & tests for less than & \verb|acos| & inverse cosine\\
+ \hline
+ \verb|>| & tests for greater than & \verb|asin| & inverse sine\\
+ \hline
+ \verb|<=| & tests for less or equal & \verb|atan| & inverse tangent \\
+ \hline
+ \verb|>=| & tests for greater or equal & \verb|ceil| & round up to nearest integer \\
+ \hline
+ \verb|&&| & logical and & \verb|cos| & cosine \\
+ \hline
+ \verb%||% & logical or & \verb|cosh| & hyperbolic cosine \\
+ \hline
+ \multicolumn{2}{|c|}{Unary operators} & \verb|exp| & exponentiation $e^x$\\
+ \hline
+ \verb|-| & negate sign & \verb|fabs| & absolute value $|x|$\\
+ \hline
+ \verb|+| & no-op & \verb|floor| & round down to nearest integer \\
+ \hline
+ \multicolumn{2}{|c|}{Binary operators} & \verb|log| & natural logarithm \\
+ \hline
+ \verb|+| & addition & \verb|log10| & base-10 logarithm \\
+ \hline
+ \verb|-| & subtraction & \verb|sin| & sine \\
+ \hline
+ \verb|/| & C-like division & \verb|sinh| & hyperbolic sine \\
+ \hline
+ \verb|*| & multiplication & \verb|sqrt| & square root \\
+ \hline
+ \verb|^| & exponentiation $x^y$ & \verb|tan| & tangent \\
+ \hline
+ & & \verb|tanh| & hyperbolic tangent \\
+ \hline
+ \end{tabular}
+ \caption{Supported functions inside of expressions, in increasing order of
+ precedence.}
+\end{table}
+
The first parameter statement in any parameter file should set \texttt{ActiveThorns},
which is a special parameter that tells the
program which \textit{thorns} are to be activated. Only parameters from active