pointBoundaryMesh.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-2017 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "pointBoundaryMesh.H"
30 #include "polyBoundaryMesh.H"
31 #include "facePointPatch.H"
32 #include "pointMesh.H"
33 #include "PstreamBuffers.H"
34 #include "lduSchedule.H"
35 #include "globalMeshData.H"
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
39 Foam::pointBoundaryMesh::pointBoundaryMesh
40 (
41  const pointMesh& m,
42  const polyBoundaryMesh& basicBdry
43 )
44 :
45  pointPatchList(basicBdry.size()),
46  mesh_(m)
47 {
48  // Set boundary patches
49  pointPatchList& Patches = *this;
50 
51  forAll(Patches, patchi)
52  {
53  Patches.set
54  (
55  patchi,
56  facePointPatch::New(basicBdry[patchi], *this).ptr()
57  );
58  }
59 }
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
65 (
66  const keyType& key,
67  const bool useGroups
68 ) const
69 {
70  return mesh()().boundaryMesh().indices(key, useGroups);
71 }
72 
73 
74 Foam::label Foam::pointBoundaryMesh::findPatchID(const word& patchName) const
75 {
76  return mesh()().boundaryMesh().findPatchID(patchName);
77 }
78 
79 
80 void Foam::pointBoundaryMesh::calcGeometry()
81 {
83 
84  if
85  (
88  )
89  {
90  forAll(*this, patchi)
91  {
92  operator[](patchi).initGeometry(pBufs);
93  }
94 
95  pBufs.finishedSends();
96 
97  forAll(*this, patchi)
98  {
99  operator[](patchi).calcGeometry(pBufs);
100  }
101  }
103  {
104  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
105 
106  // Dummy.
107  pBufs.finishedSends();
108 
109  forAll(patchSchedule, patchEvali)
110  {
111  label patchi = patchSchedule[patchEvali].patch;
112 
113  if (patchSchedule[patchEvali].init)
114  {
115  operator[](patchi).initGeometry(pBufs);
116  }
117  else
118  {
119  operator[](patchi).calcGeometry(pBufs);
120  }
121  }
122  }
123 }
124 
125 
127 {
129 
130  if
131  (
134  )
135  {
136  forAll(*this, patchi)
137  {
138  operator[](patchi).initMovePoints(pBufs, p);
139  }
140 
141  pBufs.finishedSends();
142 
143  forAll(*this, patchi)
144  {
145  operator[](patchi).movePoints(pBufs, p);
146  }
147  }
149  {
150  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
151 
152  // Dummy.
153  pBufs.finishedSends();
154 
155  forAll(patchSchedule, patchEvali)
156  {
157  label patchi = patchSchedule[patchEvali].patch;
158 
159  if (patchSchedule[patchEvali].init)
160  {
161  operator[](patchi).initMovePoints(pBufs, p);
162  }
163  else
164  {
165  operator[](patchi).movePoints(pBufs, p);
166  }
167  }
168  }
169 }
170 
171 
173 {
175 
176  if
177  (
180  )
181  {
182  forAll(*this, patchi)
183  {
184  operator[](patchi).initUpdateMesh(pBufs);
185  }
186 
187  pBufs.finishedSends();
188 
189  forAll(*this, patchi)
190  {
191  operator[](patchi).updateMesh(pBufs);
192  }
193  }
195  {
196  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
197 
198  // Dummy.
199  pBufs.finishedSends();
200 
201  forAll(patchSchedule, patchEvali)
202  {
203  label patchi = patchSchedule[patchEvali].patch;
204 
205  if (patchSchedule[patchEvali].init)
206  {
207  operator[](patchi).initUpdateMesh(pBufs);
208  }
209  else
210  {
211  operator[](patchi).updateMesh(pBufs);
212  }
213  }
214  }
215 }
216 
217 
218 // ************************************************************************* //
Foam::UPstream::commsTypes::blocking
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::UPstream::commsTypes::nonBlocking
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::lduSchedule
List< lduScheduleEntry > lduSchedule
Definition: lduSchedule.H:76
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
globalMeshData.H
Foam::pointBoundaryMesh::movePoints
void movePoints(const pointField &)
Correct polyBoundaryMesh after moving points.
Definition: pointBoundaryMesh.C:126
Foam::pointPatchList
PtrList< pointPatch > pointPatchList
container classes for pointPatch
Definition: pointPatchList.H:47
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:87
Foam::pointBoundaryMesh::findPatchID
label findPatchID(const word &patchName) const
Find patch index given a name.
Definition: pointBoundaryMesh.C:74
Foam::PtrList::set
const T * set(const label i) const
Return const pointer to element (can be nullptr),.
Definition: PtrList.H:138
Foam::UPstream::defaultCommsType
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:283
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
pointBoundaryMesh.H
Foam::pointBoundaryMesh::updateMesh
void updateMesh()
Correct polyBoundaryMesh after topology update.
Definition: pointBoundaryMesh.C:172
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:60
Foam::Field< vector >
init
mesh init(true)
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::pointBoundaryMesh::mesh
const pointMesh & mesh() const
Return the mesh reference.
Definition: pointBoundaryMesh.H:96
lduSchedule.H
Foam::PstreamBuffers::finishedSends
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
Definition: PstreamBuffers.C:80
Foam::UPstream::commsTypes::scheduled
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::ProcessorTopology::patchSchedule
const lduSchedule & patchSchedule() const
Order in which the patches should be initialised/evaluated.
Definition: ProcessorTopology.H:101
Foam::pointMesh
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:50
Foam::pointBoundaryMesh::indices
labelList indices(const keyType &key, const bool useGroups) const
Find patch indices given a name.
Definition: pointBoundaryMesh.C:65
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
facePointPatch.H
Foam::List< label >
PstreamBuffers.H
polyBoundaryMesh.H
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:62
Foam::polyMesh::globalData
const globalMeshData & globalData() const
Return parallel info.
Definition: polyMesh.C:1295
pointMesh.H