Based on patch contributed by Alexey Matveichev Resolves feature request http://bugs.openfoam.org/view.php?id=2328