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 "pointBoundaryMesh.H"
27 #include "polyBoundaryMesh.H"
28 #include "facePointPatch.H"
29 #include "pointMesh.H"
30 #include "PstreamBuffers.H"
31 #include "lduSchedule.H"
32 #include "globalMeshData.H"
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 Foam::pointBoundaryMesh::pointBoundaryMesh
39 const polyBoundaryMesh& basicBdry
42 pointPatchList(basicBdry.size()),
45 // Set boundary patches
46 pointPatchList& Patches = *this;
48 forAll(Patches, patchI)
53 facePointPatch::New(basicBdry[patchI], *this).ptr()
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 void Foam::pointBoundaryMesh::calcGeometry()
63 PstreamBuffers pBufs(Pstream::defaultCommsType);
67 Pstream::defaultCommsType == Pstream::blocking
68 || Pstream::defaultCommsType == Pstream::nonBlocking
73 operator[](patchi).initGeometry(pBufs);
76 pBufs.finishedSends();
80 operator[](patchi).calcGeometry(pBufs);
83 else if (Pstream::defaultCommsType == Pstream::scheduled)
85 const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
88 pBufs.finishedSends();
90 forAll(patchSchedule, patchEvali)
92 label patchi = patchSchedule[patchEvali].patch;
94 if (patchSchedule[patchEvali].init)
96 operator[](patchi).initGeometry(pBufs);
100 operator[](patchi).calcGeometry(pBufs);
107 void Foam::pointBoundaryMesh::movePoints(const pointField& p)
109 PstreamBuffers pBufs(Pstream::defaultCommsType);
113 Pstream::defaultCommsType == Pstream::blocking
114 || Pstream::defaultCommsType == Pstream::nonBlocking
117 forAll(*this, patchi)
119 operator[](patchi).initMovePoints(pBufs, p);
122 pBufs.finishedSends();
124 forAll(*this, patchi)
126 operator[](patchi).movePoints(pBufs, p);
129 else if (Pstream::defaultCommsType == Pstream::scheduled)
131 const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
134 pBufs.finishedSends();
136 forAll(patchSchedule, patchEvali)
138 label patchi = patchSchedule[patchEvali].patch;
140 if (patchSchedule[patchEvali].init)
142 operator[](patchi).initMovePoints(pBufs, p);
146 operator[](patchi).movePoints(pBufs, p);
153 void Foam::pointBoundaryMesh::updateMesh()
155 PstreamBuffers pBufs(Pstream::defaultCommsType);
159 Pstream::defaultCommsType == Pstream::blocking
160 || Pstream::defaultCommsType == Pstream::nonBlocking
163 forAll(*this, patchi)
165 operator[](patchi).initUpdateMesh(pBufs);
168 pBufs.finishedSends();
170 forAll(*this, patchi)
172 operator[](patchi).updateMesh(pBufs);
175 else if (Pstream::defaultCommsType == Pstream::scheduled)
177 const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
180 pBufs.finishedSends();
182 forAll(patchSchedule, patchEvali)
184 label patchi = patchSchedule[patchEvali].patch;
186 if (patchSchedule[patchEvali].init)
188 operator[](patchi).initUpdateMesh(pBufs);
192 operator[](patchi).updateMesh(pBufs);
199 // ************************************************************************* //