coupleGroupIdentifier.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) 2013 OpenFOAM Foundation
9  Copyright (C) 2020-2021 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::coupleGroupIdentifier
29 
30 Description
31  Encapsulates using "patchGroups" to specify coupled patch
32 
33 SourceFiles
34  coupleGroupIdentifier.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_coupleGroupIdentifier_H
39 #define Foam_coupleGroupIdentifier_H
40 
41 #include "word.H"
42 #include "label.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class dictionary;
51 class polyMesh;
52 class polyPatch;
53 
54 /*---------------------------------------------------------------------------*\
55  Class coupleGroupIdentifier Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 {
60  // Private Data
61 
62  //- Name of patchGroup
63  word name_;
64 
65 
66  // Private Member Functions
67 
68  //- Find other patch in specified mesh.
69  // \return index of patch or -1
70  label findOtherPatchID
71  (
72  const polyMesh& mesh,
73  const polyPatch& thisPatch
74  ) const;
75 
76 
77 public:
78 
79  // Generated Methods
80 
81  //- Default construct
82  coupleGroupIdentifier() = default;
83 
84 
85  // Constructors
86 
87  //- Construct from patchGroup name
88  explicit coupleGroupIdentifier(const word& patchGroupName)
89  :
90  name_(patchGroupName)
91  {}
92 
93  //- Construct from dictionary
94  explicit coupleGroupIdentifier(const dictionary& dict);
95 
96 
97  // Member Functions
98 
99  //- Name of patchGroup
100  const word& name() const noexcept { return name_; }
101 
102  //- The patchGroup has a non-empty name
103  bool good() const noexcept { return !name_.empty(); }
104 
105  //- The patchGroup has a non-empty name
106  bool valid() const noexcept { return good(); }
107 
108  //- Find other patch in same region.
109  // \return index of patch or -1.
110  label findOtherPatchID(const polyPatch& thisPatch) const;
111 
112  //- Find other patch and region.
113  // Returns index of patch and sets otherRegion to name of region.
114  // FatalError if patch not found
115  label findOtherPatchID
116  (
117  const polyPatch& thisPatch,
118  word& otherRegion
119  ) const;
120 
121  //- Write the coupleGroup dictionary entry
122  void write(Ostream& os) const;
123 };
124 
125 
126 // Global Operators
127 
128 //- Write the coupleGroup dictionary entry
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
bool valid() const noexcept
The patchGroup has a non-empty name.
const word & name() const noexcept
Name of patchGroup.
dynamicFvMesh & mesh
bool good() const noexcept
The patchGroup has a non-empty name.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Encapsulates using "patchGroups" to specify coupled patch.
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
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
void write(Ostream &os) const
Write the coupleGroup dictionary entry.
coupleGroupIdentifier()=default
Default construct.
Namespace for OpenFOAM.