1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 \*---------------------------------------------------------------------------*/
27 #include "primitiveMesh.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
36 void primitiveMesh::calcPointEdges() const
38 // Loop through edges and mark up points
42 Pout<< "primitiveMesh::calcPointEdges() : "
43 << "calculating pointEdges"
47 // It is an error to attempt to recalculate pointEdges
48 // if the pointer is already set
51 FatalErrorIn("primitiveMesh::calcPointEdges() const")
52 << "pointEdges already calculated"
57 const edgeList& e = edges();
59 // Count edges per point
61 labelList npe(nPoints(), 0);
65 npe[e[edgeI].start()]++;
66 npe[e[edgeI].end()]++;
70 // Size and fill edges per point
72 pePtr_ = new labelListList(npe.size());
73 labelListList& pointEdgeAddr = *pePtr_;
75 forAll (pointEdgeAddr, pointI)
77 pointEdgeAddr[pointI].setSize(npe[pointI]);
83 label v0 = e[edgeI].start();
85 pointEdgeAddr[v0][npe[v0]++] = edgeI;
87 label v1 = e[edgeI].end();
89 pointEdgeAddr[v1][npe[v1]++] = edgeI;
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 const labelListList& primitiveMesh::pointEdges() const
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 } // End namespace Foam
112 // ************************************************************************* //