Multiscale forward and inverse problems with the DGFD method and the deep learning method