A generic grid interface for parallel and adaptive scientific computing. Part I: abstract framework