1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "PrimitivePatch.H"
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 template<class> class FaceList,
39 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
42 const edgeList& allEdges,
43 const labelListList& cellEdges,
44 const labelList& faceCells
49 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
51 << "calculating labels of patch edges in mesh edge list"
55 // get reference to the list of edges on the patch
56 const edgeList& PatchEdges = edges();
58 const labelListList& EdgeFaces = edgeFaces();
61 labelList meshEdges(PatchEdges.size());
63 register bool found = false;
65 // get reference to the points on the patch
66 const labelList& pp = meshPoints();
68 // WARNING: Remember that local edges address into local point list;
69 // local-to-global point label translation is necessary
70 forAll(PatchEdges, edgeI)
73 (pp[PatchEdges[edgeI].start()], pp[PatchEdges[edgeI].end()]);
77 // get the patch faces sharing the edge
78 const labelList& curFaces = EdgeFaces[edgeI];
80 forAll(curFaces, faceI)
82 // get the cell next to the face
83 label curCell = faceCells[curFaces[faceI]];
85 // get reference to edges on the cell
86 const labelList& ce = cellEdges[curCell];
90 if (allEdges[ce[cellEdgeI]] == curEdge)
94 meshEdges[edgeI] = ce[cellEdgeI];
111 template<class> class FaceList,
116 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
119 const edgeList& allEdges,
120 const labelListList& pointEdges
125 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
126 << "::meshEdges() : "
127 << "calculating labels of patch edges in mesh edge list"
131 // get reference to the list of edges on the patch
132 const edgeList& PatchEdges = edges();
134 // create the storage
135 labelList meshEdges(PatchEdges.size());
137 // get reference to the points on the patch
138 const labelList& pp = meshPoints();
140 // WARNING: Remember that local edges address into local point list;
141 // local-to-global point label translation is necessary
142 forAll(PatchEdges, edgeI)
144 const label globalPointI = pp[PatchEdges[edgeI].start()];
145 const edge curEdge(globalPointI, pp[PatchEdges[edgeI].end()]);
147 const labelList& pe = pointEdges[globalPointI];
151 if (allEdges[pe[i]] == curEdge)
153 meshEdges[edgeI] = pe[i];
163 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
168 template<class> class FaceList,
173 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
179 // Get pointEdges from the starting point and search all the candidates
180 const edgeList& Edges = edges();
182 if (e.start() > -1 && e.start() < nPoints())
184 const labelList& pe = pointEdges()[e.start()];
188 if (e == Edges[pe[peI]])
195 // Edge not found. Return -1
200 // ************************************************************************* //