PatchToPatchInterpolation.C
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
26\*---------------------------------------------------------------------------*/
27
29#include "demandDrivenData.H"
30
31// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32
33namespace Foam
34{
35
36// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37
38template<class FromPatch, class ToPatch>
39const scalar
40PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
41
42// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43
44template<class FromPatch, class ToPatch>
45const labelList&
46PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
47{
48 if (!pointAddressingPtr_)
49 {
50 calcPointAddressing();
51 }
52
53 return *pointAddressingPtr_;
54}
55
56
57template<class FromPatch, class ToPatch>
58const FieldField<Field, scalar>&
59PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
60{
61 if (!pointWeightsPtr_)
62 {
63 calcPointAddressing();
64 }
65
66 return *pointWeightsPtr_;
67}
68
69
70template<class FromPatch, class ToPatch>
71const labelList&
72PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
73{
74 if (!faceAddressingPtr_)
75 {
76 calcFaceAddressing();
77 }
78
79 return *faceAddressingPtr_;
80}
81
82
83template<class FromPatch, class ToPatch>
84const FieldField<Field, scalar>&
85PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
86{
87 if (!faceWeightsPtr_)
88 {
89 calcFaceAddressing();
90 }
91
92 return *faceWeightsPtr_;
93}
94
95
96template<class FromPatch, class ToPatch>
97void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
98{
99 deleteDemandDrivenData(pointAddressingPtr_);
100 deleteDemandDrivenData(pointWeightsPtr_);
101 deleteDemandDrivenData(pointDistancePtr_);
102 deleteDemandDrivenData(faceAddressingPtr_);
103 deleteDemandDrivenData(faceWeightsPtr_);
104 deleteDemandDrivenData(faceDistancePtr_);
105}
106
107
108// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
109
110template<class FromPatch, class ToPatch>
112(
113 const FromPatch& fromPatch,
114 const ToPatch& toPatch,
117)
118:
119 fromPatch_(fromPatch),
120 toPatch_(toPatch),
121 alg_(alg),
122 dir_(dir),
123 pointAddressingPtr_(nullptr),
124 pointWeightsPtr_(nullptr),
125 pointDistancePtr_(nullptr),
126 faceAddressingPtr_(nullptr),
127 faceWeightsPtr_(nullptr),
128 faceDistancePtr_(nullptr)
129{}
130
131
132// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
133
134template<class FromPatch, class ToPatch>
136{
137 clearOut();
138}
139
140
141// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
142
143template<class FromPatch, class ToPatch>
144const scalarField&
147{
148 if (!pointDistancePtr_)
149 {
150 calcPointAddressing();
151 }
152
153 return *pointDistancePtr_;
154}
155
156
157template<class FromPatch, class ToPatch>
158const scalarField&
161{
162 if (!faceDistancePtr_)
163 {
164 calcFaceAddressing();
165 }
166
167 return *faceDistancePtr_;
168}
169
170
171template<class FromPatch, class ToPatch>
173{
174 clearOut();
175
176 return true;
177}
178
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182} // End namespace Foam
183
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
188
189// ************************************************************************* //
Patch to patch interpolation functions.
Interpolation class dealing with transfer of data between two primitivePatches.
bool movePoints()
Correct weighting factors for moving mesh.
Template functions to aid in the implementation of demand driven data.
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
void deleteDemandDrivenData(DataPtr &dataPtr)
volScalarField & e
Definition: createFields.H:11