Magnetic interactions in nanostructured films and arrays