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-2024 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 Class
28  Foam::pointBoundaryMesh
29 
30 Description
31  Foam::pointBoundaryMesh
32 
33 SourceFiles
34  pointBoundaryMesh.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_pointBoundaryMesh_H
39 #define Foam_pointBoundaryMesh_H
40 
41 #include "pointPatch.H"
42 #include "regIOobject.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class pointMesh;
51 class polyBoundaryMesh;
52 class wordRes;
53 
54 /*---------------------------------------------------------------------------*\
55  Class pointBoundaryMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public pointPatchList,
61  public regIOobject
62 {
63  // Private Data
64 
65  //- Reference to mesh
66  const pointMesh& mesh_;
67 
68  //- Demand-driven: list of patch ids per group
69  mutable autoPtr<HashTable<labelList>> groupIDsPtr_;
70 
71 
72  // Private Member Functions
73 
74  //- Calculate geometry for the patches (transformation tensors etc.)
75  void calcGeometry();
76 
77  //- Some patches have inGroup entries
78  bool hasGroupIDs() const;
79 
80  //- Calculate group name to patch ids lookup
81  void calcGroupIDs() const;
82 
83  //- Assign facePointPatches corresponding to the given polyBoundaryMesh
84  void addPatches(const polyBoundaryMesh& pbm);
85 
86  //- No copy construct
87  pointBoundaryMesh(const pointBoundaryMesh&) = delete;
88 
89  //- No copy assignment
90  void operator=(const pointBoundaryMesh&) = delete;
91 
92 
93 public:
94 
95  //- Declare friendship with pointMesh
96  friend class pointMesh;
97 
98 
99  //- Runtime type information
100  TypeName("pointBoundaryMesh");
101 
102 
103  // Constructors
104 
105  //- Construct from polyBoundaryMesh
107 
108  //- Construct from IOobject and polyBoundaryMesh
110  (
111  const IOobject& io,
112  const pointMesh&,
113  const polyBoundaryMesh&
114  );
115 
116 
117  //- Destructor
118  virtual ~pointBoundaryMesh() = default;
119 
120 
121  // Member Functions
122 
123  //- Return the mesh reference
124  const pointMesh& mesh() const noexcept
125  {
126  return mesh_;
127  }
128 
129  //- The number of patches before the first processor patch.
130  label nNonProcessor() const;
131 
132  //- The number of processorPointPatch patches
133  label nProcessorPatches() const;
134 
135  //- Return a list of patch names
136  wordList names() const;
137 
138  //- Return a list of patch types
139  wordList types() const;
140 
141  //- Return a list of physical types
142  wordList physicalTypes() const;
143 
144  //- Return (sorted) patch indices for all matches.
145  // A no-op (returns empty list) for an empty matcher
146  labelList indices(const wordRe& matcher, const bool useGroups) const;
148  //- Return (sorted) patch indices for all matches.
149  // A no-op (returns empty list) for an empty matcher
150  labelList indices(const wordRes& matcher, const bool useGroups) const;
151 
152  //- Return (sorted) patch indices for all selected matches that
153  //- are not ignored.
154  //- The selection logic as per Foam::wordRes::filter.
155  // Optionally matches patch groups.
156  // A no-op (returns empty list) for an empty select matcher
158  (
159  const wordRes& select,
160  const wordRes& ignore,
161  const bool useGroups
162  ) const;
163 
164  //- Find patch index given a name
165  // A no-op (returns -1) for an empty patchName
166  label findPatchID
167  (
168  const word& patchName,
169  const bool allowNotFound = true
170  ) const;
171 
172  //- The patch indices per patch group
173  const HashTable<labelList>& groupPatchIDs() const;
174 
175  //- Correct pointBoundaryMesh after moving points
176  void movePoints(const pointField&);
177 
178  //- Correct pointBoundaryMesh after topology update
179  void updateMesh();
180 
181  //- Reorders patches. Ordering does not have to be done in
182  // ascending or descending order. Reordering has to be unique.
183  // (is shuffle) If validBoundary calls updateMesh()
184  // after reordering to recalculate data (so call needs to be parallel
185  // sync in that case)
186  void reorder(const labelUList& oldToNew, const bool validBoundary);
187 
188  //- writeData member function required by regIOobject
189  virtual bool writeData(Ostream&) const;
190 
191 
192  // Housekeeping
193 
194  //- Identical to the indices() method (AUG-2018)
195  FOAM_DEPRECATED_FOR(2018-08, "indices() method")
196  labelList findIndices(const wordRe& key, bool useGroups) const
197  {
198  return indices(key, useGroups);
199  }
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
const polyBoundaryMesh & pbm
label nNonProcessor() const
The number of patches before the first processor patch.
Foam::pointBoundaryMesh.
wordList physicalTypes() const
Return a list of physical types.
void movePoints(const pointField &)
Correct pointBoundaryMesh after moving points.
label nProcessorPatches() const
The number of processorPointPatch patches.
List< bool > select(const label n, const labelUList &locations)
Construct a selection list of bools (all false) with the given pre-size, subsequently add specified l...
Definition: BitOps.C:134
FOAM_DEPRECATED_FOR(2022-09, "get(), set() or test() methods") const T *operator()(const label i) const
Deprecated(2022-09) - same as get()
Definition: UPtrList.H:492
labelList indices(const wordRe &matcher, const bool useGroups) const
Return (sorted) patch indices for all matches.
const pointMesh & mesh() const noexcept
Return the mesh reference.
void updateMesh()
Correct pointBoundaryMesh after topology update.
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:45
labelList findIndices(const wordRe &key, bool useGroups) const
Identical to the indices() method (AUG-2018)
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("pointBoundaryMesh")
Runtime type information.
void reorder(const labelUList &oldToNew, const bool validBoundary)
Reorders patches. Ordering does not have to be done in.
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
A HashTable similar to std::unordered_map.
Definition: HashTable.H:108
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
Definition: wordRe.H:78
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
const direction noexcept
Definition: Scalar.H:258
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:103
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:68
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
wordList types() const
Return a list of patch types.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
wordList names() const
Return a list of patch names.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:180
virtual bool writeData(Ostream &) const
writeData member function required by regIOobject
Namespace for OpenFOAM.
virtual ~pointBoundaryMesh()=default
Destructor.