snappySnapDriverTemplates.C
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) 2015 OpenFOAM Foundation
9 Copyright (C) 2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "snappySnapDriver.H"
30
31// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32
33template<class FaceList>
34Foam::labelList Foam::snappySnapDriver::getFacePoints
35(
36 const indirectPrimitivePatch& pp,
37 const FaceList& faces
38)
39{
40 // Could use PrimitivePatch & localFaces to extract points but might just
41 // as well do it ourselves.
42
43 boolList pointOnZone(pp.nPoints(), false);
44
45 forAll(faces, i)
46 {
47 const face& f = faces[i];
48
49 forAll(f, fp)
50 {
51 label meshPointi = f[fp];
52
53 const auto iter = pp.meshPointMap().cfind(meshPointi);
54
55 if (iter.found())
56 {
57 const label pointi = iter.val();
58 pointOnZone[pointi] = true;
59 }
60 }
61 }
62
63 return findIndices(pointOnZone, true);
64}
65
66
67// ************************************************************************* //
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
Definition: HashTableI.H:141
A list of faces which address into the list of points.
label nPoints() const
Number of points supporting patch faces.
const Map< label > & meshPointMap() const
Mesh point map.
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
labelList f(nPoints)
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333