fvBoundaryMesh.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-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2023 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::fvBoundaryMesh
29 
30 Description
31  Foam::fvBoundaryMesh
32 
33 SourceFiles
34  fvBoundaryMesh.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_fvBoundaryMesh_H
39 #define Foam_fvBoundaryMesh_H
40 
41 #include "fvPatch.H"
42 #include "lduInterfacePtrsList.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class fvMesh;
51 class polyBoundaryMesh;
52 class wordRes;
53 
54 /*---------------------------------------------------------------------------*\
55  Class fvBoundaryMesh Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class fvBoundaryMesh
59 :
60  public fvPatchList
61 {
62  // Private Data
63 
64  //- Reference to mesh
65  const fvMesh& mesh_;
66 
67 
68  // Private Member Functions
69 
70  //- Assign fvPatches corresponding to the given polyBoundaryMesh
71  void addPatches(const polyBoundaryMesh& pbm);
72 
73 protected:
74 
75  //- Update boundary based on new polyBoundaryMesh
76  void readUpdate(const polyBoundaryMesh&);
77 
78 
79 public:
80 
81  //- Declare friendship with fvMesh
82  friend class fvMesh;
83 
84 
85  // Generated Methods
86 
87  //- No copy construct
88  fvBoundaryMesh(const fvBoundaryMesh&) = delete;
89 
90  //- No copy assignment
91  void operator=(const fvBoundaryMesh&) = delete;
92 
93 
94  // Constructors
95 
96  //- Construct zero size with mesh reference
97  explicit fvBoundaryMesh(const fvMesh&);
98 
99  //- Construct from polyBoundaryMesh
100  fvBoundaryMesh(const fvMesh&, const polyBoundaryMesh&);
101 
102 
103  // Member Functions
104 
105  //- Return the mesh reference
106  const fvMesh& mesh() const noexcept { return mesh_; }
107 
108  //- Return a list of faceCells for each patch
110 
111  //- Return a list of pointers for each patch
112  //- with only those pointing to interfaces being set
114 
115  //- Return (sorted) patch indices for all matches.
116  // A no-op (returns empty list) for an empty matcher
117  labelList indices(const wordRe& matcher, const bool useGroups) const;
118 
119  //- Return (sorted) patch indices for all matches.
120  // A no-op (returns empty list) for an empty matcher
121  labelList indices(const wordRes& matcher, const bool useGroups) const;
122 
123  //- Return (sorted) patch indices for all selected matches that
124  //- are not ignored.
125  //- The selection logic as per Foam::wordRes::filter.
126  // Optionally matches patch groups.
127  // A no-op (returns empty list) for an empty select matcher
129  (
130  const wordRes& select,
131  const wordRes& ignore,
132  const bool useGroups
133  ) const;
134 
135  //- Find patch index given a name
136  // A no-op (returns -1) for an empty patchName
137  label findPatchID(const word& patchName) const;
138 
139  //- Correct patches after moving points
140  void movePoints();
141 
142 
143  // Member Operators
144 
145  //- Return const and non-const reference to fvPatch by index.
146  using fvPatchList::operator[];
147 
148  //- Return const reference to fvPatch by name.
149  const fvPatch& operator[](const word& patchName) const;
150 
151  //- Return reference to fvPatch by name.
152  fvPatch& operator[](const word& patchName);
153 
154 
155  // Housekeeping
156 
157  //- Identical to the indices() method (AUG-2018)
158  FOAM_DEPRECATED_FOR(2018-08, "indices() method")
159  labelList findIndices(const wordRe& key, bool useGroups) const
160  {
161  return indices(key, useGroups);
162  }
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace Foam
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
const polyBoundaryMesh & pbm
label findPatchID(const word &patchName) const
Find patch index given a name.
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
const fvPatch & operator[](const word &patchName) const
Return const reference to fvPatch by name.
void operator=(const fvBoundaryMesh &)=delete
No copy assignment.
const fvMesh & mesh() const noexcept
Return the mesh reference.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
labelList findIndices(const wordRe &key, bool useGroups) const
Identical to the indices() method (AUG-2018)
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
void readUpdate(const polyBoundaryMesh &)
Update boundary based on new polyBoundaryMesh.
labelList indices(const wordRe &matcher, const bool useGroups) const
Return (sorted) patch indices for all matches.
A class for handling words, derived from Foam::string.
Definition: word.H:63
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
friend Ostream & operator(Ostream &os, const UPtrList< T > &list)
Write UPtrList to Ostream.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
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...
const direction noexcept
Definition: Scalar.H:258
UPtrList< const labelUList > faceCells() const
Return a list of faceCells for each patch.
lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch with only those pointing to interfaces being set...
fvBoundaryMesh(const fvBoundaryMesh &)=delete
No copy construct.
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
Foam::fvBoundaryMesh.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
void movePoints()
Correct patches after moving points.
Namespace for OpenFOAM.