As shown in the above diagram, the array mask is non-zero only in the outer boundary.
This is of great significance in trying to understand the operation of the routine INTERPOLATE. This routine computes only for those values of i and j for which mask(i,j).ne.0. Thus though the loops found in the routine are for -(nd+1) to (nd+1), actual computation is being done only for the boundary points.
The different values of mask are used to indicate the regions where different techniques of interpolation have to be used. Thus, for example, the interpolation technique used for all the points where mask(i,j)=11 is the same and it differs from the technique used for the points having a different value for mask
By finding the exact values of the array mask for all i and j, we are now in a position to know what interpolation scheme is used at which points. Armed with this knowledge we can now rewrite the routine, using appropriate array sections, thus exploiting parallelism.