function calc_numnp
%     CALCULATE NUMBER OF NODAL POINTS
global numlps
global meltyp
global numnp
global numel
global ndiv
global join

numnp=0;

for i=1:numlps

    switch meltyp
        case 3
            numnp = numnp+(ndiv(i,1)+1)*(ndiv(i,2)+1);
        case 4
            numnp = numnp+(ndiv(i,1)+1)*(ndiv(i,2)+1);
        case 6
            numnp = numnp+(2*ndiv(i,1)+1)*(2*ndiv(i,2)+1);
        case 9
            numnp = numnp+(2*ndiv(i,1)+1)*(2*ndiv(i,2)+1);
    end


    j1=4;

    for  j=1:4

        if(join(i,j,1)~=0)
            switch meltyp
                case 3
                    numnp = numnp-(ndiv(i,j)+1);
                case 4
                    numnp = numnp-(ndiv(i,j)+1);
                case 6
                    numnp = numnp-(2*ndiv(i,j)+1);
                case 9
                    numnp = numnp-(2*ndiv(i,j)+1);
            end


            if(join(i,j1,1)~=0)
                numnp = numnp+1;
            end

        end

        j1=j;

    end

end



