PatchToPatchInterpolation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "demandDrivenData.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 template<class FromPatch, class ToPatch>
37 const scalar
39 
40 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
41 
42 template<class FromPatch, class ToPatch>
43 const labelList&
45 {
46  if (!pointAddressingPtr_)
47  {
48  calcPointAddressing();
49  }
50 
51  return *pointAddressingPtr_;
52 }
53 
54 
55 template<class FromPatch, class ToPatch>
58 {
59  if (!pointWeightsPtr_)
60  {
61  calcPointAddressing();
62  }
63 
64  return *pointWeightsPtr_;
65 }
66 
67 
68 template<class FromPatch, class ToPatch>
69 const labelList&
71 {
72  if (!faceAddressingPtr_)
73  {
74  calcFaceAddressing();
75  }
76 
77  return *faceAddressingPtr_;
78 }
79 
80 
81 template<class FromPatch, class ToPatch>
84 {
85  if (!faceWeightsPtr_)
86  {
87  calcFaceAddressing();
88  }
89 
90  return *faceWeightsPtr_;
91 }
92 
93 
94 template<class FromPatch, class ToPatch>
96 {
97  deleteDemandDrivenData(pointAddressingPtr_);
98  deleteDemandDrivenData(pointWeightsPtr_);
99  deleteDemandDrivenData(pointDistancePtr_);
100  deleteDemandDrivenData(faceAddressingPtr_);
101  deleteDemandDrivenData(faceWeightsPtr_);
102  deleteDemandDrivenData(faceDistancePtr_);
103 }
104 
105 
106 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
107 
108 // Construct from components
109 template<class FromPatch, class ToPatch>
111 (
112  const FromPatch& fromPatch,
113  const ToPatch& toPatch,
115  const intersection::direction dir
116 )
117 :
118  fromPatch_(fromPatch),
119  toPatch_(toPatch),
120  alg_(alg),
121  dir_(dir),
122  pointAddressingPtr_(NULL),
123  pointWeightsPtr_(NULL),
124  pointDistancePtr_(NULL),
125  faceAddressingPtr_(NULL),
126  faceWeightsPtr_(NULL),
127  faceDistancePtr_(NULL)
128 {}
129 
130 
131 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
132 
133 template<class FromPatch, class ToPatch>
135 {
136  clearOut();
137 }
138 
139 
140 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
141 
142 template<class FromPatch, class ToPatch>
143 const scalarField&
146 {
147  if (!pointDistancePtr_)
148  {
149  calcPointAddressing();
150  }
151 
152  return *pointDistancePtr_;
153 }
154 
155 
156 template<class FromPatch, class ToPatch>
157 const scalarField&
160 {
161  if (!faceDistancePtr_)
162  {
163  calcFaceAddressing();
164  }
165 
166  return *faceDistancePtr_;
167 }
168 
169 
170 template<class FromPatch, class ToPatch>
172 {
173  clearOut();
174 
175  return true;
176 }
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 # include "CalcPatchToPatchWeights.C"
186 # include "PatchToPatchInterpolate.C"
187 
188 // ************************************************************************* //
Foam::intersection::direction
direction
Definition: intersection.H:63
CalcPatchToPatchWeights.C
Foam::FieldField
Generic field type.
Definition: FieldField.H:51
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::PatchToPatchInterpolation::faceAddr
const labelList & faceAddr() const
Return reference to face addressing.
Definition: PatchToPatchInterpolation.C:70
Foam::PatchToPatchInterpolation::~PatchToPatchInterpolation
~PatchToPatchInterpolation()
Destructor.
Definition: PatchToPatchInterpolation.C:134
Foam::PatchToPatchInterpolation::directHitTol
static const scalar directHitTol
Direct hit tolerance.
Definition: PatchToPatchInterpolation.H:148
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::PatchToPatchInterpolation::faceDistanceToIntersection
const scalarField & faceDistanceToIntersection() const
Return distance to intersection for patch face centres.
Definition: PatchToPatchInterpolation.C:159
Foam::PatchToPatchInterpolation::pointAddr
const labelList & pointAddr() const
Return reference to point addressing.
Definition: PatchToPatchInterpolation.C:44
Foam::intersection::algorithm
algorithm
Definition: intersection.H:69
Foam::PatchToPatchInterpolation::faceWeights
const FieldField< Field, scalar > & faceWeights() const
Return reference to face weights.
Definition: PatchToPatchInterpolation.C:83
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::PatchToPatchInterpolation::pointWeights
const FieldField< Field, scalar > & pointWeights() const
Return reference to point weights.
Definition: PatchToPatchInterpolation.C:57
PatchToPatchInterpolate.C
Patch to patch interpolation functions.
Foam::PatchToPatchInterpolation::pointDistanceToIntersection
const scalarField & pointDistanceToIntersection() const
Return distance to intersection for patch points.
Definition: PatchToPatchInterpolation.C:145
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::PatchToPatchInterpolation::movePoints
bool movePoints()
Correct weighting factors for moving mesh.
Definition: PatchToPatchInterpolation.C:171
Foam::PatchToPatchInterpolation::PatchToPatchInterpolation
PatchToPatchInterpolation(const PatchToPatchInterpolation &)
Disallow default bitwise copy construct.
PatchToPatchInterpolation.H
Foam::PatchToPatchInterpolation::clearOut
void clearOut()
Clear all geometry and addressing.
Definition: PatchToPatchInterpolation.C:95