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  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
37 
38 template<class FromPatch, class ToPatch>
39 const labelList&
40 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
41 {
42  if (!pointAddressingPtr_)
43  {
44  calcPointAddressing();
45  }
46 
47  return *pointAddressingPtr_;
48 }
49 
50 
51 template<class FromPatch, class ToPatch>
52 const FieldField<Field, scalar>&
53 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
54 {
55  if (!pointWeightsPtr_)
56  {
57  calcPointAddressing();
58  }
59 
60  return *pointWeightsPtr_;
61 }
62 
63 
64 template<class FromPatch, class ToPatch>
65 const labelList&
66 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
67 {
68  if (!faceAddressingPtr_)
69  {
70  calcFaceAddressing();
71  }
72 
73  return *faceAddressingPtr_;
74 }
75 
76 
77 template<class FromPatch, class ToPatch>
78 const FieldField<Field, scalar>&
79 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
80 {
81  if (!faceWeightsPtr_)
82  {
83  calcFaceAddressing();
84  }
85 
86  return *faceWeightsPtr_;
87 }
88 
89 
90 template<class FromPatch, class ToPatch>
91 void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
92 {
93  pointAddressingPtr_.reset(nullptr);
94  pointWeightsPtr_.reset(nullptr);
95  pointDistancePtr_.reset(nullptr);
96  faceAddressingPtr_.reset(nullptr);
97  faceWeightsPtr_.reset(nullptr);
98  faceDistancePtr_.reset(nullptr);
99 }
100 
101 
102 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
103 
104 template<class FromPatch, class ToPatch>
106 (
107  const FromPatch& fromPatch,
108  const ToPatch& toPatch,
110  const intersection::direction dir
111 )
112 :
113  fromPatch_(fromPatch),
114  toPatch_(toPatch),
115  alg_(alg),
116  dir_(dir),
117  pointAddressingPtr_(nullptr),
118  pointWeightsPtr_(nullptr),
119  pointDistancePtr_(nullptr),
120  faceAddressingPtr_(nullptr),
121  faceWeightsPtr_(nullptr),
122  faceDistancePtr_(nullptr)
123 {}
124 
125 
126 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
127 
128 template<class FromPatch, class ToPatch>
130 {
131  clearOut();
132 }
134 
135 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136 
137 template<class FromPatch, class ToPatch>
138 const scalarField&
141 {
142  if (!pointDistancePtr_)
143  {
144  calcPointAddressing();
145  }
146 
147  return *pointDistancePtr_;
148 }
149 
150 
151 template<class FromPatch, class ToPatch>
152 const scalarField&
155 {
156  if (!faceDistancePtr_)
157  {
158  calcFaceAddressing();
159  }
160 
161  return *faceDistancePtr_;
162 }
163 
164 
165 template<class FromPatch, class ToPatch>
167 {
168  clearOut();
169 
170  return true;
171 }
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180  #include "CalcPatchToPatchWeights.C"
181  #include "PatchToPatchInterpolate.C"
182 
183 // ************************************************************************* //
const scalarField & faceDistanceToIntersection() const
Return distance to intersection for patch face centres.
const scalarField & pointDistanceToIntersection() const
Return distance to intersection for patch points.
bool movePoints()
Correct weighting factors for moving mesh.
Patch to patch interpolation functions.
List< label > labelList
A List of labels.
Definition: List.H:62
Interpolation class dealing with transfer of data between two primitivePatches.
Namespace for OpenFOAM.