function BFacesConn=GetBFacesConn(BFaces,Faces,FacesOfElements)
%description: get the connectivity between boundary faces and mesh
%output
%BFacesConn n*2, the first variable is number of mesh, the second variable
%is number of faces in mesh
%input
%BFaces-port.oldFaces
%Faces-Faces of mesh

BFacesConn=zeros(length(BFaces),2);
for i=1:length(BFaces)
    temp=find(ismember(Faces,BFaces(i,:),'rows'));
    n=find(FacesOfElements==temp);%port面的局部编号
    
    BFacesConn(i,1)=fix((n-1)/4)+1;
    BFacesConn(i,2)=n-(BFacesConn(i,1)-1)*4;
end

end