mappedPatchFieldBase.H
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) 2013-2016 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 Class
25  Foam::mappedPatchFieldBase
26 
27 Description
28  Functionality for sampling fields using mappedPatchBase. Every call to
29  mappedField() returns a sampled field, optionally scaled to maintain an
30  area-weighted average.
31 
32  Example usage:
33 
34  {
35  fieldName T; // default is same as fvPatchField
36  setAverage false;
37  average 1.0; // only if setAverage=true
38  interpolationScheme cellPoint; // default is cell
39  }
40 
41 SourceFiles
42  mappedPatchFieldBase.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef mappedPatchFieldBase_H
47 #define mappedPatchFieldBase_H
48 
50 #include "volFieldsFwd.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
58 template<class> class interpolation;
59 
60 /*---------------------------------------------------------------------------*\
61  Class mappedPatchFieldBase Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Type>
66 {
67 
68 protected:
69 
70  // Protected data
71 
72  //- Mapping engine
73  const mappedPatchBase& mapper_;
74 
75  //- Underlying patch field
77 
78  //- Name of field to sample
80 
81  //- If true adjust the mapped field to maintain average value average_
82  const bool setAverage_;
83 
84  //- Average value the mapped field is adjusted to maintain if
85  // setAverage_ is set true
86  const Type average_;
87 
88  //- Interpolation scheme to use for nearestcell mode
90 
91 
92 public:
93 
94  // Constructors
95 
96  //- Construct from components
98  (
99  const mappedPatchBase& mapper,
100  const fvPatchField<Type>& patchField,
101  const word& fieldName,
102  const bool setAverage,
103  const Type average,
104  const word& interpolationScheme
105  );
106 
107  //- Construct from dictionary
109  (
110  const mappedPatchBase& mapper,
111  const fvPatchField<Type>& patchField,
112  const dictionary& dict
113  );
114 
115  //- Construct empty
117  (
118  const mappedPatchBase& mapper,
119  const fvPatchField<Type>& patchField
120  );
121 
122  //- Construct copy
124  (
125  const mappedPatchFieldBase<Type>& mapper
126  );
127 
128  //- Construct copy, resetting patch and field
130  (
131  const mappedPatchBase& mapper,
132  const fvPatchField<Type>& patchField,
133  const mappedPatchFieldBase<Type>& base
134  );
135 
136 
137  //- Destructor
138  virtual ~mappedPatchFieldBase<Type>()
139  {}
140 
141 
142  // Member functions
143 
144  //- Field to sample. Either on my or nbr mesh
146 
147  //- Map sampleField onto *this patch
148  virtual tmp<Field<Type>> mappedField() const;
149 
150  //- Write
151  virtual void write(Ostream&) const;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #ifdef NoRepository
162  #include "mappedPatchFieldBase.C"
163 #endif
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
dictionary dict
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
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.
const mappedPatchBase & mapper_
Mapping engine.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
Generic GeometricField class.
const bool setAverage_
If true adjust the mapped field to maintain average value average_.
A class for handling words, derived from string.
Definition: word.H:59
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
Determines a mapping between patch face centres and mesh cell or face centres and processors they&#39;re ...
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
const Type average_
Average value the mapped field is adjusted to maintain if.
const fvPatchField< Type > & patchField_
Underlying patch field.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
mappedPatchFieldBase(const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme)
Construct from components.
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
virtual tmp< Field< Type > > mappedField() const
Map sampleField onto *this patch.
Abstract base class for interpolation.
word fieldName_
Name of field to sample.
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.