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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "primitiveMesh.H"
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 void Foam::primitiveMesh::calcPointPoints() const
35 Pout<< "primitiveMesh::calcPointPoints() : "
36 << "calculating pointPoints"
41 // For checking calls:abort so we can quickly hunt down
43 FatalErrorIn("primitiveMesh::calcPointPoints()")
48 // It is an error to attempt to recalculate pointPoints
49 // if the pointer is already set
52 FatalErrorIn("primitiveMesh::calcPointPoints() const")
53 << "pointPoints already calculated"
58 const edgeList& e = edges();
59 const labelListList& pe = pointEdges();
61 ppPtr_ = new labelListList(pe.size());
62 labelListList& pp = *ppPtr_;
66 pp[pointI].setSize(pe[pointI].size());
68 forAll (pe[pointI], ppi)
70 if (e[pe[pointI][ppi]].start() == pointI)
72 pp[pointI][ppi] = e[pe[pointI][ppi]].end();
74 else if (e[pe[pointI][ppi]].end() == pointI)
76 pp[pointI][ppi] = e[pe[pointI][ppi]].start();
80 FatalErrorIn("primitiveMesh::calcPointPoints() const")
81 << "something wrong with edges"
90 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
92 const Foam::labelListList& Foam::primitiveMesh::pointPoints() const
103 const Foam::labelList& Foam::primitiveMesh::pointPoints
106 DynamicList<label>& storage
109 if (hasPointPoints())
111 return pointPoints()[pointI];
115 const edgeList& edges = this->edges();
116 const labelList& pEdges = pointEdges()[pointI];
120 if (pEdges.size() > storage.capacity())
122 storage.setCapacity(pEdges.size());
127 storage.append(edges[pEdges[i]].otherVertex(pointI));
135 const Foam::labelList& Foam::primitiveMesh::pointPoints
140 return pointPoints(pointI, labels_);
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 // ************************************************************************* //