function [Masku Maskv] = maskuv(Mask)
% [Masku Maskv] = maskuv(Mask)
% This function creates the u and v masks for a staggered grid
%
% INPUTS:
%       Mask:   The tracer mask matrix (also the Pressure mask matrix)
%               Different boundary conditions are marked with positive
%               integers, and interior points have to be zero. 
%               e.g. Mask = zeros(5,5);Mask(3,3)=1;Mask(2,4)=2;
%               Created 2 different boundaries.
%       NOTE: Masks will require some fixing if two different boundaries
%       are specified next to each other.
% OUTPUTS:
%       Masku:  Mask matrix for the u velocity
%       Maskv:  Mask matrix for the v velocity
%
% Written by:   Matt Ueckermann for MIT course 2.29
Mask = Mask+1;
tmp = (Mask(:,1:end-1)-1).*(Mask(:,2:end)-1);
Masku = (Mask(:,1:end-1).*Mask(:,2:end))...
    -tmp-tmp.^0.5-1;
tmp = (Mask(1:end-1,:)-1).*(Mask(2:end,:)-1);
Maskv = (Mask(1:end-1,:).*Mask(2:end,:))...
    -tmp-tmp.^0.5-1;
