Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / directMappedField / directMappedFieldFvPatchField.H
blob27e316034359e75e6092c3d01ee9b1de17146d7d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2010-2011 OpenCFD Ltd.
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 Class
25     Foam::directMappedFieldFvPatchField
27 Description
28     Self-contained version of directMapped. Does not use information on
29     patch, instead holds it locally (and possibly duplicate) so use
30     normal directMapped in preference and only use this if you cannot
31     change the underlying patch type to directMapped.
33 SourceFiles
34     directMappedFieldFvPatchField.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef directMappedFieldFvPatchField_H
39 #define directMappedFieldFvPatchField_H
41 #include "directMappedPatchBase.H"
42 #include "fixedValueFvPatchFields.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 /*---------------------------------------------------------------------------*\
50                Class directMappedFieldFvPatchField Declaration
51 \*---------------------------------------------------------------------------*/
53 template<class Type>
54 class directMappedFieldFvPatchField
56     public directMappedPatchBase,
57     public fixedValueFvPatchField<Type>
59     // Private data
61         //- Name of field to sample - defaults to field associated with this
62         //  patchField if not specified
63         word fieldName_;
65         //- If true adjust the mapped field to maintain average value average_
66         const bool setAverage_;
68         //- Average value the mapped field is adjusted to maintain if
69         //  setAverage_ is set true
70         const Type average_;
73     // Private Member Functions
75         //- Field to sample. Either on my or nbr mesh
76         const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
79 public:
81     //- Runtime type information
82     TypeName("directMappedField");
85     // Constructors
87         //- Construct from patch and internal field
88         directMappedFieldFvPatchField
89         (
90             const fvPatch&,
91             const DimensionedField<Type, volMesh>&
92         );
94         //- Construct from patch, internal field and dictionary
95         directMappedFieldFvPatchField
96         (
97             const fvPatch&,
98             const DimensionedField<Type, volMesh>&,
99             const dictionary&
100         );
102         //- Construct from patch, internal field and distance for normal type
103         //  sampling
104         directMappedFieldFvPatchField
105         (
106             const fvPatch&,
107             const DimensionedField<Type, volMesh>&,
109             // directMappedPatchBase
110             const word& sampleRegion,
111             const sampleMode sampleMode,
112             const word& samplePatch,
113             const scalar distance,
115             // My settings
116             const word& fieldName,
117             const bool setAverage,
118             const Type average
119         );
121         //- Construct by mapping given
122         //  directMappedFieldFvPatchField
123         //  onto a new patch
124         directMappedFieldFvPatchField
125         (
126             const directMappedFieldFvPatchField<Type>&,
127             const fvPatch&,
128             const DimensionedField<Type, volMesh>&,
129             const fvPatchFieldMapper&
130         );
132         //- Construct as copy
133         directMappedFieldFvPatchField
134         (
135             const directMappedFieldFvPatchField<Type>&
136         );
138         //- Construct and return a clone
139         virtual tmp<fvPatchField<Type> > clone() const
140         {
141             return tmp<fvPatchField<Type> >
142             (
143                 new directMappedFieldFvPatchField<Type>
144                 (
145                     *this
146                 )
147             );
148         }
150         //- Construct as copy setting internal field reference
151         directMappedFieldFvPatchField
152         (
153             const directMappedFieldFvPatchField<Type>&,
154             const DimensionedField<Type, volMesh>&
155         );
157         //- Construct and return a clone setting internal field reference
158         virtual tmp<fvPatchField<Type> > clone
159         (
160             const DimensionedField<Type, volMesh>& iF
161         ) const
162         {
163             return tmp<fvPatchField<Type> >
164             (
165                 new directMappedFieldFvPatchField<Type>
166                 (
167                     *this,
168                     iF
169                 )
170             );
171         }
174     // Member functions
176         // Evaluation functions
178             //- Update the coefficients associated with the patch field
179             virtual void updateCoeffs();
182         //- Write
183         virtual void write(Ostream&) const;
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 } // End namespace Foam
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 #ifdef NoRepository
194 #   include "directMappedFieldFvPatchField.C"
195 #endif
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 #endif
201 // ************************************************************************* //