Adaptive mesh coarsening for quadrilateral and hexahedral meshes