Method of moments simulation of infinite and finite periodic structures and application to high-gain metamaterial antennas