1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
32 \*----------------------------------------------------------------------------*/
34 #include "faGlobalMeshData.H"
36 #include "globalMeshData.H"
37 #include "PstreamCombineReduceOps.H"
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 Foam::faGlobalMeshData::faGlobalMeshData(const faMesh& mesh)
43 faProcessorTopology(mesh.boundary()),
46 sharedPointLabels_(0),
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
55 Foam::faGlobalMeshData::~faGlobalMeshData()
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 const Foam::faMesh& Foam::faGlobalMeshData::mesh() const
67 // Update all data after morph
68 void Foam::faGlobalMeshData::updateMesh()
70 label polyMeshNGlobalPoints =
71 mesh_().globalData().nGlobalPoints();
73 const labelList& polyMeshSharedPointLabels =
74 mesh_().globalData().sharedPointLabels();
76 const labelList& polyMeshSharedPointAddr =
77 mesh_().globalData().sharedPointAddr();
79 labelHashSet sharedPointLabels;
81 labelField globalList(polyMeshNGlobalPoints, 0);
83 forAll(mesh_.boundary(), patchI)
85 if(mesh_.boundary()[patchI].type() == processorFaPatch::typeName)
87 const labelList& localPointLabels =
88 mesh_.boundary()[patchI].pointLabels();
90 forAll(localPointLabels, pointI)
93 mesh_.patch().meshPoints()[localPointLabels[pointI]];
95 label sharedPolyMeshPoint =
96 findIndex(polyMeshSharedPointLabels, polyMeshPoint);
100 sharedPolyMeshPoint != -1
101 && !sharedPointLabels.found(localPointLabels[pointI])
104 globalList[polyMeshSharedPointAddr[sharedPolyMeshPoint]]
107 sharedPointLabels.insert(localPointLabels[pointI]);
113 sharedPointLabels_ = sharedPointLabels.toc();
115 combineReduce(globalList, plusEqOp<labelField >());
118 for (label i=0; i<globalList.size(); i++)
120 if(globalList[i] > 0)
122 globalList[i] = ++nGlobalPoints_;
126 sharedPointAddr_.setSize(sharedPointLabels_.size());
127 forAll(sharedPointAddr_, pointI)
129 label polyMeshSharedPointIndex = findIndex
131 polyMeshSharedPointLabels,
132 mesh_.patch().meshPoints()[sharedPointLabels_[pointI]]
135 sharedPointAddr_[pointI] =
136 globalList[polyMeshSharedPointAddr[polyMeshSharedPointIndex]]
141 // ************************************************************************* //