1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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"
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 void Foam::primitiveMesh::calcCellCells() const
33 // Loop through faceCells and mark up neighbours
37 Pout<< "primitiveMesh::calcCellCells() : calculating cellCells"
42 // For checking calls:abort so we can quickly hunt down
44 FatalErrorIn("primitiveMesh::calcCellCells()")
49 // It is an error to attempt to recalculate cellCells
50 // if the pointer is already set
53 FatalErrorIn("primitiveMesh::calcCellCells() const")
54 << "cellCells already calculated"
59 // 1. Count number of internal faces per cell
61 labelList ncc(nCells(), 0);
63 const labelList& own = faceOwner();
64 const labelList& nei = faceNeighbour();
73 ccPtr_ = new labelListList(ncc.size());
74 labelListList& cellCellAddr = *ccPtr_;
78 // 2. Size and fill cellFaceAddr
80 forAll(cellCellAddr, cellI)
82 cellCellAddr[cellI].setSize(ncc[cellI]);
88 label ownCellI = own[faceI];
89 label neiCellI = nei[faceI];
91 cellCellAddr[ownCellI][ncc[ownCellI]++] = neiCellI;
92 cellCellAddr[neiCellI][ncc[neiCellI]++] = ownCellI;
98 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 const Foam::labelListList& Foam::primitiveMesh::cellCells() const
111 const Foam::labelList& Foam::primitiveMesh::cellCells
114 DynamicList<label>& storage
119 return cellCells()[cellI];
123 const labelList& own = faceOwner();
124 const labelList& nei = faceNeighbour();
125 const cell& cFaces = cells()[cellI];
131 label faceI = cFaces[i];
133 if (faceI < nInternalFaces())
135 if (own[faceI] == cellI)
137 storage.append(nei[faceI]);
141 storage.append(own[faceI]);
151 const Foam::labelList& Foam::primitiveMesh::cellCells(const label cellI) const
153 return cellCells(cellI, labels_);
157 // ************************************************************************* //