1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Interpolation class dealing with transfer of data between two
29 \*---------------------------------------------------------------------------*/
31 #include "PatchToPatchInterpolation.H"
32 #include "demandDrivenData.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 template<class FromPatch, class ToPatch>
43 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
45 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
47 template<class FromPatch, class ToPatch>
49 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
51 if (!pointAddressingPtr_)
53 calcPointAddressing();
56 return *pointAddressingPtr_;
60 template<class FromPatch, class ToPatch>
61 const FieldField<Field, scalar>&
62 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
64 if (!pointWeightsPtr_)
66 calcPointAddressing();
69 return *pointWeightsPtr_;
73 template<class FromPatch, class ToPatch>
75 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
77 if (!faceAddressingPtr_)
82 return *faceAddressingPtr_;
86 template<class FromPatch, class ToPatch>
87 const FieldField<Field, scalar>&
88 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
95 return *faceWeightsPtr_;
99 template<class FromPatch, class ToPatch>
100 void PatchToPatchInterpolation<FromPatch, ToPatch>::clearOut()
102 deleteDemandDrivenData(pointAddressingPtr_);
103 deleteDemandDrivenData(pointWeightsPtr_);
104 deleteDemandDrivenData(pointDistancePtr_);
105 deleteDemandDrivenData(faceAddressingPtr_);
106 deleteDemandDrivenData(faceWeightsPtr_);
107 deleteDemandDrivenData(faceDistancePtr_);
111 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
113 // Construct from components
114 template<class FromPatch, class ToPatch>
115 PatchToPatchInterpolation<FromPatch, ToPatch>::PatchToPatchInterpolation
117 const FromPatch& fromPatch,
118 const ToPatch& toPatch,
119 intersection::algorithm alg,
120 const intersection::direction dir
123 fromPatch_(fromPatch),
127 pointAddressingPtr_(NULL),
128 pointWeightsPtr_(NULL),
129 pointDistancePtr_(NULL),
130 faceAddressingPtr_(NULL),
131 faceWeightsPtr_(NULL),
132 faceDistancePtr_(NULL)
136 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
138 template<class FromPatch, class ToPatch>
139 PatchToPatchInterpolation<FromPatch, ToPatch>::~PatchToPatchInterpolation()
145 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
147 template<class FromPatch, class ToPatch>
149 PatchToPatchInterpolation<FromPatch, ToPatch>
150 ::pointDistanceToIntersection() const
152 if (!pointDistancePtr_)
154 calcPointAddressing();
157 return *pointDistancePtr_;
161 template<class FromPatch, class ToPatch>
163 PatchToPatchInterpolation<FromPatch, ToPatch>
164 ::faceDistanceToIntersection() const
166 if (!faceDistancePtr_)
168 calcFaceAddressing();
171 return *faceDistancePtr_;
175 template<class FromPatch, class ToPatch>
176 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 # include "CalcPatchToPatchWeights.C"
191 # include "PatchToPatchInterpolate.C"
193 // ************************************************************************* //