1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Interpolation class dealing with transfer of data between two
28 \*---------------------------------------------------------------------------*/
30 #include "PatchToPatchInterpolationTemplate.H"
31 #include "demandDrivenData.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 template<class FromPatch, class ToPatch>
41 const Foam::debug::tolerancesSwitch
42 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol_
44 "patchToPatchDirectHit",
48 template<class FromPatch, class ToPatch>
49 const Foam::debug::tolerancesSwitch
50 PatchToPatchInterpolation<FromPatch, ToPatch>::projectionTol_
52 "patchToPatchProjectionTol",
56 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
58 template<class FromPatch, class ToPatch>
59 void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
61 deleteDemandDrivenData(pointAddressingPtr_);
62 deleteDemandDrivenData(pointWeightsPtr_);
63 deleteDemandDrivenData(pointDistancePtr_);
64 deleteDemandDrivenData(faceAddressingPtr_);
65 deleteDemandDrivenData(faceWeightsPtr_);
66 deleteDemandDrivenData(faceDistancePtr_);
70 template<class FromPatch, class ToPatch>
71 void PatchToPatchInterpolation<FromPatch, ToPatch>::setWeights
74 FieldField<Field, scalar>* pwPtr,
77 FieldField<Field, scalar>* fwPtr,
83 pointAddressingPtr_ = paPtr;
84 pointWeightsPtr_ = pwPtr;
85 pointDistancePtr_ = pdPtr;
86 faceAddressingPtr_ = faPtr;;
87 faceWeightsPtr_ = fwPtr;
88 faceDistancePtr_ = fdPtr;;
92 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
94 // Construct from components
95 template<class FromPatch, class ToPatch>
96 PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
98 const FromPatch& fromPatch,
99 const ToPatch& toPatch,
100 intersection::algorithm alg,
101 const intersection::direction dir
104 fromPatch_(fromPatch),
108 pointAddressingPtr_(NULL),
109 pointWeightsPtr_(NULL),
110 pointDistancePtr_(NULL),
111 faceAddressingPtr_(NULL),
112 faceWeightsPtr_(NULL),
113 faceDistancePtr_(NULL)
119 template<class FromPatch, class ToPatch>
120 PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
122 const PatchToPatchInterpolation<FromPatch, ToPatch>& ppi
125 PatchToPatchInterpolationName(),
126 fromPatch_(ppi.fromPatch_),
127 toPatch_(ppi.toPatch_),
130 pointAddressingPtr_(NULL),
131 pointWeightsPtr_(NULL),
132 pointDistancePtr_(NULL),
133 faceAddressingPtr_(NULL),
134 faceWeightsPtr_(NULL),
135 faceDistancePtr_(NULL)
139 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
141 template<class FromPatch, class ToPatch>
142 PatchToPatchInterpolation<FromPatch, ToPatch>::~PatchToPatchInterpolation()
148 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
150 template<class FromPatch, class ToPatch>
152 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
154 if (!pointAddressingPtr_)
156 calcPointAddressing();
159 return *pointAddressingPtr_;
163 template<class FromPatch, class ToPatch>
164 const FieldField<Field, scalar>&
165 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
167 if (!pointWeightsPtr_)
169 calcPointAddressing();
172 return *pointWeightsPtr_;
176 template<class FromPatch, class ToPatch>
178 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
180 if (!faceAddressingPtr_)
182 calcFaceAddressing();
185 return *faceAddressingPtr_;
189 template<class FromPatch, class ToPatch>
190 const FieldField<Field, scalar>&
191 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
193 if (!faceWeightsPtr_)
195 calcFaceAddressing();
198 return *faceWeightsPtr_;
202 template<class FromPatch, class ToPatch>
204 PatchToPatchInterpolation<FromPatch, ToPatch>
205 ::pointDistanceToIntersection() const
207 if (!pointDistancePtr_)
209 calcPointAddressing();
212 return *pointDistancePtr_;
216 template<class FromPatch, class ToPatch>
218 PatchToPatchInterpolation<FromPatch, ToPatch>
219 ::faceDistanceToIntersection() const
221 if (!faceDistancePtr_)
223 calcFaceAddressing();
226 return *faceDistancePtr_;
230 template<class FromPatch, class ToPatch>
231 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 } // End namespace Foam
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 # include "CalcPatchToPatchWeights.C"
246 # include "PatchToPatchInterpolate.C"
248 // ************************************************************************* //