function [K,F] =  assemble(iele,nnpe,np,ke,fe)
% function [K,F] =  assemble(iele,nnpe,np,ke,fe,K,F)
% assembles elemental force and stiffness matrices into global counterparts
global K F
for  i=1:nnpe 
  i2=2*np(iele,i); % find d.o.f. corresponding to y- or norm-component
  i1=i2-1;         % find d.o.f. corresponding to x- or tang-component
  F(i1)=F(i1)+fe(2*i-1);
  F(i2)=F(i2)+fe(2*i);
  for j=1:nnpe
    j2=2*np(iele,j);
    j1=j2-1;
    K(i1,j1)    =   K(i1,j1)  +  ke(2*i-1,2*j-1);
    K(i1,j2)    =   K(i1,j2)  +  ke(2*i-1,  2*j);
    K(i2,j2)    =   K(i2,j2)  +  ke(2*i  ,  2*j);
    K(i2,j1)    =   K(i2,j1)  +  ke(2*i  ,2*j-1);
    end
end
