The design of refractive beam shaping elements can be done by the geometrical-optical approach based on ray optics. This means one has to find a map transformation, which transforms an input to a desired output distribution and can additionally be realized by an element with a continuous surface. Easy procedures to find transformations, fulfilling both of these conditions at the same time, exist only for one-dimensional and for special two-dimensional signals, e.g. separate or circular distributions. To realize completely arbitrary two-dimensional signal distributions only iterative methods, based on the wave nature of light, are applicable, e.g. the Iterative Fourier-Transform Algorithm (IFTA). However, they can not be used to design elements with a continuous surface since they usually introduce phase dislocations to the signal distribution. We present an algorithm, which uses both geometrical and wave optical methods to find a most suitable, refractive solution for two-dimensional beam shaping problems. An Iterative Mesh-Adaption Algorithm (IMA), based on the geometrical-optical domain, is used to find a map transformation to describe the energy rearrangement. An IFTA, working in the wave optical domain, is used to refine the mesh. The IFTA produces phase dislocations in the beam shaping element, but nevertheless its output can be used to change parts of the mesh. Both algorithms are used in an alternating fashion. We present the design, fabrication and characterization of beam shaping elements, realized with the help of this method.