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 "extendedCellToFaceStencil.H"
27 #include "globalIndex.H"
28 #include "syncTools.H"
29 #include "SortableList.H"
31 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
33 defineTypeNameAndDebug(Foam::extendedCellToFaceStencil, 0);
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 void Foam::extendedCellToFaceStencil::writeStencilStats
41 const labelListList& stencil,
42 const mapDistribute& map
47 label minSize = labelMax;
48 label maxSize = labelMin;
52 const labelList& sCells = stencil[i];
54 if (sCells.size() > 0)
56 sumSize += sCells.size();
58 minSize = min(minSize, sCells.size());
59 maxSize = max(maxSize, sCells.size());
62 reduce(sumSize, sumOp<label>());
63 reduce(nSum, sumOp<label>());
65 reduce(minSize, minOp<label>());
66 reduce(maxSize, maxOp<label>());
68 os << "Stencil size :" << nl
69 << " average : " << scalar(sumSize)/nSum << nl
70 << " min : " << minSize << nl
71 << " max : " << maxSize << nl
77 forAll(map.subMap(), procI)
79 if (procI != Pstream::myProcNo())
81 nSent += map.subMap()[procI].size();
85 nLocal += map.subMap()[procI].size();
89 os << "Local data size : " << returnReduce(nLocal, sumOp<label>()) << nl
90 << "Sent data size : " << returnReduce(nSent, sumOp<label>()) << nl
95 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
97 Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)
101 // Check for transformation - not supported.
102 const polyBoundaryMesh& patches = mesh.boundaryMesh();
104 forAll(patches, patchI)
106 if (isA<coupledPolyPatch>(patches[patchI]))
108 const coupledPolyPatch& cpp =
109 refCast<const coupledPolyPatch>(patches[patchI]);
111 if (!cpp.parallel() || cpp.separated())
115 "extendedCellToFaceStencil::extendedCellToFaceStencil"
117 ) << "Coupled patches with transformations not supported."
119 << "Problematic patch " << cpp.name() << exit(FatalError);
126 // ************************************************************************* //