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
27 \*---------------------------------------------------------------------------*/
29 #include "tetPolyMeshFaceDecomp.H"
30 #include "processorPolyPatch.H"
31 #include "demandDrivenData.H"
35 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
37 void Foam::tetPolyMeshFaceDecomp::calcParPointData() const
39 if (!Pstream::parRun())
41 parPointsPtr_ = new labelList(0);
42 parEdgesPtr_ = new edgeList(0);
48 // Make a global point markup list and find out which vertices
49 // belong to more than one patch.
51 // Create a local check list for all vertices
53 labelList multiProcVertices(mesh_.nPoints(), 0);
55 forAll (mesh_.boundaryMesh(), patchI)
59 isA<processorPolyPatch>(mesh_.boundaryMesh()[patchI])
62 const labelList& p = mesh_.boundaryMesh()[patchI].meshPoints();
66 multiProcVertices[p[pointI]]++;
71 SLList<label> parPoints;
73 // Find all vertices that have been addressed more than once
74 forAll (multiProcVertices, pointI)
76 if (multiProcVertices[pointI] > 1)
78 parPoints.append(pointI);
83 parPointsPtr_ = new labelList(parPoints);
85 // At the same time calculate all edges located between two
86 // parallel points. The list will have duplicates, which need
89 SLList<edge> parEdges;
91 forAll (mesh_.boundaryMesh(), patchI)
95 isA<processorPolyPatch>(mesh_.boundaryMesh()[patchI])
98 const labelList& p = mesh_.boundaryMesh()[patchI].meshPoints();
100 const edgeList& e = mesh_.boundaryMesh()[patchI].edges();
106 multiProcVertices[p[e[eI].start()]] > 1
107 && multiProcVertices[p[e[eI].end()]] > 1
110 // Found a possible edge
111 edge newEdge = edge(p[e[eI].start()], p[e[eI].end()]);
113 // Check if the edge is already on the list
118 SLList<edge>::iterator parEIter =
120 parEIter != parEdges.end();
124 if (parEIter() == newEdge)
133 parEdges.append(newEdge);
141 parEdgesPtr_ = new edgeList(parEdges);
146 void Foam::tetPolyMeshFaceDecomp::clearOutParPointData() const
148 deleteDemandDrivenData(parPointsPtr_);
149 deleteDemandDrivenData(parEdgesPtr_);
153 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
155 const labelList& Foam::tetPolyMeshFaceDecomp::parallelPoints() const
162 return *parPointsPtr_;
166 const edgeList& Foam::tetPolyMeshFaceDecomp::parallelEdges() const
173 return *parEdgesPtr_;
177 // ************************************************************************* //