We present a new algorithm for the generation of 3-dimensional (3-D) grids for the simulation of semiconductor devices. The fitting of the device geometry and the required mesh density is obtained by partitioning the elements at an optimal point at each refinement step. This allows the fitting of more general 3-D device geometries and the reduction of grid points in comparison with previous grid generators.