Finite element formulation of the discrete-ordinates method for multidimensional geometries