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-2021 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 wordRe& matcher,
67  const bool useGroups
68 ) const
69 {
70  return mesh()().boundaryMesh().indices(matcher, useGroups);
71 }
72 
73 
75 (
76  const wordRes& matcher,
77  const bool useGroups
78 ) const
79 {
80  return mesh()().boundaryMesh().indices(matcher, useGroups);
81 }
82 
83 
84 Foam::label Foam::pointBoundaryMesh::findPatchID(const word& patchName) const
85 {
86  return mesh()().boundaryMesh().findPatchID(patchName);
87 }
88 
89 
90 void Foam::pointBoundaryMesh::calcGeometry()
91 {
93 
94  if
95  (
98  )
99  {
100  forAll(*this, patchi)
101  {
102  operator[](patchi).initGeometry(pBufs);
103  }
104 
105  pBufs.finishedSends();
106 
107  forAll(*this, patchi)
108  {
109  operator[](patchi).calcGeometry(pBufs);
110  }
111  }
113  {
114  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
115 
116  // Dummy.
117  pBufs.finishedSends();
118 
119  forAll(patchSchedule, patchEvali)
120  {
121  label patchi = patchSchedule[patchEvali].patch;
122 
123  if (patchSchedule[patchEvali].init)
124  {
125  operator[](patchi).initGeometry(pBufs);
126  }
127  else
128  {
129  operator[](patchi).calcGeometry(pBufs);
130  }
131  }
132  }
133 }
134 
135 
137 {
139 
140  if
141  (
144  )
145  {
146  forAll(*this, patchi)
147  {
148  operator[](patchi).initMovePoints(pBufs, p);
149  }
150 
151  pBufs.finishedSends();
152 
153  forAll(*this, patchi)
154  {
155  operator[](patchi).movePoints(pBufs, p);
156  }
157  }
159  {
160  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
161 
162  // Dummy.
163  pBufs.finishedSends();
164 
165  forAll(patchSchedule, patchEvali)
166  {
167  label patchi = patchSchedule[patchEvali].patch;
168 
169  if (patchSchedule[patchEvali].init)
170  {
171  operator[](patchi).initMovePoints(pBufs, p);
172  }
173  else
174  {
175  operator[](patchi).movePoints(pBufs, p);
176  }
177  }
178  }
179 }
180 
181 
183 {
185 
186  if
187  (
190  )
191  {
192  forAll(*this, patchi)
193  {
194  operator[](patchi).initUpdateMesh(pBufs);
195  }
196 
197  pBufs.finishedSends();
198 
199  forAll(*this, patchi)
200  {
201  operator[](patchi).updateMesh(pBufs);
202  }
203  }
205  {
206  const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
207 
208  // Dummy.
209  pBufs.finishedSends();
210 
211  forAll(patchSchedule, patchEvali)
212  {
213  label patchi = patchSchedule[patchEvali].patch;
214 
215  if (patchSchedule[patchEvali].init)
216  {
217  operator[](patchi).initUpdateMesh(pBufs);
218  }
219  else
220  {
221  operator[](patchi).updateMesh(pBufs);
222  }
223  }
224  }
225 }
226 
227 
228 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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:63
globalMeshData.H
Foam::pointBoundaryMesh::movePoints
void movePoints(const pointField &)
Correct polyBoundaryMesh after moving points.
Definition: pointBoundaryMesh.C:136
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:88
Foam::pointBoundaryMesh::findPatchID
label findPatchID(const word &patchName) const
Find patch index given a name.
Definition: pointBoundaryMesh.C:84
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:281
Foam::pointBoundaryMesh::mesh
const pointMesh & mesh() const noexcept
Return the mesh reference.
Definition: pointBoundaryMesh.H:97
Foam::wordRe
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:80
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:182
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:59
lduSchedule.H
Foam::PstreamBuffers::finishedSends
void finishedSends(const bool block=true)
Mark all sends as having been done.
Definition: PstreamBuffers.C:73
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::pointBoundaryMesh::indices
labelList indices(const wordRe &matcher, const bool useGroups) const
Return (sorted) patch indices for all matches.
Definition: pointBoundaryMesh.C:65
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:51
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
Foam::UPstream::commsTypes::nonBlocking
Foam::UPstream::commsTypes::scheduled
facePointPatch.H
Foam::List< label >
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
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
Foam::UPstream::commsTypes::blocking