BUG: hierarchGeomDecomp, slidingInterface: mixing label and scalar
[OpenFOAM-1.7.x.git] / src / OpenFOAM / interpolations / patchToPatchInterpolation / PatchToPatchInterpolation.C
blobb37a614debfeac4180d1338128052e6fb935e1f9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Description
25     Interpolation class dealing with transfer of data between two
26     primitivePatches
28 \*---------------------------------------------------------------------------*/
30 #include "PatchToPatchInterpolation.H"
31 #include "demandDrivenData.H"
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 namespace Foam
38 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40 template<class FromPatch, class ToPatch>
41 const scalar
42 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
44 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
46 template<class FromPatch, class ToPatch>
47 const labelList&
48 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
50     if (!pointAddressingPtr_)
51     {
52         calcPointAddressing();
53     }
55     return *pointAddressingPtr_;
59 template<class FromPatch, class ToPatch>
60 const FieldField<Field, scalar>&
61 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
63     if (!pointWeightsPtr_)
64     {
65         calcPointAddressing();
66     }
68     return *pointWeightsPtr_;
72 template<class FromPatch, class ToPatch>
73 const labelList&
74 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
76     if (!faceAddressingPtr_)
77     {
78         calcFaceAddressing();
79     }
81     return *faceAddressingPtr_;
85 template<class FromPatch, class ToPatch>
86 const FieldField<Field, scalar>&
87 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
89     if (!faceWeightsPtr_)
90     {
91         calcFaceAddressing();
92     }
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),
123     toPatch_(toPatch),
124     alg_(alg),
125     dir_(dir),
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()
140     clearOut();
144 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
146 template<class FromPatch, class ToPatch>
147 const scalarField&
148 PatchToPatchInterpolation<FromPatch, ToPatch>
149 ::pointDistanceToIntersection() const
151     if (!pointDistancePtr_)
152     {
153         calcPointAddressing();
154     }
156     return *pointDistancePtr_;
160 template<class FromPatch, class ToPatch>
161 const scalarField&
162 PatchToPatchInterpolation<FromPatch, ToPatch>
163 ::faceDistanceToIntersection() const
165     if (!faceDistancePtr_)
166     {
167         calcFaceAddressing();
168     }
170     return *faceDistancePtr_;
174 template<class FromPatch, class ToPatch>
175 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
177     clearOut();
179     return true;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 #   include "CalcPatchToPatchWeights.C"
190 #   include "PatchToPatchInterpolate.C"
192 // ************************************************************************* //