FreeFOAM The Cross-Platform CFD Toolkit
cellMotionFvPatchField.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) 1991-2010 OpenCFD Ltd.
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 
26 #include "cellMotionFvPatchField.H"
27 #include <finiteVolume/fvMesh.H>
28 #include <finiteVolume/volMesh.H>
29 #include <OpenFOAM/pointFields.H>
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
38 template<class Type>
40 (
41  const fvPatch& p,
43 )
44 :
46 {}
47 
48 
49 template<class Type>
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  fixedValueFvPatchField<Type>(ptf, p, iF, mapper)
59 {}
60 
61 
62 template<class Type>
64 (
65  const fvPatch& p,
67  const dictionary& dict
68 )
69 :
71 {
72  fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
73 }
74 
75 
76 template<class Type>
78 (
80 )
81 :
83 {}
84 
85 
86 template<class Type>
88 (
91 )
92 :
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class Type>
101 {
102  if (this->updated())
103  {
104  return;
105  }
106 
107  const fvPatch& p = this->patch();
108  const polyPatch& pp = p.patch();
109  const fvMesh& mesh = this->dimensionedInternalField().mesh();
110  const pointField& points = mesh.points();
111 
112  word pfName = this->dimensionedInternalField().name();
113  pfName.replace("cell", "point");
114 
116  this->db().objectRegistry:: lookupObject<GeometricField<Type, pointPatchField, pointMesh> >
117  (
118  pfName
119  );
120 
121  forAll(p, i)
122  {
123  this->operator[](i) = pp[i].average(points, pointMotion);
124  }
125 
127 }
128 
129 
130 template<class Type>
132 {
134  this->writeEntry("value", os);
135 }
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // ************************ vim: set sw=4 sts=4 et: ************************ //
143