Created new API for tabulated functions

This enables 2D and 3D tabulated functions, and discrete (non-interpolated) functions.