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 Foam::PatchToPatchInterpolation
28 Interpolation class dealing with transfer of data between two
32 PatchToPatchInterpolation.C
33 PatchToPatchInterpolate.C
34 CalcPatchToPatchWeights.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef PatchToPatchInterpolation_H
39 #define PatchToPatchInterpolation_H
41 #include "className.H"
42 #include "labelList.H"
43 #include "scalarField.H"
44 #include "pointField.H"
45 #include "FieldFields.H"
47 #include "intersection.H"
48 #include "tolerancesSwitch.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 /*---------------------------------------------------------------------------*\
56 Class PatchToPatchInterpolationName Declaration
57 \*---------------------------------------------------------------------------*/
59 TemplateName(PatchToPatchInterpolation);
62 /*---------------------------------------------------------------------------*\
63 Class PatchToPatchInterpolation Declaration
64 \*---------------------------------------------------------------------------*/
66 template<class FromPatch, class ToPatch>
67 class PatchToPatchInterpolation
69 public PatchToPatchInterpolationName
73 //- Reference to the source patch
74 const FromPatch& fromPatch_;
76 //- Reference to the target patch
77 const ToPatch& toPatch_;
79 //- Type of intersection algorithm to use in projection
80 intersection::algorithm alg_;
82 //- Direction projection to use in projection
83 intersection::direction dir_;
88 //- Relative merge tolerance for projected points missing the target
89 // Expressed as the fraction of min involved edge size
90 static const debug::tolerancesSwitch projectionTol_;
92 //- Direct hit tolerance
93 static const debug::tolerancesSwitch directHitTol_;
98 //- Face into which each point of target patch is projected
99 mutable labelList* pointAddressingPtr_;
101 //- Weighting factors
102 mutable FieldField<Field, scalar>* pointWeightsPtr_;
104 //- Distance to intersection for patch points
105 mutable scalarField* pointDistancePtr_;
110 //- Face into which each face centre of target patch is projected
111 mutable labelList* faceAddressingPtr_;
113 //- Weighting factors
114 mutable FieldField<Field, scalar>* faceWeightsPtr_;
116 //- Distance to intersection for patch face centres
117 mutable scalarField* faceDistancePtr_;
120 // Private Member Functions
122 //- Disallow default bitwise assignment
123 void operator=(const PatchToPatchInterpolation&);
125 //- Calculate point weights
126 void calcPointAddressing() const;
128 //- Calculate face weights
129 void calcFaceAddressing() const;
131 //- Clear all geometry and addressing
137 // Protected member functions
139 //- Set weights when read from file
143 FieldField<Field, scalar>* pwPtr,
146 FieldField<Field, scalar>* fwPtr,
155 //- Construct from components
156 PatchToPatchInterpolation
158 const FromPatch& fromPatch,
159 const ToPatch& toPatch,
160 const intersection::algorithm alg = intersection::FULL_RAY,
161 const intersection::direction dir = intersection::VECTOR
164 //- Construct as copy
165 PatchToPatchInterpolation
167 const PatchToPatchInterpolation<FromPatch, ToPatch>&
173 ~PatchToPatchInterpolation();
180 //- Return ype of intersection algorithm to use in projection
181 intersection::algorithm projectionAlgo() const
186 //- Return direction projection to use in projection
187 intersection::direction projectionDir() const
192 //- Return reference to point addressing
193 const labelList& pointAddr() const;
195 //- Return reference to point weights
196 const FieldField<Field, scalar>& pointWeights() const;
198 //- Return reference to face addressing
199 const labelList& faceAddr() const;
201 //- Return reference to face weights
202 const FieldField<Field, scalar>& faceWeights() const;
204 //- Return distance to intersection for patch points
205 const scalarField& pointDistanceToIntersection() const;
207 //- Return distance to intersection for patch face centres
208 const scalarField& faceDistanceToIntersection() const;
211 // Interpolation functions
213 //- Interpolate point field
215 tmp<Field<Type> > pointInterpolate(const Field<Type>& pf) const;
218 tmp<Field<Type> > pointInterpolate
220 const tmp<Field<Type> >& tpf
223 //- Interpolate face field
225 tmp<Field<Type> > faceInterpolate(const Field<Type>& pf) const;
228 tmp<Field<Type> > faceInterpolate
230 const tmp<Field<Type> >& tpf
236 //- Correct weighting factors for moving mesh.
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 } // End namespace Foam
246 # include "PatchToPatchInterpolationTemplate.C"
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 // ************************************************************************* //