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/>.
25 Orders the local points on the patch for most efficient search
27 \*---------------------------------------------------------------------------*/
32 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
37 template<class> class FaceList,
42 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
43 calcLocalPointOrder() const
45 // Note: Cannot use bandCompressing as point-point addressing does
46 // not exist and is not considered generally useful.
51 Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
52 << "calcLocalPointOrder() : "
53 << "calculating local point order"
57 if (localPointOrderPtr_)
59 // it is considered an error to attempt to recalculate
60 // if already allocated
63 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
64 "calcLocalPointOrder()"
65 ) << "local point order already calculated"
69 const List<Face>& lf = localFaces();
71 const labelListList& ff = faceFaces();
73 boolList visitedFace(lf.size(), false);
75 localPointOrderPtr_ = new labelList(meshPoints().size(), -1);
77 labelList& pointOrder = *localPointOrderPtr_;
79 boolList visitedPoint(pointOrder.size(), false);
85 if (!visitedFace[faceI])
87 SLList<label> faceOrder(faceI);
91 const label curFace = faceOrder.first();
93 faceOrder.removeHead();
95 if (!visitedFace[curFace])
97 visitedFace[curFace] = true;
99 const labelList& curPoints = lf[curFace];
102 forAll(curPoints, pointI)
104 if (!visitedPoint[curPoints[pointI]])
106 visitedPoint[curPoints[pointI]] = true;
108 pointOrder[nPoints] = curPoints[pointI];
114 // add face neighbours to the list
115 const labelList& nbrs = ff[curFace];
119 if (!visitedFace[nbrs[nbrI]])
121 faceOrder.append(nbrs[nbrI]);
125 } while (faceOrder.size());
131 Pout<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
132 << "calcLocalPointOrder() "
133 << "finished calculating local point order"
139 // ************************************************************************* //