  In the last few decades, numerical simulation for nonlinear oscillators has
received a great deal of attention, and many researchers have been concerned
with the design and analysis of numerical methods for solving oscillatory
problems. In this paper, from the perspective of the continuous finite element
method, we propose and analyze new energy-preserving functionally fitted
methods, in particular trigonometrically fitted methods of an arbitrarily high
order for solving oscillatory nonlinear Hamiltonian systems with a fixed
frequency. To implement these new methods in a widespread way, they are
transformed into a class of continuous-stage Runge--Kutta methods. This paper
is accompanied by numerical experiments on oscillatory Hamiltonian systems such
as the FPU problem and nonlinear Schr\"odinger equation. The numerical results
demonstrate the remarkable accuracy and efficiency of our new methods compared
with the existing high-order energy-preserving methods in the literature.
