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 Point addressing on the patch: pointEdges and pointFaces.
27 \*---------------------------------------------------------------------------*/
29 #include "PrimitivePatch.H"
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 template<class> class FaceList,
43 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
44 calcPointEdges() const
48 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
49 << "calcPointEdges() : calculating pointEdges"
55 // it is considered an error to attempt to recalculate
56 // if already allocated
59 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
61 ) << "pointEdges already calculated"
65 const edgeList& e = edges();
67 // set up storage for pointEdges
68 List<SLList<label> > pointEdges(meshPoints().size());
72 pointEdges[e[edgeI].start()].append(edgeI);
73 pointEdges[e[edgeI].end()].append(edgeI);
77 pointEdgesPtr_ = new labelListList(pointEdges.size());
79 labelListList& pe = *pointEdgesPtr_;
81 forAll(pointEdges, pointI)
83 const SLList<label>& pEdge = pointEdges[pointI];
85 pe[pointI].setSize(pEdge.size());
88 forAllConstIter(SLList<label>, pEdge, iter)
90 pe[pointI][i++] = iter();
96 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
97 << "calcPointEdges() finished calculating pointEdges"
106 template<class> class FaceList,
111 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
112 calcPointFaces() const
116 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
117 << "calcPointFaces() : calculating pointFaces"
123 // it is considered an error to attempt to recalculate
124 // if already allocated
127 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
129 ) << "pointFaces already calculated"
130 << abort(FatalError);
133 const List<Face>& f = localFaces();
135 // set up storage for pointFaces
136 List<SLList<label> > pointFcs(meshPoints().size());
140 const Face& curPoints = f[faceI];
142 forAll(curPoints, pointI)
144 pointFcs[curPoints[pointI]].append(faceI);
149 pointFacesPtr_ = new labelListList(pointFcs.size());
151 labelListList& pf = *pointFacesPtr_;
153 forAll(pointFcs, pointI)
155 pf[pointI].setSize(pointFcs[pointI].size());
158 forAllIter(SLList<label>, pointFcs[pointI], curFacesIter)
160 pf[pointI][i++] = curFacesIter();
166 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
167 << "calcPointFaces() finished calculating pointFaces"
173 // ************************************************************************* //