Transformation of diamond and graphite surfaces by ion irradiation