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 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  // Matching patchGroups currently not supported
136  (
137  const keyType& key,
138  const bool useGroups = false
139  ) const;
140 
141  //- Return patch index for the first match, return -1 if not found
142  label findIndex(const keyType& key) const;
143 
144  //- Find patch index given a name, return -1 if not found
145  label findPatchID(const word& patchName) const;
146 
147  //- Return patch index for a given edge label
148  label whichPatch(const label edgeIndex) const;
149 
150  //- Check boundary definition
151  bool checkDefinition(const bool report = false) const;
152 
153 
154  // Edit
155 
156  //- Correct faBoundaryMesh after moving points
157  void movePoints(const pointField&);
158 
159  //- Correct faBoundaryMesh after topology update
160  void updateMesh();
161 
162  //- writeData member function required by regIOobject
163  bool writeData(Ostream&) const;
164 
165 
166  // Ostream operator
167 
168  friend Ostream& operator<<(Ostream&, const faBoundaryMesh&);
169 
170 
171  // Housekeeping
172 
173  //- Identical to the indices() method (AUG-2018)
175  (
176  const keyType& key,
177  const bool useGroups = false
178  ) const
179  {
180  return indices(key, useGroups);
181  }
182 
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
regIOobject.H
Foam::faBoundaryMesh::whichPatch
label whichPatch(const label edgeIndex) const
Return patch index for a given edge label.
Definition: faBoundaryMesh.C:296
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:407
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:338
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:385
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::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:60
Foam::faBoundaryMesh
Finite area boundary mesh.
Definition: faBoundaryMesh.H:66
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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:65
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:67
Foam::List< word >
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:423
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:174
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
Foam::faBoundaryMesh::interfaces
lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
Definition: faBoundaryMesh.C:201