mappedFixedValueFvPatchField.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-2013 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 "mappedPatchBase.H"
28 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
37 template<class Type>
39 (
40  const fvPatch& p,
42 )
43 :
45  mappedPatchFieldBase<Type>(this->mapper(p, iF), *this)
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  mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, ptf)
60 {}
61 
62 
63 template<class Type>
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
72  mappedPatchFieldBase<Type>(this->mapper(p, iF), *this, dict)
73 {}
74 
75 
76 template<class Type>
78 (
80 )
81 :
84 {}
85 
86 
87 template<class Type>
89 (
92 )
93 :
95  mappedPatchFieldBase<Type>(this->mapper(this->patch(), iF), *this, ptf)
96 {}
97 
98 
99 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
100 
101 template<class Type>
103 (
104  const fvPatch& p,
106 )
107 {
108  if (!isA<mappedPatchBase>(p.patch()))
109  {
111  (
112  "mappedFixedValueFvPatchField<Type>::mapper()"
113  ) << "\n patch type '" << p.patch().type()
114  << "' not type '" << mappedPatchBase::typeName << "'"
115  << "\n for patch " << p.patch().name()
116  << " of field " << iF.name()
117  << " in file " << iF.objectPath()
118  << exit(FatalError);
119  }
120  return refCast<const mappedPatchBase>(p.patch());
121 }
122 
123 
124 template<class Type>
126 {
127  if (this->updated())
128  {
129  return;
130  }
131 
132  this->operator==(this->mappedField());
133 
134  if (debug)
135  {
136  Info<< "mapped on field:"
137  << this->dimensionedInternalField().name()
138  << " patch:" << this->patch().name()
139  << " avg:" << gAverage(*this)
140  << " min:" << gMin(*this)
141  << " max:" << gMax(*this)
142  << endl;
143  }
144 
146 }
147 
148 
149 template<class Type>
151 {
154  this->writeEntry("value", os);
155 }
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // ************************************************************************* //
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const word & name() const
Return name.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: fvPatchField.C:301
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::fvPatchFieldMapper.
messageStream Info
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:354
Namespace for OpenFOAM.
virtual void write(Ostream &) const
Write.
mappedFixedValueFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
const polyPatch & patch() const
Return the polyPatch.
Definition: fvPatch.H:143
dictionary dict
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
volScalarField & p
Definition: createFields.H:51
fileName objectPath() const
Return complete path + object name.
Definition: IOobject.H:363
virtual void write(Ostream &) const
Write.
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
const word & name() const
Return name.
Definition: IOobject.H:260
Type gMin(const FieldField< Field, Type > &f)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:314
rDeltaT dimensionedInternalField()
error FatalError
const mappedPatchBase & mapper(const fvPatch &p, const DimensionedField< Type, volMesh > &iF)
Type gAverage(const FieldField< Field, Type > &f)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
This boundary condition supplies a fixed value constraint, and is the base class for a number of othe...
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
This boundary condition maps the value at a set of cells or patch faces back to *this.
Type gMax(const FieldField< Field, Type > &f)