We have developed a method that enables a fast and exact evaluation of the long-range interaction field by simulating the lattice dipolar systems with periodic boundary conditions. The method is based on the combination of the fast-Fourier-transformation technique and the modified Ewald method for the lattice sum calculation. We have used our algorithm for simulations of the quasistatic remagnetization processes in twodimensional hexagonal lattices of dipoles with the uniaxial on-site anisotropy ͑anisotropic Heisenberg model with the long-range dipolar interaction͒, which can be considered as a plausible model of a thin polycrystalline magnetic film with the intergrain exchange and with each crystallite having its own single-grain anisotropy. During the remagnetization process we observe typical ripplelike magnetization structures well known from the experimental observations. The parameters of these structures as functions of the exchange and anisotropy strength are studied. ͓S0163-1829͑98͒03522-X͔