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-2018 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
32 <
33  class Face,
34  template<class> class FaceList,
35  class PointField,
36  class PointType
37 >
38 void
40 calcBdryPoints() const
41 {
42  if (debug)
43  {
44  InfoInFunction << "Calculating boundary points" << endl;
45  }
46 
47  if (boundaryPointsPtr_)
48  {
49  // it is considered an error to attempt to recalculate
50  // if already allocated
52  << "edge types already calculated"
53  << abort(FatalError);
54  }
55 
56  const edgeList& e = edges();
57 
58  labelHashSet bp(2*e.size());
59 
60  for (label edgeI = nInternalEdges_; edgeI < e.size(); edgeI++)
61  {
62  const edge& curEdge = e[edgeI];
63 
64  bp.insert(curEdge.start());
65  bp.insert(curEdge.end());
66  }
67 
68  boundaryPointsPtr_ = new labelList(bp.toc());
69  sort(*boundaryPointsPtr_);
70 
71  if (debug)
72  {
73  Info<< " Finished." << endl;
74  }
75 }
76 
77 
78 // ************************************************************************* //
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:256
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
Definition: HashSet.H:210
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.