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 coupleGroupIdentifier_H
39 #define 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
101  {
102  return name_;
103  }
104 
105  //- Is a valid patchGroup (non-empty) name
106  bool valid() const noexcept
107  {
108  return !name_.empty();
109  }
110 
111  //- Find other patch in same region.
112  // \return index of patch or -1.
113  label findOtherPatchID(const polyPatch& thisPatch) const;
114 
115  //- Find other patch and region.
116  // Returns index of patch and sets otherRegion to name of region.
117  // FatalError if patch not found
118  label findOtherPatchID
119  (
120  const polyPatch& thisPatch,
121  word& otherRegion
122  ) const;
123 
124  //- Write the coupleGroup dictionary entry
125  void write(Ostream& os) const;
126 };
127 
128 
129 // Global Operators
130 
131 //- Write the coupleGroup dictionary entry
132 Ostream& operator<<(Ostream& os, const coupleGroupIdentifier& ident);
133 
134 
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
Foam::coupleGroupIdentifier
Encapsulates using "patchGroups" to specify coupled patch.
Definition: coupleGroupIdentifier.H:57
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::coupleGroupIdentifier::name
const word & name() const noexcept
Name of patchGroup.
Definition: coupleGroupIdentifier.H:99
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::coupleGroupIdentifier::coupleGroupIdentifier
coupleGroupIdentifier(const word &patchGroupName)
Construct from patchGroup name.
Definition: coupleGroupIdentifier.H:87
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::coupleGroupIdentifier::write
void write(Ostream &os) const
Write the coupleGroup dictionary entry.
Definition: coupleGroupIdentifier.C:211
label.H
Foam::coupleGroupIdentifier::coupleGroupIdentifier
coupleGroupIdentifier()=default
Default construct.
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::coupleGroupIdentifier::valid
bool valid() const noexcept
Is a valid patchGroup (non-empty) name.
Definition: coupleGroupIdentifier.H:105