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"
28 #include "DynamicList.H"
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 void Foam::primitiveMesh::calcCellEdges() const
35 // Loop through all faces and mark up cells with edges of the face.
36 // Check for duplicates
40 Pout<< "primitiveMesh::calcCellEdges() : "
41 << "calculating cellEdges"
46 // For checking calls:abort so we can quickly hunt down
48 FatalErrorIn("primitiveMesh::calcCellEdges()")
53 // It is an error to attempt to recalculate cellEdges
54 // if the pointer is already set
57 FatalErrorIn("primitiveMesh::calcCellEdges() const")
58 << "cellEdges already calculated"
63 // Set up temporary storage
64 List<DynamicList<label, edgesPerCell_> > ce(nCells());
67 // Get reference to faceCells and faceEdges
68 const labelList& own = faceOwner();
69 const labelList& nei = faceNeighbour();
70 const labelListList& fe = faceEdges();
72 // loop through the list again and add edges; checking for duplicates
75 DynamicList<label, edgesPerCell_>& curCellEdges = ce[own[faceI]];
77 const labelList& curEdges = fe[faceI];
79 forAll (curEdges, edgeI)
81 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
84 curCellEdges.append(curEdges[edgeI]);
91 DynamicList<label, edgesPerCell_>& curCellEdges = ce[nei[faceI]];
93 const labelList& curEdges = fe[faceI];
95 forAll (curEdges, edgeI)
97 if (findIndex(curCellEdges, curEdges[edgeI]) == -1)
100 curCellEdges.append(curEdges[edgeI]);
105 cePtr_ = new labelListList(ce.size());
106 labelListList& cellEdgeAddr = *cePtr_;
111 cellEdgeAddr[cellI].transfer(ce[cellI]);
117 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 const Foam::labelListList& Foam::primitiveMesh::cellEdges() const
130 // ************************************************************************* //