| FEAT 3
    Finite Element Analysis Toolbox | 
The following image gives an overview of the V- and F-cycles on five levels as well as the W-cycle on four levels.
In the image above:
This section explains the details of the W-cycle implementation in the FEAT::Solver::MultiGrid class.
The W-cycle is tricky to implement without explicitly using recursion. To achieve this goal, our implementation manages a peak-level counter for each level (above the coarse level) of the W-cycle hierarchy, which counts the number of peak-smoothing steps on the corresponding level. For the following explanations, we assume that the W-cycle hierarchy consists of four levels 0-3.
As you can see in the image above, the first step in the W-cycle is to restrict from the top level to the coarse level, applying the pre-smoother on each level if given (as in any other cycle).
The next part is the actual tricky bit: The basic idea behind the implementation of the "inner" W-cycle part is to manage the peak-level counters in the following way:
The above steps are executed in a loop which has to perform a total number of 2^(top_level - coarse_level) - 1 iterations, which yields the tricky inner W-cycle part. Alternatively, one might as well iterate until all peak-level counters are 1 (as seen in the image above).
Finally, the last step in the W-cycle is to prolongate from the coarse level to the top level, applying the post-smoother on each level if given (also just as in any other cycle).