intersection with triangle plane for miss
[OpenFOAM-1.5.x.git] / src / OpenFOAM / interpolations / patchToPatchInterpolation / PatchToPatchInterpolation.C
blobbcba9c90ad81c4daf24db88516a1a18499adeb6b
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 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
19     for more details.
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
25 Description
26     Interpolation class dealing with transfer of data between two
27     primitivePatches
29 \*---------------------------------------------------------------------------*/
31 #include "PatchToPatchInterpolation.H"
32 #include "demandDrivenData.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 namespace Foam
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 template<class FromPatch, class ToPatch>
42 const scalar
43 PatchToPatchInterpolation<FromPatch, ToPatch>::directHitTol = 1e-5;
45 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
47 template<class FromPatch, class ToPatch>
48 const labelList&
49 PatchToPatchInterpolation<FromPatch, ToPatch>::pointAddr() const
51     if (!pointAddressingPtr_)
52     {
53         calcPointAddressing();
54     }
56     return *pointAddressingPtr_;
60 template<class FromPatch, class ToPatch>
61 const FieldField<Field, scalar>&
62 PatchToPatchInterpolation<FromPatch, ToPatch>::pointWeights() const
64     if (!pointWeightsPtr_)
65     {
66         calcPointAddressing();
67     }
69     return *pointWeightsPtr_;
73 template<class FromPatch, class ToPatch>
74 const labelList&
75 PatchToPatchInterpolation<FromPatch, ToPatch>::faceAddr() const
77     if (!faceAddressingPtr_)
78     {
79         calcFaceAddressing();
80     }
82     return *faceAddressingPtr_;
86 template<class FromPatch, class ToPatch>
87 const FieldField<Field, scalar>&
88 PatchToPatchInterpolation<FromPatch, ToPatch>::faceWeights() const
90     if (!faceWeightsPtr_)
91     {
92         calcFaceAddressing();
93     }
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),
124     toPatch_(toPatch),
125     alg_(alg),
126     dir_(dir),
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()
141     clearOut();
145 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
147 template<class FromPatch, class ToPatch>
148 const scalarField&
149 PatchToPatchInterpolation<FromPatch, ToPatch>
150 ::pointDistanceToIntersection() const
152     if (!pointDistancePtr_)
153     {
154         calcPointAddressing();
155     }
157     return *pointDistancePtr_;
161 template<class FromPatch, class ToPatch>
162 const scalarField&
163 PatchToPatchInterpolation<FromPatch, ToPatch>
164 ::faceDistanceToIntersection() const
166     if (!faceDistancePtr_)
167     {
168         calcFaceAddressing();
169     }
171     return *faceDistancePtr_;
175 template<class FromPatch, class ToPatch>
176 bool PatchToPatchInterpolation<FromPatch, ToPatch>::movePoints()
178     clearOut();
180     return true;
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 } // End namespace Foam
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 #   include "CalcPatchToPatchWeights.C"
191 #   include "PatchToPatchInterpolate.C"
193 // ************************************************************************* //