1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 "syncTools.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 // Determines for every point whether it is coupled and if so sets only one.
31 Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
33 PackedBoolList isMasterPoint(mesh.nPoints());
34 PackedBoolList donePoint(mesh.nPoints());
36 const globalMeshData& globalData = mesh.globalData();
37 const labelList& meshPoints = globalData.coupledPatch().meshPoints();
38 const labelListList& slaves = globalData.globalPointSlaves();
39 const labelListList& transformedSlaves =
40 globalData.globalPointTransformedSlaves();
42 forAll(meshPoints, coupledPointI)
44 label meshPointI = meshPoints[coupledPointI];
48 slaves[coupledPointI].size()
49 + transformedSlaves[coupledPointI].size()
54 isMasterPoint[meshPointI] = true;
56 donePoint[meshPointI] = true;
60 // Do all other points
61 // ~~~~~~~~~~~~~~~~~~~
63 forAll(donePoint, pointI)
65 if (!donePoint[pointI])
67 isMasterPoint[pointI] = true;
75 // Determines for every edge whether it is coupled and if so sets only one.
76 Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
78 PackedBoolList isMasterEdge(mesh.nEdges());
79 PackedBoolList doneEdge(mesh.nEdges());
81 const globalMeshData& globalData = mesh.globalData();
82 const labelList& meshEdges = globalData.coupledPatchMeshEdges();
83 const labelListList& slaves = globalData.globalEdgeSlaves();
84 const labelListList& transformedSlaves =
85 globalData.globalEdgeTransformedSlaves();
87 forAll(meshEdges, coupledEdgeI)
89 label meshEdgeI = meshEdges[coupledEdgeI];
93 slaves[coupledEdgeI].size()
94 + transformedSlaves[coupledEdgeI].size()
99 isMasterEdge[meshEdgeI] = true;
101 doneEdge[meshEdgeI] = true;
105 // Do all other edges
106 // ~~~~~~~~~~~~~~~~~~
108 forAll(doneEdge, edgeI)
110 if (!doneEdge[edgeI])
112 isMasterEdge[edgeI] = true;
120 // Determines for every face whether it is coupled and if so sets only one.
121 Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh)
123 PackedBoolList isMasterFace(mesh.nFaces(), 1);
125 const polyBoundaryMesh& patches = mesh.boundaryMesh();
127 forAll(patches, patchI)
129 if (patches[patchI].coupled())
131 const coupledPolyPatch& pp =
132 refCast<const coupledPolyPatch>(patches[patchI]);
138 isMasterFace.unset(pp.start()+i);
148 // ************************************************************************* //