Text this: A time-domain algorithm for the analysis of second-harmonicgeneration in nonlinear optical structures