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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "primitiveMesh.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 void Foam::primitiveMesh::calcPointPoints() const
34 Pout<< "primitiveMesh::calcPointPoints() : "
35 << "calculating pointPoints"
40 // For checking calls:abort so we can quickly hunt down
42 FatalErrorIn("primitiveMesh::calcPointPoints()")
47 // It is an error to attempt to recalculate pointPoints
48 // if the pointer is already set
51 FatalErrorIn("primitiveMesh::calcPointPoints() const")
52 << "pointPoints already calculated"
57 const edgeList& e = edges();
58 const labelListList& pe = pointEdges();
60 ppPtr_ = new labelListList(pe.size());
61 labelListList& pp = *ppPtr_;
65 pp[pointI].setSize(pe[pointI].size());
67 forAll(pe[pointI], ppi)
69 if (e[pe[pointI][ppi]].start() == pointI)
71 pp[pointI][ppi] = e[pe[pointI][ppi]].end();
73 else if (e[pe[pointI][ppi]].end() == pointI)
75 pp[pointI][ppi] = e[pe[pointI][ppi]].start();
79 FatalErrorIn("primitiveMesh::calcPointPoints() const")
80 << "something wrong with edges"
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
91 const Foam::labelListList& Foam::primitiveMesh::pointPoints() const
102 const Foam::labelList& Foam::primitiveMesh::pointPoints
105 DynamicList<label>& storage
108 if (hasPointPoints())
110 return pointPoints()[pointI];
114 const edgeList& edges = this->edges();
115 const labelList& pEdges = pointEdges()[pointI];
119 if (pEdges.size() > storage.capacity())
121 storage.setCapacity(pEdges.size());
126 storage.append(edges[pEdges[i]].otherVertex(pointI));
134 const Foam::labelList& Foam::primitiveMesh::pointPoints
139 return pointPoints(pointI, labels_);
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 // ************************************************************************* //