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"
27 #include "DynamicList.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::primitiveMesh::calcCellEdges() const
34 // Loop through all faces and mark up cells with edges of the face.
35 // Check for duplicates
39 Pout<< "primitiveMesh::calcCellEdges() : "
40 << "calculating cellEdges"
45 // For checking calls:abort so we can quickly hunt down
47 FatalErrorIn("primitiveMesh::calcCellEdges()")
52 // It is an error to attempt to recalculate cellEdges
53 // if the pointer is already set
56 FatalErrorIn("primitiveMesh::calcCellEdges() const")
57 << "cellEdges already calculated"
62 // Set up temporary storage
63 List<DynamicList<label, edgesPerCell_> > ce(nCells());
66 // Get reference to faceCells and faceEdges
67 const labelList& own = faceOwner();
68 const labelList& nei = faceNeighbour();
69 const labelListList& fe = faceEdges();
71 // loop through the list again and add edges; checking for duplicates
74 DynamicList<label, edgesPerCell_>& curCellEdges = ce[own[faceI]];
76 const labelList& curEdges = fe[faceI];
78 forAll(curEdges, edgeI)
80 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
83 curCellEdges.append(curEdges[edgeI]);
90 DynamicList<label, edgesPerCell_>& curCellEdges = ce[nei[faceI]];
92 const labelList& curEdges = fe[faceI];
94 forAll(curEdges, edgeI)
96 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
99 curCellEdges.append(curEdges[edgeI]);
104 cePtr_ = new labelListList(ce.size());
105 labelListList& cellEdgeAddr = *cePtr_;
110 cellEdgeAddr[cellI].transfer(ce[cellI]);
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 const Foam::labelListList& Foam::primitiveMesh::cellEdges() const
129 // ************************************************************************* //