extendedCellToFaceStencil.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29#include "globalIndex.H"
30#include "syncTools.H"
31
32/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
33
34namespace Foam
35{
37}
38
39
40// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
41
43(
44 Ostream& os,
45 const labelListList& stencil,
46 const mapDistribute& map
47)
48{
49 label sumSize = 0;
50 label nSum = 0;
51 label minSize = labelMax;
52 label maxSize = labelMin;
53
54 forAll(stencil, i)
55 {
56 const labelList& sCells = stencil[i];
57
58 if (sCells.size() > 0)
59 {
60 sumSize += sCells.size();
61 nSum++;
62 minSize = min(minSize, sCells.size());
63 maxSize = max(maxSize, sCells.size());
64 }
65 }
66 reduce(sumSize, sumOp<label>());
67 reduce(nSum, sumOp<label>());
68
69 reduce(minSize, minOp<label>());
70 reduce(maxSize, maxOp<label>());
71
72 os << "Stencil size :" << nl
73 << " average : " << scalar(sumSize)/nSum << nl
74 << " min : " << minSize << nl
75 << " max : " << maxSize << nl
76 << endl;
77
78 // Sum all sent data
79 label nSent = 0;
80 label nLocal = 0;
81 forAll(map.subMap(), proci)
82 {
83 if (proci != Pstream::myProcNo())
84 {
85 nSent += map.subMap()[proci].size();
86 }
87 else
88 {
89 nLocal += map.subMap()[proci].size();
90 }
91 }
92
93 os << "Local data size : " << returnReduce(nLocal, sumOp<label>()) << nl
94 << "Sent data size : " << returnReduce(nSent, sumOp<label>()) << nl
95 << endl;
96}
97
98
99// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
100
102:
103 mesh_(mesh)
104{
105 // Check for transformation - not supported.
107
108 forAll(patches, patchi)
109 {
110 if (patches[patchi].coupled())
111 {
112 const coupledPolyPatch& cpp =
113 refCast<const coupledPolyPatch>(patches[patchi]);
114
115 if (!cpp.parallel() || cpp.separated())
116 {
118 << "Coupled patches with transformations not supported."
119 << endl
120 << "Problematic patch " << cpp.name() << exit(FatalError);
121 }
122 }
123 }
124}
125
126
127// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual bool separated() const
Are the planes separated.
virtual bool parallel() const
Are the cyclic planes parallel.
Calculates/constains the extended cell-to-face stencil.
static void writeStencilStats(Ostream &os, const labelListList &stencil, const mapDistribute &map)
Write some statistics about stencil.
const labelListList & subMap() const noexcept
From subsetted data back to original data.
Class containing processor-to-processor mapping information.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:456
int myProcNo() const noexcept
Return processor number.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
const polyBoundaryMesh & patches
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
constexpr label labelMin
Definition: label.H:60
constexpr label labelMax
Definition: label.H:61
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
error FatalError
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333