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
26 Point addressing on the patch: pointEdges and pointFaces.
28 \*---------------------------------------------------------------------------*/
30 #include "PrimitivePatch.H"
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
39 template<class> class FaceList,
44 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
45 calcPointEdges() const
49 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
50 << "calcPointEdges() : calculating pointEdges"
56 // it is considered an error to attempt to recalculate
57 // if already allocated
60 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
62 ) << "pointEdges already calculated"
66 const edgeList& e = edges();
68 // set up storage for pointEdges
69 List<SLList<label> > pointEdges(meshPoints().size());
73 pointEdges[e[edgeI].start()].append(edgeI);
74 pointEdges[e[edgeI].end()].append(edgeI);
78 pointEdgesPtr_ = new labelListList(pointEdges.size());
80 labelListList& pe = *pointEdgesPtr_;
82 forAll (pointEdges, pointI)
84 pe[pointI].setSize(pointEdges[pointI].size());
89 SLList<label>::iterator curEdgesIter = pointEdges[pointI].begin();
90 curEdgesIter != pointEdges[pointI].end();
94 pe[pointI][i] = curEdgesIter();
100 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
101 << "calcPointEdges() finished calculating pointEdges"
110 template<class> class FaceList,
115 Foam::PrimitivePatch<Face, FaceList, PointField, PointType>::
116 calcPointFaces() const
120 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
121 << "calcPointFaces() : calculating pointFaces"
127 // it is considered an error to attempt to recalculate
128 // if already allocated
131 "PrimitivePatch<Face, FaceList, PointField, PointType>::"
133 ) << "pointFaces already calculated"
134 << abort(FatalError);
137 const List<Face>& f = localFaces();
139 // set up storage for pointFaces
140 List<SLList<label> > pointFcs(meshPoints().size());
144 const Face& curPoints = f[faceI];
146 forAll (curPoints, pointI)
148 pointFcs[curPoints[pointI]].append(faceI);
153 pointFacesPtr_ = new labelListList(pointFcs.size());
155 labelListList& pf = *pointFacesPtr_;
157 forAll (pointFcs, pointI)
159 pf[pointI].setSize(pointFcs[pointI].size());
164 SLList<label>::iterator curFacesIter = pointFcs[pointI].begin();
165 curFacesIter != pointFcs[pointI].end();
169 pf[pointI][i] = curFacesIter();
175 Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::"
176 << "calcPointFaces() finished calculating pointFaces"
182 // ************************************************************************* //