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 -------------------------------------------------------------------------------
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 \*---------------------------------------------------------------------------*/
28 
29 #include "snappySnapDriver.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 template<class FaceList>
34 Foam::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 // ************************************************************************* //
snappySnapDriver.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::PrimitivePatch::nPoints
label nPoints() const
Number of points supporting patch faces.
Definition: PrimitivePatch.H:316
f
labelList f(nPoints)
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:63
Foam::findIndices
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::PrimitivePatch::meshPointMap
const Map< label > & meshPointMap() const
Mesh point map.
Definition: PrimitivePatch.C:343
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79