A general superelement generation strategy for piecewise periodic media. (17th March 2020)