mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Remove dependencies on CGAL because of new curvature calculation method
This commit is contained in:
@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
|
||||
set -x
|
||||
|
||||
if [ -n "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
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 \
|
||||
CGAL_BOOST_LIB=-lboost_thread \
|
||||
CGAL_MPFR_LIB=-lmpfr"
|
||||
else
|
||||
echo
|
||||
echo "Compiling surfaceFeatureExtract without CGAL curvature support"
|
||||
echo
|
||||
|
||||
wmake
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -1,228 +0,0 @@
|
||||
#ifndef CGAL_PSURF_RINGS_H_
|
||||
#define CGAL_PSURF_RINGS_H_
|
||||
|
||||
// This file adapted from
|
||||
// CGAL-4.0/examples/Jet_fitting_3/PolyhedralSurf_rings.h
|
||||
// Licensed under CGAL-4.0/LICENSE.FREE_USE
|
||||
|
||||
// Copyright (c) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace std;
|
||||
|
||||
template
|
||||
<
|
||||
class TPoly,
|
||||
class VertexPropertyMap
|
||||
>
|
||||
|
||||
class T_PolyhedralSurf_rings
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Polyhedron
|
||||
typedef typename TPoly::Vertex Vertex;
|
||||
typedef typename TPoly::Halfedge Halfedge;
|
||||
typedef typename TPoly::Facet Facet;
|
||||
typedef typename TPoly::Halfedge_around_vertex_circulator
|
||||
Halfedge_around_vertex_circulator;
|
||||
typedef typename TPoly::Vertex_iterator Vertex_iterator;
|
||||
|
||||
// vertex indices are initialised to -1
|
||||
static void reset_ring_indices
|
||||
(
|
||||
std::vector< Vertex* >& vces,
|
||||
VertexPropertyMap& vpm
|
||||
);
|
||||
|
||||
// i >= 1; from a start vertex on the current i-1 ring, push non-visited
|
||||
// neighbors of start in the nextRing and set indices to i. Also add these
|
||||
// vertices in all.
|
||||
static void push_neighbours_of
|
||||
(
|
||||
Vertex* start,
|
||||
int ith,
|
||||
std::vector< Vertex* >& nextRing,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm
|
||||
);
|
||||
|
||||
// i >= 1, from a currentRing i-1, collect all neighbors, set indices
|
||||
// to i and store them in nextRing and all.
|
||||
static void collect_ith_ring
|
||||
(
|
||||
int ith,
|
||||
std::vector< Vertex* >& currentRing,
|
||||
std::vector< Vertex* >& nextRing,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// collect i>=1 rings : all neighbours up to the ith ring,
|
||||
static void collect_i_rings
|
||||
(
|
||||
Vertex* v,
|
||||
int ring_i,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm
|
||||
);
|
||||
|
||||
//collect enough rings (at least 1), to get at least min_nb of neighbors
|
||||
static void collect_enough_rings
|
||||
(
|
||||
Vertex* v,
|
||||
unsigned int min_nb,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
////IMPLEMENTATION////////////////////////////////////////////////////
|
||||
|
||||
template< class TPoly , class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
push_neighbours_of(Vertex* start, int ith,
|
||||
std::vector< Vertex* >& nextRing,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
Vertex *v;
|
||||
Halfedge_around_vertex_circulator
|
||||
hedgeb = start->vertex_begin(), hedgee = hedgeb;
|
||||
|
||||
CGAL_For_all(hedgeb, hedgee)
|
||||
{
|
||||
v = &*(hedgeb->opposite()->vertex());
|
||||
if (get(vpm, v) != -1) continue; //if visited: next
|
||||
|
||||
put(vpm, v, ith);
|
||||
nextRing.push_back(v);
|
||||
all.push_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TPoly, class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
collect_ith_ring(int ith, std::vector< Vertex* >& currentRing,
|
||||
std::vector< Vertex* >& nextRing,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
typename std::vector< Vertex* >::iterator
|
||||
itb = currentRing.begin(), ite = currentRing.end();
|
||||
|
||||
CGAL_For_all(itb, ite)
|
||||
{
|
||||
push_neighbours_of(*itb, ith, nextRing, all, vpm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TPoly, class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
reset_ring_indices(std::vector< Vertex* >& vces,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
typename std::vector< Vertex* >::iterator
|
||||
itb = vces.begin(), ite = vces.end();
|
||||
|
||||
CGAL_For_all(itb, ite)
|
||||
{
|
||||
put(vpm, *itb, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TPoly, class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
collect_i_rings(Vertex* v,
|
||||
int ring_i,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
std::vector<Vertex*> current_ring, next_ring;
|
||||
std::vector<Vertex*> *p_current_ring, *p_next_ring;
|
||||
assert(ring_i >= 1);
|
||||
|
||||
//initialize
|
||||
p_current_ring = ¤t_ring;
|
||||
p_next_ring = &next_ring;
|
||||
put(vpm, v, 0);
|
||||
current_ring.push_back(v);
|
||||
all.push_back(v);
|
||||
|
||||
for (int i=1; i<=ring_i; i++)
|
||||
{
|
||||
collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm);
|
||||
//next round must be launched from p_nextRing...
|
||||
p_current_ring->clear();
|
||||
std::swap(p_current_ring, p_next_ring);
|
||||
}
|
||||
|
||||
//clean up
|
||||
reset_ring_indices(all, vpm);
|
||||
}
|
||||
|
||||
|
||||
template<class TPoly, class VertexPropertyMap>
|
||||
void T_PolyhedralSurf_rings <TPoly, VertexPropertyMap>::
|
||||
collect_enough_rings(Vertex* v,
|
||||
unsigned int min_nb,
|
||||
std::vector< Vertex* >& all,
|
||||
VertexPropertyMap& vpm)
|
||||
{
|
||||
std::vector<Vertex*> current_ring, next_ring;
|
||||
std::vector<Vertex*> *p_current_ring, *p_next_ring;
|
||||
|
||||
//initialize
|
||||
p_current_ring = ¤t_ring;
|
||||
p_next_ring = &next_ring;
|
||||
put(vpm, v, 0);
|
||||
current_ring.push_back(v);
|
||||
all.push_back(v);
|
||||
|
||||
int i = 1;
|
||||
|
||||
while ( (all.size() < min_nb) && (p_current_ring->size() != 0) )
|
||||
{
|
||||
collect_ith_ring(i, *p_current_ring, *p_next_ring, all, vpm);
|
||||
//next round must be launched from p_nextRing...
|
||||
p_current_ring->clear();
|
||||
std::swap(p_current_ring, p_next_ring);
|
||||
i++;
|
||||
}
|
||||
|
||||
//clean up
|
||||
reset_ring_indices(all, vpm);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@ -1,144 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 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/>.
|
||||
|
||||
Class
|
||||
Foam::buildCGALPolyhedron
|
||||
|
||||
Description
|
||||
Convert a triSurface into a CGAL Polyhedron
|
||||
|
||||
SourceFiles
|
||||
buildCGALPolyhedron.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef buildCGALPolyhedron_H
|
||||
#define buildCGALPolyhedron_H
|
||||
|
||||
#include "triSurface.H"
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
typedef Polyhedron::HalfedgeDS HalfedgeDS;
|
||||
typedef Polyhedron::Vertex Vertex;
|
||||
typedef Polyhedron::Vertex_iterator Vertex_iterator;
|
||||
typedef Kernel::Point_3 Point_3;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class buildCGALPolyhedron Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class buildCGALPolyhedron
|
||||
:
|
||||
public CGAL::Modifier_base<HalfedgeDS>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to triSurface to convert
|
||||
const Foam::triSurface& surf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
buildCGALPolyhedron(const buildCGALPolyhedron&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const buildCGALPolyhedron&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct with reference to triSurface
|
||||
explicit buildCGALPolyhedron(const triSurface& surf)
|
||||
:
|
||||
CGAL::Modifier_base<HalfedgeDS>(),
|
||||
surf_(surf)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~buildCGALPolyhedron(){}
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- operator() of this `modifier' called by delegate function of
|
||||
// Polyhedron
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,11 +1,4 @@
|
||||
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 \
|
||||
@ -14,13 +7,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
$(CGAL_LIBS) \
|
||||
${CGAL_BOOST_LIB} \
|
||||
${CGAL_MPFR_LIB} \
|
||||
${CGAL_LIBDIR} \
|
||||
${LAPACK_LIB} \
|
||||
${BLAS_LIB} \
|
||||
${CGAL_LIB} \
|
||||
-lmeshTools \
|
||||
-ledgeMesh \
|
||||
-ltriSurface \
|
||||
|
||||
Reference in New Issue
Block a user