fix energy tracking of gravitational work in NewtonIntegrator
fix compilation warning in Grid.hpp and prettify its code