From c6a2710bbec146d828683469001438bd2ba96ce2 Mon Sep 17 00:00:00 2001
From: laurence <laurence>
Date: Tue, 20 Mar 2012 17:46:04 +0000
Subject: [PATCH] COMP: surfaceFeatureExtract: Clean up build

---
 .../surface/surfaceFeatureExtract/Allwmake    | 39 ++++----
 .../CGALPolyhedron/buildCGALPolyhedron.C      | 89 -------------------
 .../CGALPolyhedron/buildCGALPolyhedron.H      | 46 +++++++++-
 .../surfaceFeatureExtract/Make/options        | 12 +++
 .../surfaceFeatureExtract/MakeWithCGAL/files  |  4 -
 .../MakeWithCGAL/options                      | 29 ------
 .../MakeWithoutCGAL/files                     |  3 -
 .../MakeWithoutCGAL/options                   | 13 ---
 8 files changed, 71 insertions(+), 164 deletions(-)
 delete mode 100644 applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.C
 delete mode 100644 applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/files
 delete mode 100644 applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/options
 delete mode 100644 applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/files
 delete mode 100644 applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/options

diff --git a/applications/utilities/surface/surfaceFeatureExtract/Allwmake b/applications/utilities/surface/surfaceFeatureExtract/Allwmake
index e54f15ae282..369428e1713 100755
--- a/applications/utilities/surface/surfaceFeatureExtract/Allwmake
+++ b/applications/utilities/surface/surfaceFeatureExtract/Allwmake
@@ -3,30 +3,25 @@ cd ${0%/*} || exit 1    # run from this directory
 
 set -x
 
-if [ ! -e "Make/files" ] || [ ! -e "Make/options" ]
+if [ -n "$CGAL_ARCH_PATH" ]
 then
-    mkdir -p Make
-
-    if [ -n "$CGAL_ARCH_PATH" ]
-    then
-        cp -r MakeWithCGAL/* Make
-
-        echo
-        echo Compiling surfaceFeatureExtract with CGAL support for curvature
-        echo
-
-        wmake
-    else
-        cp -r MakeWithoutCGAL/* Make
-
-        echo
-        echo Compiling surfaceFeatureExtract without CGAL support for curvature
-        echo
-
-        wmake
-    fi
+    echo
+    echo "Compiling surfaceFeatureExtract with CGAL curvature support"
+    echo
+
+    wmake "ENABLE_CURVATURE=-DENABLE_CURVATURE \
+           EXE_FROUNDING_MATH=-frounding-math \
+           USE_F2C=-DCGAL_USE_F2C \
+           CGAL_LIBDIR=-L$CGAL_ARCH_PATH/lib \
+           LAPACK_LIB=-llapack \
+           BLAS_LIB=-lblas \
+           CGAL_LIB=-lCGAL"
 else
-    echo surfaceFeatureExtract already has a Make folder
+    echo
+    echo "Compiling surfaceFeatureExtract without CGAL curvature support"
+    echo
+
+    wmake
 fi
 
 
diff --git a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.C b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.C
deleted file mode 100644
index 63e2b904bf5..00000000000
--- a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.C
+++ /dev/null
@@ -1,89 +0,0 @@
-/*---------------------------------------------------------------------------*\
-  =========                 |
-  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-   \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
-     \\/     M anipulation  |
--------------------------------------------------------------------------------
-License
-    This file is part of OpenFOAM.
-
-    OpenFOAM is free software: you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
-
-\*---------------------------------------------------------------------------*/
-
-#include "buildCGALPolyhedron.H"
-
-// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
-
-Foam::buildCGALPolyhedron::buildCGALPolyhedron
-(
-    const Foam::triSurface& surf
-)
-:
-    CGAL::Modifier_base<HalfedgeDS>(),
-    surf_(surf)
-{}
-
-
-
-// * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
-
-Foam::buildCGALPolyhedron::~buildCGALPolyhedron()
-{}
-
-
-// * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * * //
-
-void Foam::buildCGALPolyhedron::operator()
-(
-    HalfedgeDS& hds
-)
-{
-    typedef HalfedgeDS::Traits     Traits;
-    typedef Traits::Point_3        Point;
-
-    // Postcondition: `hds' is a valid polyhedral surface.
-    CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> B(hds, false);
-
-    B.begin_surface
-    (
-        surf_.points().size(),      // n points
-        surf_.size(),               // n facets
-        2*surf_.edges().size()      // n halfedges
-    );
-
-    forAll(surf_.points(), pI)
-    {
-        const Foam::point& p = surf_.points()[pI];
-
-        B.add_vertex(Point(p.x(), p.y(), p.z()));
-    }
-
-    forAll(surf_, fI)
-    {
-        B.begin_facet();
-
-        B.add_vertex_to_facet(surf_[fI][0]);
-        B.add_vertex_to_facet(surf_[fI][1]);
-        B.add_vertex_to_facet(surf_[fI][2]);
-
-        B.end_facet();
-    }
-
-    B.end_surface();
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
index 3001a247d3e..30627c7463f 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
+++ b/applications/utilities/surface/surfaceFeatureExtract/CGALPolyhedron/buildCGALPolyhedron.H
@@ -53,7 +53,7 @@ namespace Foam
 {
 
 /*---------------------------------------------------------------------------*\
-                     Class buildCGALPolyhedron Declaration
+                    Class buildCGALPolyhedron Declaration
 \*---------------------------------------------------------------------------*/
 
 class buildCGALPolyhedron
@@ -80,18 +80,56 @@ public:
     // Constructors
 
         //- Construct with reference to triSurface
-        buildCGALPolyhedron(const triSurface& surf);
+        explicit buildCGALPolyhedron(const triSurface& surf)
+        :
+            CGAL::Modifier_base<HalfedgeDS>(),
+            surf_(surf)
+        {}
 
 
     //- Destructor
-    ~buildCGALPolyhedron();
+    ~buildCGALPolyhedron(){}
 
 
     // Member Operators
 
         //- operator() of this `modifier' called by delegate function of
         //  Polyhedron
-        void operator()(HalfedgeDS& hds);
+        void operator()(HalfedgeDS& hds)
+        {
+            typedef HalfedgeDS::Traits     Traits;
+            typedef Traits::Point_3        Point;
+
+            // Postcondition: `hds' is a valid polyhedral surface.
+            CGAL::Polyhedron_incremental_builder_3<HalfedgeDS> B(hds, false);
+
+            B.begin_surface
+            (
+                surf_.points().size(),      // n points
+                surf_.size(),               // n facets
+                2*surf_.edges().size()      // n halfedges
+            );
+
+            forAll(surf_.points(), pI)
+            {
+                const Foam::point& p = surf_.points()[pI];
+
+                B.add_vertex(Point(p.x(), p.y(), p.z()));
+            }
+
+            forAll(surf_, fI)
+            {
+                B.begin_facet();
+
+                B.add_vertex_to_facet(surf_[fI][0]);
+                B.add_vertex_to_facet(surf_[fI][1]);
+                B.add_vertex_to_facet(surf_[fI][2]);
+
+                B.end_facet();
+            }
+
+            B.end_surface();
+        }
 };
 
 
diff --git a/applications/utilities/surface/surfaceFeatureExtract/Make/options b/applications/utilities/surface/surfaceFeatureExtract/Make/options
index b733d5fde96..b2e5dcf5f7a 100644
--- a/applications/utilities/surface/surfaceFeatureExtract/Make/options
+++ b/applications/utilities/surface/surfaceFeatureExtract/Make/options
@@ -1,4 +1,11 @@
+include $(GENERAL_RULES)/CGAL
+
 EXE_INC = \
+    ${ENABLE_CURVATURE}\
+    ${EXE_FROUNDING_MATH} \
+    ${USE_F2C} \
+    ${CGAL_INC} \
+    -ICGALPolyhedron \
     -I$(LIB_SRC)/finiteVolume/lnInclude \
     -I$(LIB_SRC)/meshTools/lnInclude \
     -I$(LIB_SRC)/edgeMesh/lnInclude \
@@ -7,6 +14,11 @@ EXE_INC = \
     -I$(LIB_SRC)/sampling/lnInclude
 
 EXE_LIBS = \
+    $(CGAL_LIBS) \
+    ${CGAL_LIBDIR} \
+    ${LAPACK_LIB} \
+    ${BLAS_LIB} \
+    ${CGAL_LIB} \
     -lmeshTools \
     -ledgeMesh \
     -ltriSurface \
diff --git a/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/files b/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/files
deleted file mode 100644
index 0c0f6f7966e..00000000000
--- a/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/files
+++ /dev/null
@@ -1,4 +0,0 @@
-surfaceFeatureExtract.C
-CGALPolyhedron/buildCGALPolyhedron.C
-
-EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
diff --git a/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/options b/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/options
deleted file mode 100644
index 60833572b75..00000000000
--- a/applications/utilities/surface/surfaceFeatureExtract/MakeWithCGAL/options
+++ /dev/null
@@ -1,29 +0,0 @@
-EXE_FROUNDING_MATH = -frounding-math
-EXE_NDEBUG = -DNDEBUG
-USE_F2C = -DCGAL_USE_F2C
-include $(GENERAL_RULES)/CGAL
-
-EXE_INC = \
-    -DENABLE_CURVATURE \
-    ${EXE_FROUNDING_MATH} \
-    ${EXE_NDEBUG} \
-    ${USE_F2C} \
-    ${CGAL_INC} \
-    -ICGALPolyhedron \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/edgeMesh/lnInclude \
-    -I$(LIB_SRC)/triSurface/lnInclude \
-    -I$(LIB_SRC)/surfMesh/lnInclude \
-    -I$(LIB_SRC)/sampling/lnInclude
-
-EXE_LIBS = \
-    $(CGAL_LIBS) \
-    -L$(CGAL_ARCH_PATH)/lib \
-    -llapack \
-    -lblas \
-    -lCGAL \
-    -lmeshTools \
-    -ledgeMesh \
-    -ltriSurface \
-    -lsampling
diff --git a/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/files b/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/files
deleted file mode 100644
index a57125cd6a7..00000000000
--- a/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/files
+++ /dev/null
@@ -1,3 +0,0 @@
-surfaceFeatureExtract.C
-
-EXE = $(FOAM_APPBIN)/surfaceFeatureExtract
diff --git a/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/options b/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/options
deleted file mode 100644
index b733d5fde96..00000000000
--- a/applications/utilities/surface/surfaceFeatureExtract/MakeWithoutCGAL/options
+++ /dev/null
@@ -1,13 +0,0 @@
-EXE_INC = \
-    -I$(LIB_SRC)/finiteVolume/lnInclude \
-    -I$(LIB_SRC)/meshTools/lnInclude \
-    -I$(LIB_SRC)/edgeMesh/lnInclude \
-    -I$(LIB_SRC)/triSurface/lnInclude \
-    -I$(LIB_SRC)/surfMesh/lnInclude \
-    -I$(LIB_SRC)/sampling/lnInclude
-
-EXE_LIBS = \
-    -lmeshTools \
-    -ledgeMesh \
-    -ltriSurface \
-    -lsampling
-- 
GitLab