1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 Interpolation class dealing with transfer of data between two
28 \*---------------------------------------------------------------------------*/
30 #include "PatchToPatchInterpolation.H"
31 #include "demandDrivenData.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 template<class FromPatch, class ToPatch>
42 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46 template<class FromPatch, class ToPatch>
48 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
50 if (!pointAddressingPtr_)
52 calcPointAddressing();
55 return *pointAddressingPtr_;
59 template<class FromPatch, class ToPatch>
60 const FieldField<Field, scalar>&
61 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
63 if (!pointWeightsPtr_)
65 calcPointAddressing();
68 return *pointWeightsPtr_;
72 template<class FromPatch, class ToPatch>
74 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
76 if (!faceAddressingPtr_)
81 return *faceAddressingPtr_;
85 template<class FromPatch, class ToPatch>
86 const FieldField<Field, scalar>&
87 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
94 return *faceWeightsPtr_;
98 template<class FromPatch, class ToPatch>
99 void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
101 deleteDemandDrivenData(pointAddressingPtr_);
102 deleteDemandDrivenData(pointWeightsPtr_);
103 deleteDemandDrivenData(pointDistancePtr_);
104 deleteDemandDrivenData(faceAddressingPtr_);
105 deleteDemandDrivenData(faceWeightsPtr_);
106 deleteDemandDrivenData(faceDistancePtr_);
110 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
112 // Construct from components
113 template<class FromPatch, class ToPatch>
114 PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
116 const FromPatch& fromPatch,
117 const ToPatch& toPatch,
118 intersection::algorithm alg,
119 const intersection::direction dir
122 fromPatch_(fromPatch),
126 pointAddressingPtr_(NULL),
127 pointWeightsPtr_(NULL),
128 pointDistancePtr_(NULL),
129 faceAddressingPtr_(NULL),
130 faceWeightsPtr_(NULL),
131 faceDistancePtr_(NULL)
135 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
137 template<class FromPatch, class ToPatch>
138 PatchToPatchInterpolation<FromPatch, ToPatch>::~PatchToPatchInterpolation()
144 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
146 template<class FromPatch, class ToPatch>
148 PatchToPatchInterpolation<FromPatch, ToPatch>
149 ::pointDistanceToIntersection() const
151 if (!pointDistancePtr_)
153 calcPointAddressing();
156 return *pointDistancePtr_;
160 template<class FromPatch, class ToPatch>
162 PatchToPatchInterpolation<FromPatch, ToPatch>
163 ::faceDistanceToIntersection() const
165 if (!faceDistancePtr_)
167 calcFaceAddressing();
170 return *faceDistancePtr_;
174 template<class FromPatch, class ToPatch>
175 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 # include "CalcPatchToPatchWeights.C"
190 # include "PatchToPatchInterpolate.C"
192 // ************************************************************************* //