mappedFvPatchBaseBase.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) 2023-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::mappedFvPatchBaseBase
26 
27 Description
28  Base class for fv patches that provide mapping between two fv patches
29 
30 SourceFiles
31  mappedFvPatchBaseBase.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef mappedFvPatchBaseBase_H
36 #define mappedFvPatchBaseBase_H
37 
38 #include "mappedPatchBaseBase.H"
39 #include "fvPatch.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 #define DEFINE_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, FromTo, Modifier) \
44  \
45  virtual tmp<Field<Type>> FromTo##Neighbour \
46  ( \
47  const Field<Type>& \
48  ) const Modifier; \
49  \
50  virtual tmp<Field<Type>> FromTo##Neighbour \
51  ( \
52  const tmp<Field<Type>>& \
53  ) const Modifier;
54 
55 
56 #define DEFINE_MAPPED_FV_PATCH_BASE_FROM_AND_TO_NEIGHBOUR(Type, Modifier) \
57  \
58  DEFINE_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, from, Modifier) \
59  \
60  DEFINE_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, to, Modifier)
61 
62 
63 #define IMPLEMENT_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, PatchType, FromTo) \
64  \
65  Foam::tmp<Foam::Field<Foam::Type>> Foam::PatchType::FromTo##Neighbour \
66  ( \
67  const Field<Type>& nbrFldFld \
68  ) const \
69  { \
70  return FromTo##Neighbour<Type>(nbrFldFld); \
71  } \
72  \
73  Foam::tmp<Foam::Field<Foam::Type>> Foam::PatchType::FromTo##Neighbour \
74  ( \
75  const tmp<Field<Type>>& nbrFldFld \
76  ) const \
77  { \
78  tmp<Field<Type>> tResult = FromTo##Neighbour<Type>(nbrFldFld()); \
79  if (&tResult() == &nbrFldFld()) \
80  { \
81  return nbrFldFld; \
82  } \
83  else \
84  { \
85  nbrFldFld.clear(); \
86  return tResult; \
87  } \
88  }
89 
90 
91 #define IMPLEMENT_MAPPED_FV_PATCH_BASE_FROM_AND_TO_NEIGHBOUR(Type, PatchType) \
92  \
93  IMPLEMENT_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, PatchType, from) \
94  \
95  IMPLEMENT_MAPPED_FV_PATCH_BASE__NEIGHBOUR(Type, PatchType, to)
96 
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 namespace Foam
101 {
102 
103 class fvMesh;
104 
105 /*---------------------------------------------------------------------------*\
106  Class mappedFvPatchBaseBase Declaration
107 \*---------------------------------------------------------------------------*/
108 
110 {
111  // Private Data
112 
113  //- Patch to map to
114  const fvPatch& patch_;
115 
116  //- Poly patch mapper base
117  const mappedPatchBaseBase& mapper_;
118 
119 
120 public:
121 
122  //- Runtime type information
123  TypeName("mappedFvPatchBaseBase");
124 
125 
126  // Constructors
127 
128  //- Construct from a patch
130 
131 
132  //- Destructor
133  virtual ~mappedFvPatchBaseBase();
134 
135 
136  // Member Functions
137 
138  //- Cast the given fvPatch to a mappedFvPatchBaseBase. Handle errors.
139  static const mappedFvPatchBaseBase& getMap(const fvPatch& patch);
140 
141 
142  // Access
143 
144  //- Reference to the fvPatch
145  inline const fvPatch& patch() const;
146 
147  //- Name of the region to map from
148  inline const word& nbrRegionName() const;
149 
150  //- Name of the patch to map from
151  inline const word& nbrPatchName() const;
152 
153  //- The transformation between the patches
154  inline const transformer& transform() const;
155 
156  //- Is the neighbour available?
157  bool haveNbr() const;
158 
159  //- Get the mesh for the region to map from
160  const fvMesh& nbrMesh() const;
161 
162  //- Get the patch to map from
163  const fvPatch& nbrFvPatch() const;
164 
165 
166  //- Map/interpolate
168  (
170  = 0
171  );
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #include "mappedFvPatchBaseBaseI.H"
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
Base class for fv patches that provide mapping between two fv patches.
const fvPatch & patch() const
Reference to the fvPatch.
const transformer & transform() const
The transformation between the patches.
FOR_ALL_FIELD_TYPES(DEFINE_MAPPED_FV_PATCH_BASE_FROM_AND_TO_NEIGHBOUR,=0)
Map/interpolate.
mappedFvPatchBaseBase(const fvPatch &patch)
Construct from a patch.
TypeName("mappedFvPatchBaseBase")
Runtime type information.
const fvPatch & nbrFvPatch() const
Get the patch to map from.
static const mappedFvPatchBaseBase & getMap(const fvPatch &patch)
Cast the given fvPatch to a mappedFvPatchBaseBase. Handle errors.
const word & nbrPatchName() const
Name of the patch to map from.
const word & nbrRegionName() const
Name of the region to map from.
bool haveNbr() const
Is the neighbour available?
const fvMesh & nbrMesh() const
Get the mesh for the region to map from.
virtual ~mappedFvPatchBaseBase()
Destructor.
Base class for engines and poly patches which provide mapping between two poly patches.
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
#define DEFINE_MAPPED_FV_PATCH_BASE_FROM_AND_TO_NEIGHBOUR(Type, Modifier)
Namespace for OpenFOAM.