The theory of irregular waveguides and open resonators