We developed a general library for handling a class of objects we call geographical curvilinear grids (GCLgrids). A GCLgrid is a distorted, uniform grid that is georeferenced. The GCLgrid library is implemented in an object oriented system with methods that relate points in the grid to a geographic reference frame. A simple example is a spherical shell divided along latitude, longitude, and depth, but more elaborate shapes can use the same interface. Scalar and vector fields are derived from the base grid through inheritance. Two algorithms are the core of this library. First, we use the Direction Set method to search for a location in space from a starting point. This algorithm converges reasonably fast if the grid is not extremely distorted. Second, we interpolate the grid using methods known from finite element analysis. A Jacobian matrix for an 8-node cube is computed to transform a distorted cube into a unit one. Shape functions for the standard cube are used to compute interpolation coefficients. Once the interpolation coefficients are computed, we can interpolate n-element vectors almost as quickly as scalar data. We show an application of the library to travel time table calculation at regional distances. Our table interpolator was found to be 10 times faster than one based on the tau-p method and is expected to be several orders of magnitude faster than 3D ray-tracing methods. Travel time interpolation errors are reduced significantly by tabulating delay times relative to a homogenous reference model instead of absolute times. This allows much coarser grids to be used at large scales comparing to one using total time. (c) 2005 Published by Elsevier Ltd.