faBoundaryMesh.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) 2016-2017 Wikki Ltd
9  Copyright (C) 2018-2020 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::faBoundaryMesh
29 
30 Description
31  Finite area boundary mesh
32 
33 SourceFiles
34  faBoundaryMesh.C
35 
36 Author
37  Zeljko Tukovic, FMENA
38  Hrvoje Jasak, Wikki Ltd.
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef faBoundaryMesh_H
43 #define faBoundaryMesh_H
44 
45 #include "faPatchList.H"
46 #include "lduInterfacePtrsList.H"
47 #include "wordList.H"
48 #include "pointField.H"
49 #include "regIOobject.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 
58 // Forward Declarations
59 class faMesh;
60 class faBoundaryMesh;
61 Ostream& operator<<(Ostream&, const faBoundaryMesh&);
62 
63 /*---------------------------------------------------------------------------*\
64  Class faBoundaryMesh Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class faBoundaryMesh
68 :
69  public faPatchList,
70  public regIOobject
71 {
72  // Private Data
73 
74  //- Reference to mesh
75  const faMesh& mesh_;
76 
77  //- No copy construct
78  faBoundaryMesh(const faBoundaryMesh&) = delete;
79 
80  //- No copy assignment
81  void operator=(const faBoundaryMesh&) = delete;
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("faBoundaryMesh");
88 
89 
90  // Constructors
91 
92  //- Construct from dictionary
94  (
95  const IOobject& io,
96  const faMesh& fam
97  );
98 
99  //- Construct given size
101  (
102  const IOobject& io,
103  const faMesh& fam,
104  const label size
105  );
106 
107 
108  //- Destructor
109  ~faBoundaryMesh() = default;
110 
111 
112  // Member Functions
113 
114  // Access
115 
116  //- Calculate the geometry for the patches
117  // (transformation tensors etc.)
118  void calcGeometry();
119 
120  //- Return the mesh reference
121  const faMesh& mesh() const;
122 
123  //- Return a list of pointers for each patch
124  //- with only those pointing to interfaces being set
126 
127  //- Return a list of patch names
128  wordList names() const;
129 
130  //- Return a list of patch types
131  wordList types() const;
132 
133  //- Return patch indices for all matches.
134  // A no-op (returns -1) for an empty key
135  // \note Matching patchGroups currently not supported
137  (
138  const keyType& key,
139  const bool useGroups = false /* ignored */
140  ) const;
141 
142  //- Return patch index for the first match, return -1 if not found
143  // A no-op (returns -1) for an empty key
144  label findIndex(const keyType& key) const;
145 
146  //- Find patch index given a name, return -1 if not found
147  // A no-op (returns -1) for an empty name
148  label findPatchID(const word& patchName) const;
149 
150  //- Return patch index for a given edge label
151  label whichPatch(const label edgeIndex) const;
152 
153  //- Check boundary definition
154  bool checkDefinition(const bool report = false) const;
155 
156 
157  // Edit
158 
159  //- Correct faBoundaryMesh after moving points
160  void movePoints(const pointField&);
161 
162  //- Correct faBoundaryMesh after topology update
163  void updateMesh();
164 
165  //- writeData member function required by regIOobject
166  bool writeData(Ostream&) const;
167 
168 
169  // Ostream operator
170 
171  friend Ostream& operator<<(Ostream&, const faBoundaryMesh&);
172 
173 
174  // Housekeeping
175 
176  //- Identical to the indices() method (AUG-2018)
177  FOAM_DEPRECATED_FOR(2018-08, "indices() method")
179  (
180  const keyType& key,
181  const bool useGroups = false
182  ) const
183  {
184  return indices(key, useGroups);
185  }
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #endif
196 
197 // ************************************************************************* //
regIOobject.H
Foam::faBoundaryMesh::whichPatch
label whichPatch(const label edgeIndex) const
Return patch index for a given edge label.
Definition: faBoundaryMesh.C:301
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::faBoundaryMesh::updateMesh
void updateMesh()
Correct faBoundaryMesh after topology update.
Definition: faBoundaryMesh.C:412
Foam::faBoundaryMesh::operator<<
friend Ostream & operator<<(Ostream &, const faBoundaryMesh &)
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::faBoundaryMesh::checkDefinition
bool checkDefinition(const bool report=false) const
Check boundary definition.
Definition: faBoundaryMesh.C:343
Foam::faBoundaryMesh::calcGeometry
void calcGeometry()
Calculate the geometry for the patches.
Definition: faBoundaryMesh.C:175
Foam::faBoundaryMesh::movePoints
void movePoints(const pointField &)
Correct faBoundaryMesh after moving points.
Definition: faBoundaryMesh.C:390
Foam::faBoundaryMesh::findIndex
label findIndex(const keyType &key) const
Return patch index for the first match, return -1 if not found.
Definition: faBoundaryMesh.C:269
wordList.H
lduInterfacePtrsList.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:60
Foam::faBoundaryMesh
Finite area boundary mesh.
Definition: faBoundaryMesh.H:66
Foam::Field< vector >
Foam::faBoundaryMesh::names
wordList names() const
Return a list of patch names.
Definition: faBoundaryMesh.C:221
faPatchList.H
Foam::UPtrList< const lduInterface >
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:62
Foam::faBoundaryMesh::findPatchID
label findPatchID(const word &patchName) const
Find patch index given a name, return -1 if not found.
Definition: faBoundaryMesh.C:290
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faBoundaryMesh::TypeName
TypeName("faBoundaryMesh")
Runtime type information.
Foam::faBoundaryMesh::mesh
const faMesh & mesh() const
Return the mesh reference.
Definition: faBoundaryMesh.C:195
pointField.H
Foam::faBoundaryMesh::types
wordList types() const
Return a list of patch types.
Definition: faBoundaryMesh.C:227
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:71
Foam::List< word >
Foam::FOAM_DEPRECATED_FOR
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:69
Foam::faBoundaryMesh::~faBoundaryMesh
~faBoundaryMesh()=default
Destructor.
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:77
Foam::faBoundaryMesh::writeData
bool writeData(Ostream &) const
writeData member function required by regIOobject
Definition: faBoundaryMesh.C:428
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
fam
Calculate the matrix for the second temporal derivative.
Foam::faBoundaryMesh::indices
labelList indices(const keyType &key, const bool useGroups=false) const
Return patch indices for all matches.
Definition: faBoundaryMesh.C:234
Foam::faBoundaryMesh::findIndices
labelList findIndices(const keyType &key, const bool useGroups=false) const
Identical to the indices() method (AUG-2018)
Definition: faBoundaryMesh.H:178
Foam::faBoundaryMesh::interfaces
lduInterfacePtrsList interfaces() const
Definition: faBoundaryMesh.C:201