A unified approach for patterning via frontal photopolymerization