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"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 void Foam::primitiveMesh::calcCellCells() const
34 // Loop through faceCells and mark up neighbours
38 Pout<< "primitiveMesh::calcCellCells() : calculating cellCells"
43 // For checking calls:abort so we can quickly hunt down
45 FatalErrorIn("primitiveMesh::calcCellCells()")
50 // It is an error to attempt to recalculate cellCells
51 // if the pointer is already set
54 FatalErrorIn("primitiveMesh::calcCellCells() const")
55 << "cellCells already calculated"
60 // 1. Count number of internal faces per cell
62 labelList ncc(nCells(), 0);
64 const labelList& own = faceOwner();
65 const labelList& nei = faceNeighbour();
74 ccPtr_ = new labelListList(ncc.size());
75 labelListList& cellCellAddr = *ccPtr_;
79 // 2. Size and fill cellFaceAddr
81 forAll (cellCellAddr, cellI)
83 cellCellAddr[cellI].setSize(ncc[cellI]);
89 label ownCellI = own[faceI];
90 label neiCellI = nei[faceI];
92 cellCellAddr[ownCellI][ncc[ownCellI]++] = neiCellI;
93 cellCellAddr[neiCellI][ncc[neiCellI]++] = ownCellI;
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 const Foam::labelListList& Foam::primitiveMesh::cellCells() const
112 const Foam::labelList& Foam::primitiveMesh::cellCells
115 DynamicList<label>& storage
120 return cellCells()[cellI];
124 const labelList& own = faceOwner();
125 const labelList& nei = faceNeighbour();
126 const cell& cFaces = cells()[cellI];
132 label faceI = cFaces[i];
134 if (faceI < nInternalFaces())
136 if (own[faceI] == cellI)
138 storage.append(nei[faceI]);
142 storage.append(own[faceI]);
152 const Foam::labelList& Foam::primitiveMesh::cellCells(const label cellI) const
154 return cellCells(cellI, labels_);
158 // ************************************************************************* //