An adaptive discretization for incompressible and compressible flow using a multitude of moving Cartesian grids with gap flow treatment