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 {}
118 
119 
120 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
121 
122 template<class FromPatch, class ToPatch>
124 {
125  clearOut();
126 }
128 
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
130 
131 template<class FromPatch, class ToPatch>
132 const scalarField&
135 {
136  if (!pointDistancePtr_)
137  {
138  calcPointAddressing();
139  }
140 
141  return *pointDistancePtr_;
142 }
143 
144 
145 template<class FromPatch, class ToPatch>
146 const scalarField&
149 {
150  if (!faceDistancePtr_)
151  {
152  calcFaceAddressing();
153  }
154 
155  return *faceDistancePtr_;
156 }
157 
158 
159 template<class FromPatch, class ToPatch>
161 {
162  clearOut();
163 
164  return true;
165 }
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174  #include "CalcPatchToPatchWeights.C"
175  #include "PatchToPatchInterpolate.C"
176 
177 // ************************************************************************* //
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:61
Interpolation class dealing with transfer of data between two primitivePatches.
Namespace for OpenFOAM.