A gluing method for non-matching meshes