@BeginModule
@NewPage
@Name      = Cond
@Title     = Conditional select one field
@Section   = Conditional selection
@Arguments = ifile1 ifile2 ofile
@Operators = ifthen ifnotthen

@BeginDescription
This module selects field elements from @file{ifile2} with respect to @file{ifile1} and writes them 
to @file{ofile}. The fields in @file{ifile1} are handled as a mask. A value 
not equal to zero is treated as "true", zero is treated as "false".
The number of fields in @file{ifile1} has either to be the same as in @file{ifile2} or the
same as in one timestep of @file{ifile2} or only one.
The fields in @file{ofile} inherit the meta data from @file{ifile2}.
@EndDescription
@EndModule


@BeginOperator_ifthen
@Title     = If then

@BeginDescription
@IfMan
         / i_2(t,x) if i_1([t,]x) NE 0  AND  i_1([t,]x) NE miss
o(t,x) =
         \ miss     if i_1([t,]x) EQ 0  OR   i_1([t,]x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
   i_2(t,x) & \mbox{if} \;\;  i_1([t,]x) \neq 0 & \wedge \;\; i_1([t,]x) \neq \mbox{miss} \\
\mbox{miss} & \mbox{if} \;\;  i_1([t,]x)    = 0 & \vee   \;\; i_1([t,]x)    = \mbox{miss} \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ifnotthen
@Title     = If not then

@BeginDescription
@IfMan
         / i_2(t,x) if i_1([t,]x) EQ 0  AND  i_1([t,]x) NE miss
o(t,x) = 
         \ miss     if i_1([t,]x) NE 0  OR   i_1([t,]x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
   i_2(t,x) & \mbox{if} \;\;  i_1([t,]x)    = 0 & \wedge \;\; i_1([t,]x) \neq \mbox{miss} \\
\mbox{miss} & \mbox{if} \;\;  i_1([t,]x) \neq 0 & \vee   \;\; i_1([t,]x)    = \mbox{miss} \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginExample
To select all field elements of @file{ifile2} if the corresponding field
element of @file{ifile1} is greater than 0 use:
@BeginVerbatim
   cdo ifthen ifile1 ifile2 ofile
@EndVerbatim
@EndExample
