Invariants of the Euler equations for ideal or barotropic hydrodynamics and superconductivity in D dimensions