mappedPatchBaseBase.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::mappedPatchBaseBase
26 
27 Description
28  Base class for engines and poly patches which provide mapping between two
29  poly patches
30 
31  Example:
32  \verbatim
33  // The name of the region to map from. Optional. Defaults to the same
34  // region as the patch.
35  neighbourRegion region0;
36 
37  // The name of the patch to map from
38  neighbourPatch movingWall;
39 
40  // Couple group to specify the region and patch to map from. This is an
41  // alternative to specifying neighbourRegion and neighbourPatch
42  // directly, as shown above.
43  coupleGroup baffleGroup;
44  \endverbatim
45 
46 SourceFiles
47  mappedPatchBaseBase.C
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef mappedPatchBaseBase_H
52 #define mappedPatchBaseBase_H
53 
54 #include "coupleGroupIdentifier.H"
55 #include "cyclicTransform.H"
56 #include "polyMesh.H"
57 
58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 
60 namespace Foam
61 {
62 
63 /*---------------------------------------------------------------------------*\
64  Class mappedPatchBaseBase Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69 protected:
70 
71  // Protected data
72 
73  //- Patch to map to
74  const polyPatch& patch_;
75 
76  //- Couple group for the region/patch to map from
78 
79  //- Name of the region to map from
80  mutable word nbrRegionName_;
81 
82  //- Name of the patch to map from
83  mutable word nbrPatchName_;
84 
85  //- The transformation between the patches
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("mappedPatchBaseBase");
93 
94 
95  // Constructors
96 
97  //- Construct from patch
99 
100  //- Construct from components
102  (
103  const polyPatch& pp,
104  const word& nbrRegionName,
105  const word& nbrPatchName,
107  );
108 
109  //- Construct from dictionary
111  (
112  const polyPatch& pp,
113  const dictionary& dict,
114  const bool transformisNone
115  );
116 
117  //- Construct as copy, resetting patch
119 
120 
121  //- Destructor
122  virtual ~mappedPatchBaseBase();
123 
124 
125  // Member Functions
126 
127  // Access
128 
129  //- Name of the region to map from
130  inline const word& nbrRegionName() const;
131 
132  //- Name of the patch to map from
133  inline const word& nbrPatchName() const;
134 
135  //- The transformation between the patches
136  inline const transformer& transform() const;
137 
138  //- Is the neighbour region the same as for this patch?
139  inline bool sameRegion() const;
140 
141  //- Is the neighbour patch the same as this patch?
142  inline bool samePatch() const;
143 
144  //- Is the neighbour patch the same as this patch with no transform?
145  inline bool sameUntransformedPatch() const;
146 
147  //- Is the neighbour available?
148  bool haveNbr() const;
149 
150  //- Get the mesh for the region to map from
151  const polyMesh& nbrMesh() const;
152 
153  //- Get the patch to map from
154  const polyPatch& nbrPolyPatch() const;
155 
156 
157  // Casting
158 
159  //- Restrict use of the mapper to certain configurations
160  struct from
161  {
162  static const label any = 0;
163  static const label sameRegion = 1;
164  static const label differentRegion = 2;
165  static const label differentPatch = 4;
166  };
167 
168  //- Validate that the map exists and is appropriate for the given
169  // set of permitted configurations
170  template<class PatchField, class FieldType>
171  static void validateMapForField
172  (
173  const PatchField& field,
174  const FieldType& iF,
175  const dictionary& context,
176  const label froms = from::any
177  );
178 
179  //- Validate that the map is appropriate for the given
180  // set of permitted configurations
181  template<class PatchField, class FieldType>
182  void validateForField
183  (
184  const PatchField& field,
185  const FieldType& iF,
186  const dictionary& context,
187  const label froms = from::any
188  ) const;
189 
190 
191  // I/O
192 
193  //- Return whether or not the given dictionary contains a
194  // mappedPatchBaseBase specification
195  static bool specified(const dictionary& dict);
196 
197  //- Write as a dictionary
198  virtual void write(Ostream&) const;
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #include "mappedPatchBaseBaseI.H"
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #ifdef NoRepository
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Encapsulates using patchGroups to specify coupled patch.
Cyclic plane transformation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Base class for engines and poly patches which provide mapping between two poly patches.
const transformer & transform() const
The transformation between the patches.
const polyPatch & nbrPolyPatch() const
Get the patch to map from.
word nbrRegionName_
Name of the region to map from.
word nbrPatchName_
Name of the patch to map from.
bool samePatch() const
Is the neighbour patch the same as this patch?
const polyPatch & patch_
Patch to map to.
virtual void write(Ostream &) const
Write as a dictionary.
const polyMesh & nbrMesh() const
Get the mesh for the region to map from.
const word & nbrPatchName() const
Name of the patch to map from.
cyclicTransform transform_
The transformation between the patches.
virtual ~mappedPatchBaseBase()
Destructor.
void validateForField(const PatchField &field, const FieldType &iF, const dictionary &context, const label froms=from::any) const
Validate that the map is appropriate for the given.
const word & nbrRegionName() const
Name of the region to map from.
bool haveNbr() const
Is the neighbour available?
TypeName("mappedPatchBaseBase")
Runtime type information.
bool sameUntransformedPatch() const
Is the neighbour patch the same as this patch with no transform?
bool sameRegion() const
Is the neighbour region the same as for this patch?
static bool specified(const dictionary &dict)
Return whether or not the given dictionary contains a.
const coupleGroupIdentifier coupleGroup_
Couple group for the region/patch to map from.
static void validateMapForField(const PatchField &field, const FieldType &iF, const dictionary &context, const label froms=from::any)
Validate that the map exists and is appropriate for the given.
mappedPatchBaseBase(const polyPatch &)
Construct from patch.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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:59
dictionary dict
Restrict use of the mapper to certain configurations.