From 1f9533ed5ca5eebbb6f38253fc66f6229f255364 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 2 Nov 2018 18:36:14 +0100
Subject: [PATCH] COMP: avoid ternary mismatch in PatchFunction1

- SubField<vector> vs Field<vector>
---
 src/meshTools/PatchFunction1/PatchFunction1.C | 29 +++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/meshTools/PatchFunction1/PatchFunction1.C b/src/meshTools/PatchFunction1/PatchFunction1.C
index 2c41e53b905..94bbdf3f708 100644
--- a/src/meshTools/PatchFunction1/PatchFunction1.C
+++ b/src/meshTools/PatchFunction1/PatchFunction1.C
@@ -135,10 +135,8 @@ Foam::PatchFunction1<Type>::localPosition(const pointField& globalPos) const
     {
         return globalPos;
     }
-    else
-    {
-        return coordSys_.coordSys()().localPosition(globalPos);
-    }
+
+    return coordSys_.coordSys()().localPosition(globalPos);
 }
 
 
@@ -153,13 +151,13 @@ Foam::tmp<Foam::Field<Type>> Foam::PatchFunction1<Type>::transform
         return tfld;
     }
 
-    const pointField& fc =
+    tmp<Field<Type>> tresult =
     (
         faceValues_
-      ? this->patch_.faceCentres()
-      : this->patch_.localPoints()
+      ? this->coordSys_.transform(this->patch_.faceCentres(), tfld())
+      : this->coordSys_.transform(this->patch_.localPoints(), tfld())
     );
-    auto tresult = this->coordSys_.transform(fc, tfld());
+
     tfld.clear();
     return tresult;
 }
@@ -176,13 +174,14 @@ Foam::tmp<Foam::Field<Type>> Foam::PatchFunction1<Type>::transform
         return fld;
     }
 
-    const pointField& fc =
-    (
-        faceValues_
-      ? this->patch_.faceCentres()
-      : this->patch_.localPoints()
-    );
-    return this->coordSys_.transform(fc, fld);
+    if (faceValues_)
+    {
+        return this->coordSys_.transform(this->patch_.faceCentres(), fld);
+    }
+    else
+    {
+        return this->coordSys_.transform(this->patch_.localPoints(), fld);
+    }
 }
 
 
-- 
GitLab