BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / basic / fixedGradient / fixedGradientFvPatchField.C
blobdd10411a4f36e7637f10a087e4bb52f752459b91
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.
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 \*---------------------------------------------------------------------------*/
26 #include "fixedGradientFvPatchField.H"
27 #include "dictionary.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
34 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
36 template<class Type>
37 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
39     const fvPatch& p,
40     const DimensionedField<Type, volMesh>& iF
43     fvPatchField<Type>(p, iF),
44     gradient_(p.size(), pTraits<Type>::zero)
48 template<class Type>
49 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
51     const fixedGradientFvPatchField<Type>& ptf,
52     const fvPatch& p,
53     const DimensionedField<Type, volMesh>& iF,
54     const fvPatchFieldMapper& mapper
57     fvPatchField<Type>(ptf, p, iF, mapper),
58     gradient_(ptf.gradient_, mapper)
62 template<class Type>
63 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
65     const fvPatch& p,
66     const DimensionedField<Type, volMesh>& iF,
67     const dictionary& dict
70     fvPatchField<Type>(p, iF, dict),
71     gradient_("gradient", dict, p.size())
73     evaluate();
77 template<class Type>
78 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
80     const fixedGradientFvPatchField<Type>& ptf
83     fvPatchField<Type>(ptf),
84     gradient_(ptf.gradient_)
88 template<class Type>
89 fixedGradientFvPatchField<Type>::fixedGradientFvPatchField
91     const fixedGradientFvPatchField<Type>& ptf,
92     const DimensionedField<Type, volMesh>& iF
95     fvPatchField<Type>(ptf, iF),
96     gradient_(ptf.gradient_)
100 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
102 template<class Type>
103 void fixedGradientFvPatchField<Type>::autoMap
105     const fvPatchFieldMapper& m
108     fvPatchField<Type>::autoMap(m);
109     gradient_.autoMap(m);
113 template<class Type>
114 void fixedGradientFvPatchField<Type>::rmap
116     const fvPatchField<Type>& ptf,
117     const labelList& addr
120     fvPatchField<Type>::rmap(ptf, addr);
122     const fixedGradientFvPatchField<Type>& fgptf =
123         refCast<const fixedGradientFvPatchField<Type> >(ptf);
125     gradient_.rmap(fgptf.gradient_, addr);
129 template<class Type>
130 void fixedGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes)
132     if (!this->updated())
133     {
134         this->updateCoeffs();
135     }
137     Field<Type>::operator=
138     (
139         this->patchInternalField() + gradient_/this->patch().deltaCoeffs()
140     );
142     fvPatchField<Type>::evaluate();
146 template<class Type>
147 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueInternalCoeffs
149     const tmp<scalarField>&
150 ) const
152     return tmp<Field<Type> >(new Field<Type>(this->size(), pTraits<Type>::one));
156 template<class Type>
157 tmp<Field<Type> > fixedGradientFvPatchField<Type>::valueBoundaryCoeffs
159     const tmp<scalarField>&
160 ) const
162     return gradient()/this->patch().deltaCoeffs();
166 template<class Type>
167 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
168 gradientInternalCoeffs() const
170     return tmp<Field<Type> >
171     (
172         new Field<Type>(this->size(), pTraits<Type>::zero)
173     );
177 template<class Type>
178 tmp<Field<Type> > fixedGradientFvPatchField<Type>::
179 gradientBoundaryCoeffs() const
181     return gradient();
185 template<class Type>
186 void fixedGradientFvPatchField<Type>::write(Ostream& os) const
188     fvPatchField<Type>::write(os);
189     gradient_.writeEntry("gradient", os);
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // ************************************************************************* //