function geom3 = addCell(geom1,geom2)
% Internal use only
% Copyright 2023 The MathWorks, Inc.
arguments
    geom1 (1,1) fegeometry
    geom2 (1,1) fegeometry
end
if ~isa(geom1.GeomRep,'pde.DiscreteGeometry') || ...
        ~isa(geom2.GeomRep,'pde.DiscreteGeometry')
    error(message('pde:pdeGeometryClass:GeometryMustBe3D'));
end
gm1 = copy(geom1.GeomRep);
gm2 = copy(geom2.GeomRep);
try
    gm3 = addCellInternal(gm1,gm2);
catch ME
    throwAsCaller(ME);
end
geom3 = fegeometry(gm3);
if nargout < 1
    warning(message('pde:fegeometry:NoOutput'));
end

    function newObj = copy(obj)
        objByteArray = getByteStreamFromArray(obj);
        newObj = getArrayFromByteStream(objByteArray);
    end
end
