PrimitivePatchBdryPoints.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "PrimitivePatch.H"
27 #include "HashSet.H"
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 template<class FaceList, class PointField>
33 {
34  if (debug)
35  {
36  InfoInFunction << "Calculating boundary points" << endl;
37  }
38 
39  if (boundaryPointsPtr_)
40  {
41  // it is considered an error to attempt to recalculate
42  // if already allocated
44  << "edge types already calculated"
45  << abort(FatalError);
46  }
47 
48  const edgeList& e = edges();
49 
50  labelHashSet bp(2*e.size());
51 
52  for (label edgeI = nInternalEdges_; edgeI < e.size(); edgeI++)
53  {
54  const edge& curEdge = e[edgeI];
55 
56  bp.insert(curEdge.start());
57  bp.insert(curEdge.end());
58  }
59 
60  boundaryPointsPtr_ = new labelList(bp.toc());
61  sort(*boundaryPointsPtr_);
62 
63  if (debug)
64  {
65  Info<< " Finished." << endl;
66  }
67 }
68 
69 
70 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:111
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:211
A list of faces which address into the list of points.
List< edge > edgeList
Definition: edgeList.H:38
void sort(UList< T > &)
Definition: UList.C:115
List< label > labelList
A List of labels.
Definition: labelList.H:56
errorManip< error > abort(error &err)
Definition: errorManip.H:131
messageStream Info
#define InfoInFunction
Report an information message using Foam::Info.