function [res] = InProd_vP(v,P,Nodev, NodeP, dx, dy, idsP)
% function [res] = InProd_vP(v,P,Nodev, NodeP, dx, dy, idsP)
% This function takes the inner product of <v,P> over the domain  
%
% INPUTS:
%       v:      Vector containing values of v
%       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(v*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 = P(NodeP(idsx,idsy)).*(v(Nodev(idsx,idsy-1))+v(Nodev(idsx,idsy)));
res = sum(res(idsP))*0.5*(dx*dy);

