As often as Lasse Hallström has directed melodrama (Dear John, Chocolat), he has yet to master the style; his films are excruciatingly self-serious in a genre that rewards good-natured uncouthness. In this adaptation of a Nicholas Sparks novel, Hallström almost gets the formula right. A mysterious woman (Julianne Hough) skips town on a charter bus and winds up in a sleepy coastal community; she meets and falls for a man recently widowed (Josh Duhamel), but her past comes back to haunt her. Hallström flies in the face of narrative and thematic logic, and keeping up with the movie’s inane plot twists makes for a capricious good time, but an unimaginative denouement turns the whole thing into a fool’s errand.