The Dirichlet integral for mappings between manifolds: Cartesian currents and homology