Controlling frontal photopolymerization with optical attenuation and mass diffusion