1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 \*---------------------------------------------------------------------------*/
29 #include "PrimitivePatch.H"
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
37 template<class> class FaceList,
43 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
46 const edgeList& allEdges,
47 const labelListList& cellEdges,
48 const labelList& faceCells
53 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
55 << "calculating labels of patch edges in mesh edge list"
59 // get reference to the list of edges on the patch
60 const edgeList& PatchEdges = edges();
62 const labelListList& EdgeFaces = edgeFaces();
65 labelList meshEdges(PatchEdges.size());
67 register bool found = false;
69 // get reference to the points on the patch
70 const labelList& pp = meshPoints();
72 // WARNING: Remember that local edges address into local point list;
73 // local-to-global point label translation is necessary
74 forAll (PatchEdges, edgeI)
77 (pp[PatchEdges[edgeI].start()], pp[PatchEdges[edgeI].end()]);
81 // get the patch faces sharing the edge
82 const labelList& curFaces = EdgeFaces[edgeI];
84 forAll (curFaces, faceI)
86 // get the cell next to the face
87 label curCell = faceCells[curFaces[faceI]];
89 // get reference to edges on the cell
90 const labelList& ce = cellEdges[curCell];
92 forAll (ce, cellEdgeI)
94 if (allEdges[ce[cellEdgeI]] == curEdge)
98 meshEdges[edgeI] = ce[cellEdgeI];
115 template<class> class FaceList,
121 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
124 const edgeList& allEdges,
125 const labelListList& pointEdges
130 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
131 << "::meshEdges() : "
132 << "calculating labels of patch edges in mesh edge list"
136 // get reference to the list of edges on the patch
137 const edgeList& PatchEdges = edges();
139 // create the storage
140 labelList meshEdges(PatchEdges.size());
142 // get reference to the points on the patch
143 const labelList& pp = meshPoints();
145 // WARNING: Remember that local edges address into local point list;
146 // local-to-global point label translation is necessary
147 forAll (PatchEdges, edgeI)
149 const label globalPointI = pp[PatchEdges[edgeI].start()];
150 const edge curEdge(globalPointI, pp[PatchEdges[edgeI].end()]);
152 const labelList& pe = pointEdges[globalPointI];
156 if (allEdges[pe[i]] == curEdge)
158 meshEdges[edgeI] = pe[i];
168 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
173 template<class> class FaceList,
179 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
185 // Get pointEdges from the starting point and search all the candidates
186 const edgeList& Edges = edges();
188 if (e.start() > -1 && e.start() < nPoints())
190 const labelList& pe = pointEdges()[e.start()];
194 if (e == Edges[pe[peI]])
201 // Edge not found. Return -1
206 // ************************************************************************* //