PatchToPatchInterpolation.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) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::PatchToPatchInterpolation
28
29Description
30 Interpolation class dealing with transfer of data between two
31 primitivePatches
32
33SourceFiles
34 PatchToPatchInterpolation.C
35 PatchToPatchInterpolate.C
36 CalcPatchToPatchWeights.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef PatchToPatchInterpolation_H
41#define PatchToPatchInterpolation_H
42
43#include "className.H"
44#include "labelList.H"
45#include "scalarField.H"
46#include "pointField.H"
47#include "FieldFields.H"
48#include "faceList.H"
49#include "intersection.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56/*---------------------------------------------------------------------------*\
57 Class PatchToPatchInterpolationName Declaration
58\*---------------------------------------------------------------------------*/
61
62
63/*---------------------------------------------------------------------------*\
64 Class PatchToPatchInterpolation Declaration
65\*---------------------------------------------------------------------------*/
66
67template<class FromPatch, class ToPatch>
69:
70 public PatchToPatchInterpolationName
71{
72 // Private data
73
74 //- Reference to the source patch
75 const FromPatch& fromPatch_;
76
77 //- Reference to the target patch
78 const ToPatch& toPatch_;
79
80 //- Type of intersection algorithm to use in projection
82
83 //- Direction projection to use in projection
85
86
87 // Static data
88
89 //- Relative merge tolerance for projected points missing the target
90 // Expressed as the fraction of min involved edge size
91 static scalar projectionTol_;
92
93
94 // Point addressing
95
96 //- Face into which each point of target patch is projected
97 mutable labelList* pointAddressingPtr_;
98
99 //- Weighting factors
100 mutable FieldField<Field, scalar>* pointWeightsPtr_;
101
102 //- Distance to intersection for patch points
103 mutable scalarField* pointDistancePtr_;
104
105 // Face addressing
106
107 //- Face into which each face centre of target patch is projected
108 mutable labelList* faceAddressingPtr_;
109
110 //- Weighting factors
111 mutable FieldField<Field, scalar>* faceWeightsPtr_;
112
113 //- Distance to intersection for patch face centres
114 mutable scalarField* faceDistancePtr_;
115
116
117 // Private Member Functions
118
119 //- No copy construct
121
122 //- No copy assignment
123 void operator=(const PatchToPatchInterpolation&) = delete;
124
125 //- Calculate point weights
126 void calcPointAddressing() const;
127
128 //- Calculate face weights
129 void calcFaceAddressing() const;
130
131 //- Clear all geometry and addressing
132 void clearOut();
133
134
135 //- Return reference to point addressing
136 const labelList& pointAddr() const;
137
138 //- Return reference to point weights
139 const FieldField<Field, scalar>& pointWeights() const;
140
141 //- Return reference to face addressing
142 const labelList& faceAddr() const;
143
144 //- Return reference to face weights
145 const FieldField<Field, scalar>& faceWeights() const;
146
147
148 // Private static data members
149
150 //- Direct hit tolerance
151 static const scalar directHitTol;
152
153
154public:
155
156 // Constructors
157
158 //- Construct from components
160 (
161 const FromPatch& fromPatch,
162 const ToPatch& toPatch,
165 );
166
167
168 //- Destructor
170
171
172 // Member Functions
173
174 //- Set the projection tolerance, returning the previous value
175 static scalar setProjectionTol(const scalar t)
176 {
177 if (t < -VSMALL)
178 {
180 << abort(FatalError);
181 }
182
183 scalar oldTol = projectionTol_;
184 projectionTol_ = t;
185
186 return oldTol;
187 }
188
189 //- Return ype of intersection algorithm to use in projection
191 {
192 return alg_;
193 }
194
195 //- Return direction projection to use in projection
197 {
198 return dir_;
199 }
200
201 //- Return distance to intersection for patch points
203
204 //- Return distance to intersection for patch face centres
206
207 //- Correct weighting factors for moving mesh.
208 bool movePoints();
209
210
211 //- Interpolate point field
212 template<class Type>
214
215 template<class Type>
217
218 //- Interpolate face field
219 template<class Type>
221
222 template<class Type>
224
225};
226
227
228// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229
230} // End namespace Foam
231
232#ifdef NoRepository
234#endif
235
236// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237
238#endif
239
240// ************************************************************************* //
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:80
Interpolation class dealing with transfer of data between two primitivePatches.
bool movePoints()
Correct weighting factors for moving mesh.
intersection::direction projectionDir() const
Return direction projection to use in projection.
static scalar setProjectionTol(const scalar t)
Set the projection tolerance, returning the previous value.
intersection::algorithm projectionAlgo() const
Return ype of intersection algorithm to use in projection.
const scalarField & pointDistanceToIntersection() const
Return distance to intersection for patch points.
const scalarField & faceDistanceToIntersection() const
Return distance to intersection for patch face centres.
tmp< Field< Type > > pointInterpolate(const Field< Type > &pf) const
Interpolate point field.
tmp< Field< Type > > faceInterpolate(const Field< Type > &pf) const
Interpolate face field.
A class for managing temporary objects.
Definition: tmp.H:65
Macro definitions for declaring ClassName(), NamespaceName(), etc.
#define TemplateName(TemplateNameString)
Add typeName information from argument TypeNameString to a.
Definition: className.H:79
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError