From 568cb050f27286474b7ed0358c957f49205d346b Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 6 Oct 2020 12:47:41 +0200
Subject: [PATCH] STYLE: place projectCurveEdge, projectEdge into blockEdges
 namespace

- consistent with other blockEdge types
- adjust some debug output
---
 .../blockMesh/blockEdges/arcEdge/arcEdge.C    | 18 +++++++-------
 .../blockEdges/blockEdge/blockEdge.C          | 14 +++++------
 .../blockEdges/blockEdge/blockEdge.H          | 24 +++++++++----------
 .../blockMesh/blockEdges/lineEdge/lineEdge.C  |  4 ++--
 .../projectCurveEdge/projectCurveEdge.C       | 11 +++++----
 .../projectCurveEdge/projectCurveEdge.H       | 10 +++++---
 .../blockEdges/projectEdge/projectEdge.C      | 14 ++++++-----
 .../blockEdges/projectEdge/projectEdge.H      | 10 +++++---
 8 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
index 698fec2a8db..4e5d33badd1 100644
--- a/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
+++ b/src/mesh/blockMesh/blockEdges/arcEdge/arcEdge.C
@@ -271,13 +271,13 @@ Foam::blockEdges::arcEdge::arcEdge
         calcFromMidPoint(points_[start_], points_[end_], p);
     }
 
-    // Debug information
-    #if 0
-    Info<< "arc " << start_ << ' ' << end_
-        << ' ' << position(0.5) << ' ' << cs_
-        // << " radius=" << radius_ << " angle=" << radToDeg(angle_)
-        << nl;
-    #endif
+    if (debug)
+    {
+        Info<< "arc " << start_ << ' ' << end_ << ' '
+            << position(0.5) << " origin " << cs_.origin() << " // ";
+        cs_.rotation().write(Info);
+        Info<< nl;
+    }
 }
 
 
@@ -288,8 +288,8 @@ Foam::point Foam::blockEdges::arcEdge::position(const scalar lambda) const
     #ifdef FULLDEBUG
     if (lambda < -SMALL || lambda > 1 + SMALL)
     {
-        WarningInFunction
-            << "Parameter out of range, lambda = " << lambda << nl;
+        InfoInFunction
+            << "Limit parameter to [0-1] range: " << lambda << nl;
     }
     #endif
 
diff --git a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C
index a49880b1212..ece247bf14a 100644
--- a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C
+++ b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.C
@@ -124,8 +124,8 @@ Foam::pointField Foam::blockEdge::appendEndPoints
 Foam::tmp<Foam::pointField>
 Foam::blockEdge::position(const scalarList& lambdas) const
 {
-    tmp<pointField> tpoints(new pointField(lambdas.size()));
-    pointField& points = tpoints.ref();
+    auto tpoints = tmp<pointField>::New(lambdas.size());
+    auto& points = tpoints.ref();
 
     forAll(lambdas, i)
     {
@@ -135,20 +135,20 @@ Foam::blockEdge::position(const scalarList& lambdas) const
 }
 
 
-void Foam::blockEdge::write(Ostream& os, const dictionary& d) const
+void Foam::blockEdge::write(Ostream& os, const dictionary& dict) const
 {
-    blockVertex::write(os, start_, d);
+    blockVertex::write(os, start_, dict);
     os << tab;
-    blockVertex::write(os, end_, d);
+    blockVertex::write(os, end_, dict);
     os << endl;
 }
 
 
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-Foam::Ostream& Foam::operator<<(Ostream& os, const blockEdge& p)
+Foam::Ostream& Foam::operator<<(Ostream& os, const blockEdge& e)
 {
-    os << p.start_ << tab << p.end_ << endl;
+    os << e.start_ << tab << e.end_ << endl;
 
     return os;
 }
diff --git a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H
index dd48cba8343..ae87a2fc5bd 100644
--- a/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H
+++ b/src/mesh/blockMesh/blockEdges/blockEdge/blockEdge.H
@@ -35,7 +35,7 @@ Class
 
 Description
     Define a curved edge that is parameterized for 0<lambda<1
-    between the start and end point.
+    between the start/end points.
 
 SourceFiles
     blockEdge.C
@@ -54,7 +54,7 @@ namespace Foam
 
 // Forward Declarations
 class blockEdge;
-Ostream& operator<<(Ostream&, const blockEdge&);
+Ostream& operator<<(Ostream& os, const blockEdge& e);
 
 /*---------------------------------------------------------------------------*\
                          Class blockEdge Declaration
@@ -188,21 +188,21 @@ public:
         //- Index of end point
         inline label end() const;
 
-        //- Compare the given start and end points with this curve
+        //- Compare the given start/end points with this block edge
         //  Return:
         //  -  0: different
         //  - +1: identical
         //  - -1: same edge, but different orientation
-        inline int compare(const blockEdge&) const;
+        inline int compare(const blockEdge& e) const;
 
-        //- Compare the given start and end points with this curve
+        //- Compare the given start/end points with this block edge
         //  Return:
         //  -  0: different
         //  - +1: identical
         //  - -1: same edge, but different orientation
-        inline int compare(const edge&) const;
+        inline int compare(const edge& e) const;
 
-        //- Compare the given start and end points with this curve
+        //- Compare the given start/end points with this block edge
         //  Return:
         //  -  0: different
         //  - +1: identical
@@ -211,22 +211,22 @@ public:
 
         //- The point position corresponding to the curve parameter
         //  0 <= lambda <= 1
-        virtual point position(const scalar) const = 0;
+        virtual point position(const scalar lambda) const = 0;
 
         //- The point positions corresponding to the curve parameters
         //  0 <= lambda <= 1
-        virtual tmp<pointField> position(const scalarList&) const;
+        virtual tmp<pointField> position(const scalarList& lambdas) const;
 
         //- The length of the curve
         virtual scalar length() const = 0;
 
-        //- Write edge with variable backsubstitution
-        void write(Ostream&, const dictionary&) const;
+        //- Write edge with variable back-substitution
+        void write(Ostream& os, const dictionary& dict) const;
 
 
     // Ostream Operator
 
-        friend Ostream& operator<<(Ostream&, const blockEdge&);
+        friend Ostream& operator<<(Ostream& os, const blockEdge& e);
 };
 
 
diff --git a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C
index 203f16220a8..564240197c1 100644
--- a/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C
+++ b/src/mesh/blockMesh/blockEdges/lineEdge/lineEdge.C
@@ -74,8 +74,8 @@ Foam::point Foam::blockEdges::lineEdge::position(const scalar lambda) const
     #ifdef FULLDEBUG
     if (lambda < -SMALL || lambda > 1 + SMALL)
     {
-        WarningInFunction
-            << "Parameter out of range, lambda = " << lambda << nl;
+        InfoInFunction
+            << "Limit parameter to [0-1] range: " << lambda << nl;
     }
     #endif
 
diff --git a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C
index f6f182207a2..da862fd7d70 100644
--- a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C
+++ b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.C
@@ -38,15 +38,18 @@ License
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
+{
+namespace blockEdges
 {
     defineTypeNameAndDebug(projectCurveEdge, 0);
     addToRunTimeSelectionTable(blockEdge, projectCurveEdge, Istream);
 }
+}
 
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::projectCurveEdge::projectCurveEdge
+Foam::blockEdges::projectCurveEdge::projectCurveEdge
 (
     const dictionary& dict,
     const label index,
@@ -84,7 +87,7 @@ Foam::projectCurveEdge::projectCurveEdge
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
 Foam::point
-Foam::projectCurveEdge::position(const scalar) const
+Foam::blockEdges::projectCurveEdge::position(const scalar) const
 {
     NotImplemented;
     return point::max;
@@ -92,7 +95,7 @@ Foam::projectCurveEdge::position(const scalar) const
 
 
 Foam::tmp<Foam::pointField>
-Foam::projectCurveEdge::position(const scalarList& lambdas) const
+Foam::blockEdges::projectCurveEdge::position(const scalarList& lambdas) const
 {
     // For debugging to tag the output
     static label eIter = 0;
@@ -267,7 +270,7 @@ Foam::projectCurveEdge::position(const scalarList& lambdas) const
 }
 
 
-Foam::scalar Foam::projectCurveEdge::length() const
+Foam::scalar Foam::blockEdges::projectCurveEdge::length() const
 {
     NotImplemented;
     return 1;
diff --git a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.H b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.H
index 7f939b9d58b..528a7e1a303 100644
--- a/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.H
+++ b/src/mesh/blockMesh/blockEdges/projectCurveEdge/projectCurveEdge.H
@@ -25,7 +25,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::projectCurveEdge
+    Foam::blockEdges::projectCurveEdge
 
 Description
     Defines the edge from the projection onto a surface (single surface)
@@ -36,8 +36,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef projectCurveEdge_H
-#define projectCurveEdge_H
+#ifndef blockEdges_projectCurveEdge_H
+#define blockEdges_projectCurveEdge_H
 
 #include "blockEdge.H"
 
@@ -49,6 +49,9 @@ namespace Foam
 // Forward Declarations
 class pointConstraint;
 
+namespace blockEdges
+{
+
 /*---------------------------------------------------------------------------*\
                       Class projectCurveEdge Declaration
 \*---------------------------------------------------------------------------*/
@@ -116,6 +119,7 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace blockEdges
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.C b/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.C
index 16b99b1bbf3..40ce7fe178d 100644
--- a/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.C
+++ b/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.C
@@ -36,15 +36,17 @@ License
 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
+{
+namespace blockEdges
 {
     defineTypeNameAndDebug(projectEdge, 0);
     addToRunTimeSelectionTable(blockEdge, projectEdge, Istream);
 }
-
+}
 
 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
 
-void Foam::projectEdge::findNearest
+void Foam::blockEdges::projectEdge::findNearest
 (
     const point& pt,
     point& near,
@@ -80,7 +82,7 @@ void Foam::projectEdge::findNearest
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-Foam::projectEdge::projectEdge
+Foam::blockEdges::projectEdge::projectEdge
 (
     const dictionary& dict,
     const label index,
@@ -110,7 +112,7 @@ Foam::projectEdge::projectEdge
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-Foam::point Foam::projectEdge::position(const scalar lambda) const
+Foam::point Foam::blockEdges::projectEdge::position(const scalar lambda) const
 {
     // Initial guess
     const point start(points_[start_] + lambda*(points_[end_]-points_[start_]));
@@ -128,7 +130,7 @@ Foam::point Foam::projectEdge::position(const scalar lambda) const
 
 
 Foam::tmp<Foam::pointField>
-Foam::projectEdge::position(const scalarList& lambdas) const
+Foam::blockEdges::projectEdge::position(const scalarList& lambdas) const
 {
     // For debugging to tag the output
     static label eIter = 0;
@@ -270,7 +272,7 @@ Foam::projectEdge::position(const scalarList& lambdas) const
 }
 
 
-Foam::scalar Foam::projectEdge::length() const
+Foam::scalar Foam::blockEdges::projectEdge::length() const
 {
     NotImplemented;
     return 1;
diff --git a/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.H b/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.H
index 44c9d143d85..459f34f8308 100644
--- a/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.H
+++ b/src/mesh/blockMesh/blockEdges/projectEdge/projectEdge.H
@@ -25,7 +25,7 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Class
-    Foam::projectEdge
+    Foam::blockEdges::projectEdge
 
 Description
     Defines the edge from the projection onto a surface (single surface)
@@ -36,8 +36,8 @@ SourceFiles
 
 \*---------------------------------------------------------------------------*/
 
-#ifndef projectEdge_H
-#define projectEdge_H
+#ifndef blockEdges_projectEdge_H
+#define blockEdges_projectEdge_H
 
 #include "blockEdge.H"
 
@@ -49,6 +49,9 @@ namespace Foam
 // Forward Declarations
 class pointConstraint;
 
+namespace blockEdges
+{
+
 /*---------------------------------------------------------------------------*\
                          Class projectEdge Declaration
 \*---------------------------------------------------------------------------*/
@@ -118,6 +121,7 @@ public:
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+} // End namespace blockEdges
 } // End namespace Foam
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-- 
GitLab