% mergeCells - Merges two adjacent cells into one.
%
%   NewGM = mergeCells(GM,CELLS) merges two cells of the geometry GM
%   by removing their shared faces.
%   CELLS is a vector of two cell IDs. Specified cells must share
%   at least one face.
%   NewGM is a handle to the DiscreteGeometry object GM.
%
%   mergeCells renumbers cells and faces in the resulting geometry.
%   The merged cell gets the first of the specified cell IDs.
%   The function reduces all subsequent cell IDs by 1. Because
%   mergeCells removes shared faces, it also reduces IDs of all
%   subsequent faces.%   
%   Merging modifies a geometry, but it does not modify the mesh. After
%   merging cells, always call generateMesh. Creating a new mesh ensures
%   a proper mesh association with the new geometry.
%
%   Example: Merge 2 of 3 cells of a multicylinder geometry.
%
%       gm = multicylinder([1 2 3],3);
%       newgm = mergeCells(gm,[1 2]);
%       pdegplot(gm,CellLabels="on",FaceAlpha=0.75)
%
%   See also pde.DiscreteGeometry, fegeometry,
%            pde.EquationModel/importGeometry,
%            pde.DiscreteGeometry/addFace,
%            pde.DiscreteGeometry/addCell,
%            pde.DiscreteGeometry/addVoid,
%            pde.DiscreteGeometry/extrude,
%            pde.EquationModel/generateMesh

% Copyright 2023 The MathWorks, Inc.
% Built-in function.
