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
25 \*---------------------------------------------------------------------------*/
27 #include "PrimitivePatch.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 template<class> class FaceList,
40 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
43 const edgeList& allEdges,
44 const labelListList& cellEdges,
45 const labelList& faceCells
50 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
52 << "calculating labels of patch edges in mesh edge list"
56 // get reference to the list of edges on the patch
57 const edgeList& PatchEdges = edges();
59 const labelListList& EdgeFaces = edgeFaces();
62 labelList meshEdges(PatchEdges.size());
64 register bool found = false;
66 // get reference to the points on the patch
67 const labelList& pp = meshPoints();
69 // WARNING: Remember that local edges address into local point list;
70 // local-to-global point label translation is necessary
71 forAll (PatchEdges, edgeI)
74 (pp[PatchEdges[edgeI].start()], pp[PatchEdges[edgeI].end()]);
78 // get the patch faces sharing the edge
79 const labelList& curFaces = EdgeFaces[edgeI];
81 forAll (curFaces, faceI)
83 // get the cell next to the face
84 label curCell = faceCells[curFaces[faceI]];
86 // get reference to edges on the cell
87 const labelList& ce = cellEdges[curCell];
89 forAll (ce, cellEdgeI)
91 if (allEdges[ce[cellEdgeI]] == curEdge)
95 meshEdges[edgeI] = ce[cellEdgeI];
112 template<class> class FaceList,
117 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
120 const edgeList& allEdges,
121 const labelListList& pointEdges
126 Info<< "labelList PrimitivePatch<Face, FaceList, PointField, PointType>"
127 << "::meshEdges() : "
128 << "calculating labels of patch edges in mesh edge list"
132 // get reference to the list of edges on the patch
133 const edgeList& PatchEdges = edges();
135 // create the storage
136 labelList meshEdges(PatchEdges.size());
138 // get reference to the points on the patch
139 const labelList& pp = meshPoints();
141 // WARNING: Remember that local edges address into local point list;
142 // local-to-global point label translation is necessary
143 forAll (PatchEdges, edgeI)
145 const label globalPointI = pp[PatchEdges[edgeI].start()];
146 const edge curEdge(globalPointI, pp[PatchEdges[edgeI].end()]);
148 const labelList& pe = pointEdges[globalPointI];
152 if (allEdges[pe[i]] == curEdge)
154 meshEdges[edgeI] = pe[i];
164 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
169 template<class> class FaceList,
174 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
180 // Get pointEdges from the starting point and search all the candidates
181 const edgeList& Edges = edges();
183 if (e.start() > -1 && e.start() < nPoints())
185 const labelList& pe = pointEdges()[e.start()];
189 if (e == Edges[pe[peI]])
196 // Edge not found. Return -1
201 // ************************************************************************* //