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 Mixing plane class dealing with transfer of data between two
29 Martin Beaudoin, Hydro-Quebec, 2009. All rights reserved
32 Hrvoje Jasak, Wikki Ltd.
34 \*---------------------------------------------------------------------------*/
36 #include "MixingPlaneInterpolationTemplate.H"
37 #include "demandDrivenData.H"
38 #include "PrimitivePatchTemplate.H"
40 #include "transform.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
49 template<class MasterPatch, class SlavePatch>
51 MixingPlaneInterpolation<MasterPatch, SlavePatch>::sweepAxisSwitch() const
54 switch (sweepAxisType_)
80 "direction MixingPlaneInterpolation<MasterPatch, "
81 "SlavePatch>::sweepAxisSwitch() const"
82 ) << "Bad sweepAxis type: "
83 << MixingPlaneInterpolationName::sweepAxisNames_
85 << "Available types: "
86 << MixingPlaneInterpolationName::sweepAxisNames_
96 template<class MasterPatch, class SlavePatch>
98 MixingPlaneInterpolation<MasterPatch, SlavePatch>::stackAxisSwitch() const
101 switch (stackAxisType_)
127 "direction MixingPlaneInterpolation<MasterPatch, "
128 "SlavePatch>::stackAxisSwitch() const"
129 ) << "Bad stackAxis type: "
130 << MixingPlaneInterpolationName::stackAxisNames_
132 << "Available types: "
133 << MixingPlaneInterpolationName::stackAxisNames_
134 << abort(FatalError);
143 template<class MasterPatch, class SlavePatch>
144 void MixingPlaneInterpolation<MasterPatch, SlavePatch>::clearOut()
146 clearTransfomedPatches();
147 clearMixingPlanePatch();
154 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
156 template<class MasterPatch, class SlavePatch>
157 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
158 MixingPlaneInterpolation
160 const MasterPatch& masterPatch,
161 const SlavePatch& slavePatch,
162 const coordinateSystem& cs,
163 const MixingPlaneInterpolationName::discretisation& discretisationType,
164 const MixingPlaneInterpolationName::sweepAxis& sweepAxisType,
165 const MixingPlaneInterpolationName::stackAxis& stackAxisType,
166 const pointField& interpolationProfile
169 masterPatch_(masterPatch),
170 slavePatch_(slavePatch),
172 discretisationType_(discretisationType),
173 sweepAxisType_(sweepAxisType),
174 stackAxisType_(stackAxisType),
175 interpolationProfile_(interpolationProfile),
181 transformedMasterPatchPtr_(NULL),
182 transformedShadowPatchPtr_(NULL),
183 mixingPlanePatchPtr_(NULL),
185 masterPatchToProfileTPtr_(NULL),
186 masterProfileToPatchTPtr_(NULL),
187 slavePatchToProfileTPtr_(NULL),
188 slaveProfileToPatchTPtr_(NULL),
190 masterPatchToProfileAddrPtr_(NULL),
191 masterProfileToPatchAddrPtr_(NULL),
192 masterPatchToProfileWeightsPtr_(NULL),
193 masterProfileToPatchWeightsPtr_(NULL),
195 slavePatchToProfileAddrPtr_(NULL),
196 slaveProfileToPatchAddrPtr_(NULL),
197 slavePatchToProfileWeightsPtr_(NULL),
198 slaveProfileToPatchWeightsPtr_(NULL)
201 // Check size of transform. They should be equal to slave patch size
202 // if the transform is not constant
203 if (forwardT_.size() > 1 || reverseT_.size() > 1)
207 forwardT_.size() != slavePatch_.size()
208 || reverseT_.size() != masterPatch_.size()
213 "MixingPlaneInterpolation<MasterPatch, "
214 "SlavePatch>::MixingPlaneInterpolation"
215 ) << "Incorrectly defined transform: forwardT: "
216 << forwardT_.size() << " patch: " << slavePatch_.size()
217 << " reverseT: " << reverseT_.size()
218 << " patch: " << masterPatch_.size()
219 << abort(FatalError);
223 masterPatchToProfileAddr();
227 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
229 template<class MasterPatch, class SlavePatch>
230 MixingPlaneInterpolation<MasterPatch, SlavePatch>::~MixingPlaneInterpolation()
236 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
238 template<class MasterPatch, class SlavePatch>
239 const Foam::standAlonePatch&
240 MixingPlaneInterpolation<MasterPatch, SlavePatch>::mixingPlanePatch() const
242 if (!mixingPlanePatchPtr_)
244 calcMixingPlanePatch();
247 return *mixingPlanePatchPtr_;
251 template<class MasterPatch, class SlavePatch>
252 const Foam::standAlonePatch&
253 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
254 transformedMasterPatch() const
256 if (!transformedMasterPatchPtr_)
258 calcTransformedPatches();
261 return *transformedMasterPatchPtr_;
265 template<class MasterPatch, class SlavePatch>
266 const Foam::standAlonePatch&
267 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
268 transformedShadowPatch() const
270 if (!transformedShadowPatchPtr_)
272 calcTransformedPatches();
275 return *transformedShadowPatchPtr_;
279 template<class MasterPatch, class SlavePatch>
281 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
282 masterPatchToProfileAddr() const
284 if (!masterPatchToProfileAddrPtr_)
289 return *masterPatchToProfileAddrPtr_;
293 template<class MasterPatch, class SlavePatch>
295 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
296 masterProfileToPatchAddr() const
298 if (!masterProfileToPatchAddrPtr_)
303 return *masterProfileToPatchAddrPtr_;
307 template<class MasterPatch, class SlavePatch>
308 const scalarListList&
309 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
310 masterPatchToProfileWeights() const
312 if (!masterPatchToProfileWeightsPtr_)
317 return *masterPatchToProfileWeightsPtr_;
321 template<class MasterPatch, class SlavePatch>
322 const scalarListList&
323 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
324 masterProfileToPatchWeights() const
326 if (!masterProfileToPatchWeightsPtr_)
331 return *masterProfileToPatchWeightsPtr_;
335 template<class MasterPatch, class SlavePatch>
337 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
338 slavePatchToProfileAddr() const
340 if (!slavePatchToProfileAddrPtr_)
345 return *slavePatchToProfileAddrPtr_;
349 template<class MasterPatch, class SlavePatch>
351 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
352 slaveProfileToPatchAddr() const
354 if (!slaveProfileToPatchAddrPtr_)
359 return *slaveProfileToPatchAddrPtr_;
363 template<class MasterPatch, class SlavePatch>
364 const scalarListList&
365 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
366 slavePatchToProfileWeights() const
368 if (!slavePatchToProfileWeightsPtr_)
373 return *slavePatchToProfileWeightsPtr_;
377 template<class MasterPatch, class SlavePatch>
378 const scalarListList&
379 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
380 slaveProfileToPatchWeights() const
382 if (!slaveProfileToPatchWeightsPtr_)
387 return *slaveProfileToPatchWeightsPtr_;
391 template<class MasterPatch, class SlavePatch>
393 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
394 masterPatchToProfileT() const
396 if (!masterPatchToProfileTPtr_)
401 return *masterPatchToProfileTPtr_;
405 template<class MasterPatch, class SlavePatch>
407 MixingPlaneInterpolation<MasterPatch, SlavePatch>::
408 masterProfileToPatchT() const
410 if (!masterProfileToPatchTPtr_)
415 return *masterProfileToPatchTPtr_;
419 template<class MasterPatch, class SlavePatch>
421 MixingPlaneInterpolation<MasterPatch, SlavePatch>::slavePatchToProfileT() const
423 if (!slavePatchToProfileTPtr_)
428 return *slavePatchToProfileTPtr_;
432 template<class MasterPatch, class SlavePatch>
434 MixingPlaneInterpolation<MasterPatch, SlavePatch>::slaveProfileToPatchT() const
436 if (!slaveProfileToPatchTPtr_)
441 return *slaveProfileToPatchTPtr_;
445 template<class MasterPatch, class SlavePatch>
446 bool MixingPlaneInterpolation<MasterPatch, SlavePatch>::movePoints()
454 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
456 } // End namespace Foam
458 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
461 // ************************************************************************* //