function aux = prescBound(XB,bType,bVal,u)
% aux = prescBound(XB,bType,bVal,u)
% Applies Dirichlet boundary conditions.
%
% Inputs:
% XB: boundary nodes.
% bType: boundary condition type.
% bVal: boundary condition values.
% u: results vector.
% aux: cell with Dirichlet nodes and values applied.

% Initialization
nPt = size(u,1);
au1 = zeros(nPt,1);
au2 = zeros(nPt,1);

% Detects nodes where conditions are applied and stores them in cells.
for i = 1:length(XB)
    if bType(i) == 1
        aux(XB{i},1) = XB{i};
        aux(XB{i},2) = bVal(i);
    end
end

au1 = aux(:,1);
au1 = au1(au1 ~= 0);

aux = aux(au1,:);
