The joint far-infrared-optical luminosity function for spiral galaxies and data for the Abell 400 and Cancer clusters