patchToPatchFvPatchFieldMapper.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) 2022-2023 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::patchToPatchFvPatchFieldMapper
26 
27 Description
28  FieldMapper which uses a patchToPatch object to map from another patch. The
29  source patch may be differently decomposed and/or geometrically and
30  topologically different from the target.
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef patchToPatchFvPatchFieldMapper_H
35 #define patchToPatchFvPatchFieldMapper_H
36 
37 #include "fvPatchFieldMapper.H"
38 #include "patchToPatch.H"
40 #include "ListOps.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class patchToPatchFvPatchFieldMapper Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public fvPatchFieldMapper
54 {
55 protected:
56 
57  // Protected Data
58 
59  //- Patch-to-patch interpolation engine
60  const patchToPatch& pToP_;
61 
62 
63 public:
64 
65  // Constructors
66 
67  //- Construct given a patch-to-patch interpolation
69  :
71  pToP_(pToP)
72  {}
73 
74 
75  //- Destructor
77  {}
78 
79 
80  // Member Operators
81 
82  //- Map a label field (not implemented)
84 
85  using fvPatchFieldMapper::operator();
86 
87  //- Map a temporary field
88  template<class Type>
89  void operator()(Field<Type>& f, const tmp<Field<Type>>& tmapF) const;
90 
91  //- Map a temporary field
92  template<class Type>
93  tmp<Field<Type>> operator()(const tmp<Field<Type>>& tmapF) const;
94 };
95 
96 
97 /*---------------------------------------------------------------------------*\
98  Class patchToPatchLeftOverFvPatchFieldMapper Declaration
99 \*---------------------------------------------------------------------------*/
100 
102 :
104 {
105  // Private Member Functions
106 
107  //- Map from one field to another
108  template<class Type>
109  void map(Field<Type>& f, const Field<Type>& mapF) const;
110 
111  //- Map a field and return the result as tmp
112  template<class Type>
113  tmp<Field<Type>> map(const Field<Type>& mapF) const;
114 
115 
116 public:
117 
118  // Constructors
119 
120  //- Inherit base class constructor
122 
123 
124  //- Destructor
126  {}
127 
128 
129  // Member Functions
130 
131  //- Return whether or not all faces receive a mapped value
132  virtual bool hasUnmapped() const
133  {
135  << "Not a valid query for this mapper, which should only be "
136  << "used for modifying an existing, valid, field"
137  << exit(FatalError);
138  return false;
139  }
140 
141 
142  // Member Operators
143 
144  //- Map a field
146 };
147 
148 
149 /*---------------------------------------------------------------------------*\
150  Class patchToPatchNormalisedFvPatchFieldMapper Declaration
151 \*---------------------------------------------------------------------------*/
152 
154 :
156 {
157  // Private Data
158 
159  //- Patch stabilisation engine
160  const patchToPatchStabilisation& pS_;
161 
162 
163  // Private Member Functions
164 
165  //- Map from one field to another
166  template<class Type>
167  void map(Field<Type>& f, const Field<Type>& mapF) const;
168 
169  //- Map a field and return the result as tmp
170  template<class Type>
171  tmp<Field<Type>> map(const Field<Type>& mapF) const;
172 
173 
174 public:
175 
176  // Constructors
177 
178  //- Construct given a patch-to-patch interpolation and stabilisation
180  (
181  const patchToPatch& pToP,
182  const patchToPatchStabilisation& pS
183  )
184  :
186  pS_(pS)
187  {}
188 
189 
190  //- Destructor
192  {}
193 
194 
195  // Member Functions
196 
197  //- Return whether or not all faces receive a mapped value
198  virtual bool hasUnmapped() const
199  {
200  return false;
201  }
202 
203 
204  // Member Operators
205 
206  //- Map a field
208 };
209 
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #ifdef NoRepository
220 #endif
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
Various functions to operate on Lists.
Pre-declare SubField and related Field type.
Definition: Field.H:82
Foam::fvPatchFieldMapper.
FieldMapper which uses a patchToPatch object to map from another patch. The source patch may be diffe...
patchToPatchFvPatchFieldMapper(const patchToPatch &pToP)
Construct given a patch-to-patch interpolation.
const patchToPatch & pToP_
Patch-to-patch interpolation engine.
void operator()(Field< Type > &f, const tmp< Field< Type >> &tmapF) const
Map a temporary field.
DEFINE_FIELD_MAPPER_OPERATOR(label,)
Map a label field (not implemented)
virtual bool hasUnmapped() const
Return whether or not all faces receive a mapped value.
FOR_ALL_FIELD_TYPES(DEFINE_FIELD_MAPPER_OPERATOR,)
Map a field.
patchToPatchNormalisedFvPatchFieldMapper(const patchToPatch &pToP, const patchToPatchStabilisation &pS)
Construct given a patch-to-patch interpolation and stabilisation.
virtual bool hasUnmapped() const
Return whether or not all faces receive a mapped value.
FOR_ALL_FIELD_TYPES(DEFINE_FIELD_MAPPER_OPERATOR,)
Map a field.
Stabilisation data and routines for patch-to-patch interpolations.
Class to generate coupling geometry between two primitive patches.
Definition: patchToPatch.H:56
A class for managing temporary objects.
Definition: tmp.H:55
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
error FatalError
labelList f(nPoints)