From 53d01c8a0ad0aa9a27f20fbca9d6e2227601378c Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 15 Apr 2019 09:55:43 +0200
Subject: [PATCH] ENH: construct axisAngleRotation from x/y/z axis enumeration
 (#863)

- can be helpful for handling rotations within global planes
---
 .../coordinate/rotation/axisAngleRotation.C    | 18 +++++++++++++++++-
 .../coordinate/rotation/axisAngleRotation.H    |  7 +++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/meshTools/coordinate/rotation/axisAngleRotation.C b/src/meshTools/coordinate/rotation/axisAngleRotation.C
index 97a7f70d89a..1e88f383f61 100644
--- a/src/meshTools/coordinate/rotation/axisAngleRotation.C
+++ b/src/meshTools/coordinate/rotation/axisAngleRotation.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2018-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -106,6 +106,22 @@ Foam::coordinateRotations::axisAngle::axisAngle
 }
 
 
+Foam::coordinateRotations::axisAngle::axisAngle
+(
+    const vector::components axis,
+    scalar angle,
+    bool degrees
+)
+:
+    coordinateRotation(),
+    axis_(Zero),
+    angle_(angle),
+    degrees_(degrees)
+{
+    axis_[axis] = 1;
+}
+
+
 Foam::coordinateRotations::axisAngle::axisAngle(const dictionary& dict)
 :
     axisAngle
diff --git a/src/meshTools/coordinate/rotation/axisAngleRotation.H b/src/meshTools/coordinate/rotation/axisAngleRotation.H
index a08053400d1..0b5533331e5 100644
--- a/src/meshTools/coordinate/rotation/axisAngleRotation.H
+++ b/src/meshTools/coordinate/rotation/axisAngleRotation.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2018-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -50,7 +50,7 @@ Note
     The rotation axis will be normalized internally.
 
 SourceFiles
-    axisAngle.C
+    axisAngleRotation.C
 
 \*---------------------------------------------------------------------------*/
 
@@ -111,6 +111,9 @@ public:
         //- Construct from axis and angle
         axisAngle(const vector& axis, scalar angle, bool degrees);
 
+        //- Construct from x/y/z axis enumeration and angle
+        axisAngle(const vector::components axis, scalar angle, bool degrees);
+
         //- Construct from dictionary
         explicit axisAngle(const dictionary& dict);
 
-- 
GitLab