Report patch name instead of index in debug
[foam-extend-3.2.git] / src / foam / interpolations / patchToPatchInterpolation / PatchToPatchInterpolationTemplate.C
blob00e9b6ccab28a99cdba23e794967ac99a9782804
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Description
25     Interpolation class dealing with transfer of data between two
26     primitivePatches
28 \*---------------------------------------------------------------------------*/
30 #include "PatchToPatchInterpolationTemplate.H"
31 #include "demandDrivenData.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 template<class FromPatch, class ToPatch>
41 const Foam::debug::tolerancesSwitch
42 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol_
44     "patchToPatchDirectHit",
45     1e-5
48 template<class FromPatch, class ToPatch>
49 const Foam::debug::tolerancesSwitch
50 PatchToPatchInterpolation<FromPatch, ToPatch>::projectionTol_
52     "patchToPatchProjectionTol",
53     0.05
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
73     labelList* paPtr,
74     FieldField<Field, scalar>* pwPtr,
75     scalarField* pdPtr,
76     labelList* faPtr,
77     FieldField<Field, scalar>* fwPtr,
78     scalarField* fdPtr
81     clearOut();
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),
105     toPatch_(toPatch),
106     alg_(alg),
107     dir_(dir),
108     pointAddressingPtr_(NULL),
109     pointWeightsPtr_(NULL),
110     pointDistancePtr_(NULL),
111     faceAddressingPtr_(NULL),
112     faceWeightsPtr_(NULL),
113     faceDistancePtr_(NULL)
118 // Construct as copy
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_),
128     alg_(ppi.alg_),
129     dir_(ppi.dir_),
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()
144     clearOut();
148 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
150 template<class FromPatch, class ToPatch>
151 const labelList&
152 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
154     if (!pointAddressingPtr_)
155     {
156         calcPointAddressing();
157     }
159     return *pointAddressingPtr_;
163 template<class FromPatch, class ToPatch>
164 const FieldField<Field, scalar>&
165 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
167     if (!pointWeightsPtr_)
168     {
169         calcPointAddressing();
170     }
172     return *pointWeightsPtr_;
176 template<class FromPatch, class ToPatch>
177 const labelList&
178 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
180     if (!faceAddressingPtr_)
181     {
182         calcFaceAddressing();
183     }
185     return *faceAddressingPtr_;
189 template<class FromPatch, class ToPatch>
190 const FieldField<Field, scalar>&
191 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
193     if (!faceWeightsPtr_)
194     {
195         calcFaceAddressing();
196     }
198     return *faceWeightsPtr_;
202 template<class FromPatch, class ToPatch>
203 const scalarField&
204 PatchToPatchInterpolation<FromPatch, ToPatch>
205 ::pointDistanceToIntersection() const
207     if (!pointDistancePtr_)
208     {
209         calcPointAddressing();
210     }
212     return *pointDistancePtr_;
216 template<class FromPatch, class ToPatch>
217 const scalarField&
218 PatchToPatchInterpolation<FromPatch, ToPatch>
219 ::faceDistanceToIntersection() const
221     if (!faceDistancePtr_)
222     {
223         calcFaceAddressing();
224     }
226     return *faceDistancePtr_;
230 template<class FromPatch, class ToPatch>
231 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
233     clearOut();
235     return true;
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 } // End namespace Foam
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 #   include "CalcPatchToPatchWeights.C"
246 #   include "PatchToPatchInterpolate.C"
248 // ************************************************************************* //