aboutsummaryrefslogtreecommitdiff
path: root/doc/documentation.tex
blob: b2153cb5f26e0e74974914a68ce3e11e21a82567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
% Thorn documentation template
\documentclass{article}
\begin{document}

\title{NaNChecker}
\author{Thomas Radke}
\date{26 May 2001}
\maketitle

\abstract{Thorn NaNChecker reports NaN values found in variables.}

\section{Purpose}
%
This thorn can be used to analyze CCTK variables of real or complex data type
for NaN (Not-a-Number) and (on availability of {\tt finite(3)}) infinite
values.\\
It does this by registering a routine at {\bf CCTK\_POSTSTEP} which checks
at every {\tt NanChecker::check\_every} iteration all the variables listed in
{\tt NaNChecker::check\_vars} and -- in case a NaN was found -- performs an
action as specified in {\tt NaNChecker::action\_if\_found}.\\

Currently these actions can be to
\begin{itemize}
 \item just print a level 1 warning message telling you where NaNs were found
   and how many (for grid array variables).\\
   For grid arrays it will also print level 2 warnings with the array index
   (in fortran order) for all NaN elements. You can limit the number of
   such warnings by setting the {\tt NanChecker::report\_max} parameter.

 \item also set the CCTK termination flag so that Cactus will stop the evolution
   loop and gracefully terminate at the next time possible (giving you the
   choice of outputting the data from the last evolution timestep),

 \item print the warning message(s) and immediately terminate Cactus
   by a call to {\tt CCTK\_Abort()}
\end{itemize}

By default, the current timelevel of the variables given in
{\tt NaNChecker::check\_vars} will be checked. This can be overwritten by
an optional string {\tt [timelevel=<timelevel>]} appended to the
variable/group name.
%
\section{NaNChecker API}
%
Thorn NaNChecker also provides a function API which can be used by other code
to invoke the NaNChecker routines to test for NaN values or to set NaN values
for a list of variables:

\begin{itemize}
  \item{\bf C API}
\begin{verbatim}
  int NaNChecker_CheckVarsForNaN (const cGH *cctkGH,
                                  int report_max,
                                  const char *vars,
                                  const char *action_if_found);

  int NaNChecker_SetVarsToNaN (const cGH *cctkGH,
                               const char *vars);
\end{verbatim}
  \item{\bf Fortran API}
\begin{verbatim}
  call NaNChecker_CheckVarsForNaN (ierror, cctkGH, report_max,
                                   vars, action_if_found)

                                   integer ierror
                                   CCTK_POINTER cctkGH
                                   integer report_max
                                   character*(*) vars
                                   character*(*) action_if_found

  call NaNChecker_SetVarsToNaN (ierror, cctkGH, vars)

                                integer ierror
                                CCTK_POINTER cctkGH
                                character*(*) vars
\end{verbatim}
\end{itemize}

The {\tt report\_max, check\_vars,} and {\tt action\_if\_found} arguments
have the same semantics as their parameter counterparts.\\
If {\tt action\_if\_found} is given as a NULL pointer (C API) or as an empty
string (Fortran API) the routine will be quiet and just return the number of
NaN values found.\\

The C function {\tt NaNChecker\_CheckVarsForNaN()} returns the total number of
NaN values found, {\tt NaNChecker\_SetToNaN()} returns the total number of
variables set to NaN; this return value is stored in the {\tt ierror} argument
for the corresponding fortran wrapper routines.
%
% Automatically created from the ccl files 
% Do not worry for now.
\include{interface}
\include{param}
\include{schedule}

\end{document}