Loading...
Searching...
No Matches
pointBoundaryMesh.H
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-2013 OpenFOAM Foundation
9 Copyright (C) 2018-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::pointBoundaryMesh
29
30Description
31 A pointBoundaryMesh is a pointPatch list with registered IO,
32 a reference to the associated pointMesh,
33 with additional search methods etc.
34
35SourceFiles
36 pointBoundaryMesh.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef Foam_pointBoundaryMesh_H
41#define Foam_pointBoundaryMesh_H
42
43#include "pointPatch.H"
44#include "regIOobject.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52class pointMesh;
54class wordRes;
56/*---------------------------------------------------------------------------*\
57 Class pointBoundaryMesh Declaration
58\*---------------------------------------------------------------------------*/
59
60class pointBoundaryMesh
61:
62 public pointPatchList,
63 public regIOobject
64{
65 // Private Data
66
67 //- Reference to mesh
68 const pointMesh& mesh_;
69
70 //- Demand-driven: list of patch ids per group
71 mutable autoPtr<HashTable<labelList>> groupIDsPtr_;
72
73
74 // Private Member Functions
75
76 //- Calculate geometry for the patches (transformation tensors etc.)
77 void calcGeometry();
78
79 //- Some patches have inGroup entries
80 bool hasGroupIDs() const;
81
82 //- Calculate group name to patch ids lookup
83 void calcGroupIDs() const;
84
85 //- Assign facePointPatches corresponding to the given polyBoundaryMesh
86 void addPatches(const polyBoundaryMesh& pbm);
87
88 //- No copy construct
89 pointBoundaryMesh(const pointBoundaryMesh&) = delete;
90
91 //- No copy assignment
92 void operator=(const pointBoundaryMesh&) = delete;
93
94
95public:
96
97 //- Declare friendship with pointMesh
98 friend class pointMesh;
99
100
101 //- Runtime type information
102 TypeName("pointBoundaryMesh");
103
104
105 // Constructors
106
107 //- Construct from pointMesh and polyBoundaryMesh
108 pointBoundaryMesh(const pointMesh&, const polyBoundaryMesh&);
109
110 //- Construct from IOobject, pointMesh and polyBoundaryMesh
111 pointBoundaryMesh
112 (
113 const IOobject& io,
114 const pointMesh&,
115 const polyBoundaryMesh&
116 );
118
119 //- Destructor
120 virtual ~pointBoundaryMesh() = default;
121
122
123 // Member Functions
124
125 //- Return the mesh reference
126 const pointMesh& mesh() const noexcept
127 {
128 return mesh_;
129 }
130
131 //- The number of patches before the first processor patch.
132 label nNonProcessor() const;
133
134 //- The number of processorPointPatch patches
135 label nProcessorPatches() const;
136
137 //- Return a list of patch names
138 wordList names() const;
139
140 //- Return a list of patch types
142
143 //- Return a list of physical types
144 wordList physicalTypes() const;
145
146 //- The (sorted) patch indices for all matches,
147 //- optionally matching patch groups.
148 // \returns an empty list for an empty matcher
149 labelList indices(const wordRe& matcher, const bool useGroups) const;
150
151 //- The (sorted) patch indices for all matches,
152 //- optionally matching patch groups.
153 // \returns an empty list for an empty matcher
154 labelList indices(const wordRes& matcher, const bool useGroups) const;
155
156 //- The (sorted) patch indices: logic as per Foam::wordRes::filter,
157 //- optionally matching patch groups.
158 //
159 // An empty \em allow accepts everything not in \em deny.
160 // A literal \em allow match has higher priority than any \em deny.
161 // A regex \em allow match has lower priority than any \em deny.
162 //
163 // \returns identity list when allow/deny are both empty.
165 (
166 const wordRes& allow,
167 const wordRes& deny,
168 const bool useGroups
169 ) const;
170
171 //- Find patch index given a name
172 // A no-op (returns -1) for an empty patchName
173 label findPatchID
174 (
175 const word& patchName,
176 const bool allowNotFound = true
177 ) const;
178
179 //- Find patch by name and return const pointer.
180 //- \returns nullptr if not found or for an empty patchName
181 const pointPatch* cfindPatch(const word& patchName) const;
182
183 //- The patch indices per patch group
184 const HashTable<labelList>& groupPatchIDs() const;
185
186 //- Correct pointBoundaryMesh after moving points
187 void movePoints(const pointField&);
188
189 //- Correct pointBoundaryMesh after topology update
190 void updateMesh();
191
192 //- Reorders patches. Ordering does not have to be done in
193 // ascending or descending order. Reordering has to be unique.
194 // (is shuffle) If validBoundary calls updateMesh()
195 // after reordering to recalculate data (so call needs to be parallel
196 // sync in that case)
197 void reorder(const labelUList& oldToNew, const bool validBoundary);
198
199 //- writeData member function required by regIOobject
200 virtual bool writeData(Ostream&) const;
201
202
203 // Housekeeping
204
205 //- Identical to the indices() method (AUG-2018)
206 FOAM_DEPRECATED_FOR(2018-08, "indices() method")
207 labelList findIndices(const wordRe& key, bool useGroups) const
208 {
209 return indices(key, useGroups);
210 }
211};
212
213
214// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215
216} // End namespace Foam
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220#endif
221
222// ************************************************************************* //
const polyBoundaryMesh & pbm
A HashTable similar to std::unordered_map.
Definition HashTable.H:124
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
label nNonProcessor() const
The number of patches before the first processor patch.
wordList physicalTypes() const
Return a list of physical types.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
virtual bool writeData(Ostream &) const
writeData member function required by regIOobject
const pointMesh & mesh() const noexcept
Return the mesh reference.
virtual ~pointBoundaryMesh()=default
Destructor.
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
wordList types() const
Return a list of patch types.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name.
labelList indices(const wordRe &matcher, const bool useGroups) const
The (sorted) patch indices for all matches, optionally matching patch groups.
void movePoints(const pointField &)
Correct pointBoundaryMesh after moving points.
TypeName("pointBoundaryMesh")
Runtime type information.
friend class pointMesh
Declare friendship with pointMesh.
labelList findIndices(const wordRe &key, bool useGroups) const
Identical to the indices() method (AUG-2018).
wordList names() const
Return a list of patch names.
void updateMesh()
Correct pointBoundaryMesh after topology update.
label nProcessorPatches() const
The number of processorPointPatch patches.
const pointPatch * cfindPatch(const word &patchName) const
Find patch by name and return const pointer.
Mesh representing a set of points created from polyMesh.
Definition pointMesh.H:49
Basic pointPatch represents a set of points from the mesh.
Definition pointPatch.H:67
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition wordRe.H:81
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
const auto & io
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
PtrList< pointPatch > pointPatchList
Store lists of pointPatch as a PtrList.
Definition pointPatch.H:58
const direction noexcept
Definition scalarImpl.H:265
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define FOAM_DEPRECATED_FOR(since, replacement)
Definition stdFoam.H:43
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68