From 68b0c866a4bec8f24a837f08eeb4af8c55002a56 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Fri, 19 Jun 2015 15:49:10 +0100
Subject: [PATCH] surfaceToCell, surfaceToPoint: Add surface file name
 expansion Resolves feature-request
 http://www.openfoam.org/mantisbt/view.php?id=1754

---
 .../cellSources/surfaceToCell/surfaceToCell.C | 27 ++++++-------------
 .../surfaceToPoint/surfaceToPoint.C           | 18 ++++---------
 2 files changed, 13 insertions(+), 32 deletions(-)

diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
index f4a00090286..1b9e7e76433 100644
--- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
+++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -37,13 +37,9 @@ License
 
 namespace Foam
 {
-
-defineTypeNameAndDebug(surfaceToCell, 0);
-
-addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word);
-
-addToRunTimeSelectionTable(topoSetSource, surfaceToCell, istream);
-
+    defineTypeNameAndDebug(surfaceToCell, 0);
+    addToRunTimeSelectionTable(topoSetSource, surfaceToCell, word);
+    addToRunTimeSelectionTable(topoSetSource, surfaceToCell, istream);
 }
 
 
@@ -98,18 +94,15 @@ Foam::label Foam::surfaceToCell::getNearest
 }
 
 
-// Return true if nearest surface to points on cell makes largish angle
-// with nearest surface to cell centre. Returns false otherwise. Points visited
-// are cached in pointToNearest
 bool Foam::surfaceToCell::differingPointNormals
 (
     const triSurfaceSearch& querySurf,
 
-    const vector& span,         // current search span
+    const vector& span,         // Current search span
     const label cellI,
-    const label cellTriI,       // nearest (to cell centre) surface triangle
+    const label cellTriI,       // Nearest (to cell centre) surface triangle
 
-    Map<label>& pointToNearest  // cache for nearest triangle to point
+    Map<label>& pointToNearest  // Cache for nearest triangle to point
 ) const
 {
     const triSurface& surf = querySurf.surface();
@@ -366,7 +359,6 @@ void Foam::surfaceToCell::checkSettings() const
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
 Foam::surfaceToCell::surfaceToCell
 (
     const polyMesh& mesh,
@@ -397,7 +389,6 @@ Foam::surfaceToCell::surfaceToCell
 }
 
 
-// Construct from components. Externally supplied surface.
 Foam::surfaceToCell::surfaceToCell
 (
     const polyMesh& mesh,
@@ -430,7 +421,6 @@ Foam::surfaceToCell::surfaceToCell
 }
 
 
-// Construct from dictionary
 Foam::surfaceToCell::surfaceToCell
 (
     const polyMesh& mesh,
@@ -438,7 +428,7 @@ Foam::surfaceToCell::surfaceToCell
 )
 :
     topoSetSource(mesh),
-    surfName_(dict.lookup("file")),
+    surfName_(fileName(dict.lookup("file")).expand()),
     outsidePoints_(dict.lookup("outsidePoints")),
     includeCut_(readBool(dict.lookup("includeCut"))),
     includeInside_(readBool(dict.lookup("includeInside"))),
@@ -457,7 +447,6 @@ Foam::surfaceToCell::surfaceToCell
 }
 
 
-// Construct from Istream
 Foam::surfaceToCell::surfaceToCell
 (
     const polyMesh& mesh,
diff --git a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
index 34381e4a027..c7bd9743b27 100644
--- a/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
+++ b/src/meshTools/sets/pointSources/surfaceToPoint/surfaceToPoint.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -28,20 +28,15 @@ License
 #include "triSurfaceSearch.H"
 #include "triSurface.H"
 #include "cpuTime.H"
-
 #include "addToRunTimeSelectionTable.H"
 
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-
-defineTypeNameAndDebug(surfaceToPoint, 0);
-
-addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, word);
-
-addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, istream);
-
+    defineTypeNameAndDebug(surfaceToPoint, 0);
+    addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, word);
+    addToRunTimeSelectionTable(topoSetSource, surfaceToPoint, istream);
 }
 
 
@@ -125,7 +120,6 @@ void Foam::surfaceToPoint::checkSettings() const
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-// Construct from components
 Foam::surfaceToPoint::surfaceToPoint
 (
     const polyMesh& mesh,
@@ -145,7 +139,6 @@ Foam::surfaceToPoint::surfaceToPoint
 }
 
 
-// Construct from dictionary
 Foam::surfaceToPoint::surfaceToPoint
 (
     const polyMesh& mesh,
@@ -153,7 +146,7 @@ Foam::surfaceToPoint::surfaceToPoint
 )
 :
     topoSetSource(mesh),
-    surfName_(dict.lookup("file")),
+    surfName_(fileName(dict.lookup("file")).expand()),
     nearDist_(readScalar(dict.lookup("nearDistance"))),
     includeInside_(readBool(dict.lookup("includeInside"))),
     includeOutside_(readBool(dict.lookup("includeOutside")))
@@ -162,7 +155,6 @@ Foam::surfaceToPoint::surfaceToPoint
 }
 
 
-// Construct from Istream
 Foam::surfaceToPoint::surfaceToPoint
 (
     const polyMesh& mesh,
-- 
GitLab