PrimitivePatchBdryPoints.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) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "PrimitivePatch.H"
29 #include "HashSet.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 template
34 <
35  class Face,
36  template<class> class FaceList,
37  class PointField,
38  class PointType
39 >
40 void
42 calcBdryPoints() const
43 {
44  if (debug)
45  {
46  InfoInFunction << "Calculating boundary points" << endl;
47  }
48 
49  if (boundaryPointsPtr_)
50  {
51  // Error to recalculate if already allocated
53  << "boundaryPoints already calculated"
54  << abort(FatalError);
55  }
56 
57  const edgeList& e = edges();
58 
59  labelHashSet bp(2*e.size());
60 
61  for (label edgeI = nInternalEdges_; edgeI < e.size(); edgeI++)
62  {
63  const edge& curEdge = e[edgeI];
64 
65  bp.insert(curEdge.start());
66  bp.insert(curEdge.end());
67  }
68 
69  boundaryPointsPtr_ = new labelList(bp.sortedToc());
70 
71  if (debug)
72  {
73  Info<< " Finished." << endl;
74  }
75 }
76 
77 
78 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:74
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:316
Foam::edgeList
List< edge > edgeList
A List of edges.
Definition: edgeList.H:63
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::label
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:62
PrimitivePatch.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
HashSet.H
Foam::FatalError
error FatalError
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::labelHashSet
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys and label hasher.
Definition: HashSet.H:415
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:90