@BeginModule
@NewPage
@Name      = Replacevalues
@Title     = Replace variable values
@Section   = Miscellaneous
@Arguments = ifile ofile
@Operators = setvals setrtoc setrtoc2

@BeginDescription
This module replaces old variable values with new values, depending on the operator.
@EndDescription
@EndModule


@BeginOperator_setvals
@Title     = Set list of old values to new values
@Parameter = oldval newval [...]

@BeginDescription
Supply a list of n pairs of old and new values.
@EndDescription
@EndOperator


@BeginOperator_setrtoc
@Title     = Set range to constant
@Parameter = rmin rmax c

@BeginDescription
@IfMan
         / c      if i(t,x) GE rmin AND i(t,x) LE rmax
o(t,x) = 
         \ i(t,x) if i(t,x) LT rmin AND i(t,x) GT rmax
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
 \mbox{c}   & \mbox{if} \;\; i(t,x) \geq \mbox{\sl rmin} \wedge i(t,x) \leq \mbox{\sl rmax}  \\
 i(t,x) & \mbox{if} \;\; i(t,x) < \mbox{\sl rmin} \vee i(t,x) > \mbox{\sl rmax}  \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_setrtoc2
@Title     = Set range to constant others to constant2
@Parameter = rmin rmax c c2

@BeginDescription
@IfMan
         / c      if i(t,x) GE rmin AND i(t,x) LE rmax
o(t,x) = 
         \ c2     if i(t,x) LT rmin AND i(t,x) GT rmax
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
 \mbox{c}   & \mbox{if} \;\; i(t,x) \geq \mbox{\sl rmin} \wedge i(t,x) \leq \mbox{\sl rmax}  \\
 \mbox{c2} & \mbox{if} \;\; i(t,x) < \mbox{\sl rmin} \vee i(t,x) > \mbox{\sl rmax}  \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter
@Item = oldval,newval,...
FLOAT   Pairs of old and new values
@Item = rmin
FLOAT   Lower bound
@Item = rmax
FLOAT   Upper bound
@Item = c
FLOAT   New value - inside range
@Item = c2
FLOAT   New value - outside range
@EndParameter

