function [res] = InProd_uP(u,P,Nodeu, NodeP, dx, dy, idsP)
% function [res] = InProd_uP(u,P,Nodeu, NodeP, dx, dy, idsP)
% This function takes the inner product of <u,P> over the domain  
%
% INPUTS:
%       u:      Vector containing values of u
%       P:      Vector containing values of Pressure
%       NodeU:  Reference node numbering matrix for u-velocity 
%       NodeP:  Reference node numbering matrix for Pressure
%       dx:     delta x, grid spacing in x direction
%       dy:     delta y, grid spacing in y direction
%       idsP:   Location of unmasked Pressure nodes in interior
%       
% OUTPUTS:
%       res:    Returns sum(u*P*dx*dy)
%
% Authors:   Matt Ueckermann, Pierre Lermusiaux, Pat Haley for MIT course 2.29

[Ny,Nx]=size(NodeP);
idsx=2:Nx-1;
idsy=2:Ny-1;
res = 0.5*P(NodeP(idsx,idsy)).*(u(Nodeu(idsx-1,idsy))+u(Nodeu(idsx,idsy)));
res = sum(res(idsP))*(dx*dy);

