function checkMeshIncompatible(elements)
% Internal function to check whether input elements represent a mesh with each
% region bounded by non-manifold surfaces.
%
% Copyright 2021-2022 The MathWorks, Inc.

facets = [elements(:,1:2); elements(:,2:3); elements(:,3) elements(:,1)];
if size(unique(facets,'rows'),1) < size(facets,1)
    error(message('pde:pdeGeometryClass:MeshIncompatible'));
end
end
