mergePoints.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Description
28  Merge points. See below.
29 
30 SourceFiles
31  mergePoints.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef mergePoints_H
36 #define mergePoints_H
37 
38 #include "scalar.H"
39 #include "labelList.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Function mergePoints Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 //- Sorts and merges points. All points closer than/equal mergeTol get merged.
51 // Returns the number of unique points and a map from old to new.
52 template<class PointList>
53 label mergePoints
54 (
55  const PointList& points,
56  const scalar mergeTol,
57  const bool verbose,
58  labelList& pointMap,
59  typename PointList::const_reference origin = PointList::value_type::zero
60 );
61 
62 
63 //- Sorts and merges points. Determines new points. Returns true if anything
64 // merged (though newPoints still sorted even if not merged).
65 template<class PointList>
66 bool mergePoints
67 (
68  const PointList& points,
69  const scalar mergeTol,
70  const bool verbose,
71  labelList& pointMap,
72  List<typename PointList::value_type>& newPoints,
73  typename PointList::const_reference origin = PointList::value_type::zero
74 );
75 
76 } // End namespace Foam
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 #ifdef NoRepository
81  #include "mergePoints.C"
82 #endif
83 
84 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
85 
86 #endif
87 
88 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
mergePoints.C
labelList.H
scalar.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::mergePoints
label mergePoints(const PointList &points, const scalar mergeTol, const bool verbose, labelList &pointMap, typename PointList::const_reference origin=PointList::value_type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
points
const pointField & points
Definition: gmvOutputHeader.H:1