function [vmapM,vmapP,mapB,vmapB] = BuildMaps1D()

Globals1D;

nodeIDs = reshape(1:(K * N_p), N_p, K); % vektor je skladan do matice po sloupcich, ne po radcich
vmapM = zeros(N_fp, N_faces, K);
vmapP = zeros(N_fp, N_faces, K);

for element1 = 1:K
	for face1 = 1:N_faces
		vmapM(:,face1,element1) = nodeIDs(Fmask(:,face1),element1);
	end
end

for element1 = 1:K
	for face1 = 1:N_faces
		element2 = EtoE(element1,face1);
        face2 = EtoF(element1,face1);
        
        vertexIDM = vmapM(:,face1,element1);
        vertexIDP = vmapM(:,face2,element2);
        x1 = x(vertexIDM); x2 = x(vertexIDP);
        
        D = (x1 - x2) .^ 2;
        if (D < NODETOL)
            vmapP(:,face1,element1) = vertexIDP;
        end;
	end
end

vmapM = vmapM(:);
vmapP = vmapP(:);

% Create list of boundary nodes
mapB = find(vmapP == vmapM);
vmapB = vmapM(mapB);

end