1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-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 "CPCCellToCellStencil.H"
27 #include "syncTools.H"
28 #include "dummyTransform.H"
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 // Calculates per point the neighbour data (= pointCells)
33 void Foam::CPCCellToCellStencil::calcPointBoundaryData
35 const boolList& isValidBFace,
36 const labelList& boundaryPoints,
37 Map<labelList>& neiGlobal
40 neiGlobal.resize(2*boundaryPoints.size());
42 labelHashSet pointGlobals;
44 forAll(boundaryPoints, i)
46 label pointI = boundaryPoints[i];
54 mesh().pointFaces()[pointI],
60 syncTools::syncPointMap
65 Foam::dummyTransform() // dummy transformation
70 // Calculates per cell the neighbour data (= cell or boundary in global
71 // numbering). First element is always cell itself!
72 void Foam::CPCCellToCellStencil::calcCellStencil
74 labelListList& globalCellCells
77 // Calculate points on coupled patches
78 labelList boundaryPoints(allCoupledFacesPatch()().meshPoints());
81 // Mark boundary faces to be included in stencil (i.e. not coupled or empty)
82 boolList isValidBFace;
83 validBoundaryFaces(isValidBFace);
86 // Swap pointCells for coupled points
87 Map<labelList> neiGlobal;
95 globalCellCells.setSize(mesh().nCells());
97 // Do coupled points first
99 forAll(boundaryPoints, i)
101 label pointI = boundaryPoints[i];
103 const labelList& pGlobals = neiGlobal[pointI];
105 // Distribute to all pointCells
106 const labelList& pCells = mesh().pointCells(pointI);
110 label cellI = pCells[j];
112 // Insert pGlobals into globalCellCells
115 globalNumbering().toGlobal(cellI),
117 globalCellCells[cellI]
123 // Do remaining points cells
124 labelHashSet pointGlobals;
126 for (label pointI = 0; pointI < mesh().nPoints(); pointI++)
133 mesh().pointFaces()[pointI],
138 const labelList& pCells = mesh().pointCells(pointI);
142 label cellI = pCells[j];
146 globalNumbering().toGlobal(cellI),
148 globalCellCells[cellI]
155 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
157 Foam::CPCCellToCellStencil::CPCCellToCellStencil(const polyMesh& mesh)
159 cellToCellStencil(mesh)
161 // Calculate per cell the (point) connected cells (in global numbering)
162 labelListList globalCellCells;
163 calcCellStencil(*this);
167 // ************************************************************************* //