Effect of hydrofoil flexibility on the power extraction of a flapping tidal generator via two- and three-dimensional flow simulations