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
29 Hrvoje Jasak, Wikki Ltd.
32 Martin Beaudoin, Hydro-Quebec, (2008)
34 \*---------------------------------------------------------------------------*/
36 #include "GGIInterpolationTemplate.H"
37 #include "demandDrivenData.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
46 template<class MasterPatch, class SlavePatch>
47 void GGIInterpolation<MasterPatch, SlavePatch>::clearOut()
49 deleteDemandDrivenData(masterAddrPtr_);
50 deleteDemandDrivenData(masterWeightsPtr_);
51 deleteDemandDrivenData(slaveAddrPtr_);
52 deleteDemandDrivenData(slaveWeightsPtr_);
54 deleteDemandDrivenData(uncoveredMasterAddrPtr_);
55 deleteDemandDrivenData(uncoveredSlaveAddrPtr_);
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
61 // Construct from components
62 template<class MasterPatch, class SlavePatch>
63 GGIInterpolation<MasterPatch, SlavePatch>::GGIInterpolation
65 const MasterPatch& masterPatch,
66 const SlavePatch& slavePatch,
67 const tensorField& forwardT,
68 const tensorField& reverseT,
69 const vectorField& forwardSep,
70 const scalar masterNonOverlapFaceTol,
71 const scalar slaveNonOverlapFaceTol,
72 const bool rescaleGGIWeightingFactors,
73 const quickReject reject
76 masterPatch_(masterPatch),
77 slavePatch_(slavePatch),
80 forwardSep_(forwardSep),
81 masterNonOverlapFaceTol_(masterNonOverlapFaceTol),
82 slaveNonOverlapFaceTol_(slaveNonOverlapFaceTol),
83 rescaleGGIWeightingFactors_(rescaleGGIWeightingFactors),
86 masterWeightsPtr_(NULL),
88 slaveWeightsPtr_(NULL),
89 uncoveredMasterAddrPtr_(NULL),
90 uncoveredSlaveAddrPtr_(NULL)
92 // Check size of transform. They should be equal to slave patch size
93 // if the transform is not constant
94 if (forwardT_.size() > 1 || reverseT_.size() > 1)
98 forwardT_.size() != slavePatch_.size()
99 || reverseT_.size() != masterPatch_.size()
104 "GGIInterpolation<MasterPatch, SlavePatch>::GGIInterpolation"
105 ) << "Incorrectly defined transform: forwardT: "
106 << forwardT_.size() << " patch: " << slavePatch_.size()
107 << " reverseT: " << reverseT_.size()
108 << " patch: " << masterPatch_.size()
109 << abort(FatalError);
115 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
117 template<class MasterPatch, class SlavePatch>
118 GGIInterpolation<MasterPatch, SlavePatch>::~GGIInterpolation()
124 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
126 template<class MasterPatch, class SlavePatch>
128 GGIInterpolation<MasterPatch, SlavePatch>::masterAddr() const
135 return *masterAddrPtr_;
139 template<class MasterPatch, class SlavePatch>
140 const scalarListList&
141 GGIInterpolation<MasterPatch, SlavePatch>::masterWeights() const
143 if (!masterWeightsPtr_)
148 return *masterWeightsPtr_;
152 template<class MasterPatch, class SlavePatch>
154 GGIInterpolation<MasterPatch, SlavePatch>::slaveAddr() const
161 return *slaveAddrPtr_;
165 template<class MasterPatch, class SlavePatch>
166 const scalarListList&
167 GGIInterpolation<MasterPatch, SlavePatch>::slaveWeights() const
169 if (!slaveWeightsPtr_)
174 return *slaveWeightsPtr_;
178 template<class MasterPatch, class SlavePatch>
180 GGIInterpolation<MasterPatch, SlavePatch>::uncoveredMasterFaces() const
182 if (!uncoveredMasterAddrPtr_)
187 return *uncoveredMasterAddrPtr_;
191 template<class MasterPatch, class SlavePatch>
193 GGIInterpolation<MasterPatch, SlavePatch>::uncoveredSlaveFaces() const
195 if (!uncoveredSlaveAddrPtr_)
200 return *uncoveredSlaveAddrPtr_;
204 template<class MasterPatch, class SlavePatch>
205 bool GGIInterpolation<MasterPatch, SlavePatch>::movePoints
207 const tensorField& forwardT,
208 const tensorField& reverseT,
209 const vectorField& forwardSep
212 this->forwardT_ = forwardT;
213 this->reverseT_ = reverseT;
214 this->forwardSep_ = forwardSep;
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 } // End namespace Foam
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 # include "GGIInterpolationPolygonIntersection.C"
229 # include "GGIInterpolationQuickRejectTests.C"
230 # include "GGIInterpolationWeights.C"
231 # include "GGIInterpolate.C"
233 // ************************************************************************* //