Fast topological analysis of 2D and 3D grids of data: Application to the atoms in molecule (AIM) and the electron localization function (ELF)