Maggie Gyllenhaal plays a doctor’s daughter and Hugh Dancy plays the inventor of the vibrator in “Hysteria,” out Friday.

“It’s pretty subversive to make a vibrator movie you can bring your mom to,” says Tanya Wexler, director of “Hysteria.” The film, in theaters Friday, is part Merchant Ivory (with its sumptuous Victorian costumes and sets) and part romantic comedy (Hugh Dancy and Maggie Gyllenhaal meet cute, battle and fall in love). It’s all mom-friendly stuff — set around the invention of every lady’s favorite intimate friend.

When Dr. Mortimer Granville (Dancy) invented the vibrator, it had little to do with pleasing a woman. The device helped him perform the maneuvers necessary to bring his female patients to “paroxysms” — then the polite term for “orgasm” — which was the recommended cure for hysteria in the late 1800s.

“Hysteria was a catch-all diagnosis,” says Wexler. “If you didn’t fit in the box society laid out for you, you could have been diagnosed with hysteria.”

Before Granville’s device, doctors treated women manually, which could cause severe hand cramps (the problem that inspired Granville’s invention). Portraying that — without tilting into X-rated territory — was a challenge for Wexler.

“I was up nights going, ‘What are we going to put on the [examination] table so the guys have something to manipulate?’” she says. “If they just pretend, it looks fake. We used a … Gore-Tex bag with sand in it. We just put it below the actresses’ bums and that was it. Jonathan Pryce [who plays Dr. Dalrymple, whose successful practice Granville joins] actually rubbed the skin off one of his knuckles.”

Ultimately, the function of a vibrator is to bring women to climax, and Wexler wanted to show that in a realistic light.

“You can’t close your eyes and hope for the best,” she says. “We only had budget and time for four days of ‘orgasm rehearsal’ — and that’s actually what it said on the schedule. Most of that [time was spent getting used to] props and costumes; it had to feel like this [treatment] was de rigueur for the guys, so all that had to seem like second nature.”

And as for that climactic moment (of which there are many in the film), Wexler had to walk a thin line. “If it’s too, ‘ooh ah ooh ah,’ it sounds like a bad porno. And if it’s too comedy, then the joke becomes, ‘ha ha, vibrator!’ We had to get it so that it was fun and joyous.”