This paper describes a program for the solution of boundary-value problems of the elliptic type by means of the finite-element method and a generalized finite-difference method developed by the authors. The program is oriented toward the reduction of input operations to those strictly needed to define a given problem physically, and it has been designed to allow automatic grid optimization. The generalized finite-difference method can handle completely irregular grids, and allows the discretization of any form of second-order elliptic equation under general boundary and interface conditions. To show the potentiality of the method, an example of magnetic field problem with sharp boundary, non-homogeneous anisotropic material and non-uniform current density distribution is presented, and the results are compared with the theoretical solution. Finally, the results obtained and the potentiality of the program are discussed.