initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / fields / pointPatchFields / basic / mixed / mixedPointPatchField.H
blob812c7d07b187c138951b50d66d139557f2d927bf
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::mixedPointPatchField
28 Description
29     A mixed FixedValue / ZeroGradient boundary condition for pointField.
31     I am still not sure how to do the FixedValue-fixedGradient combination.
33 SourceFiles
34     mixedPointPatchField.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef mixedPointPatchField_H
39 #define mixedPointPatchField_H
41 #include "valuePointPatchField.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                       Class mixedPointPatchField Declaration
50 \*---------------------------------------------------------------------------*/
52 template<class Type>
53 class mixedPointPatchField
55     public valuePointPatchField<Type>
57     // Private data
59         //- Value field
60         Field<Type> refValue_;
62         //- Fraction (0-1) of value used for boundary condition
63         scalarField valueFraction_;
66     // Private member functions
68         void checkFieldSize() const;
71 public:
73     //- Runtime type information
74     TypeName("mixed");
77     // Constructors
79         //- Construct from patch and internal field
80         mixedPointPatchField
81         (
82             const pointPatch&,
83             const DimensionedField<Type, pointMesh>&
84         );
86         //- Construct from patch, internal field and dictionary
87         mixedPointPatchField
88         (
89             const pointPatch&,
90             const DimensionedField<Type, pointMesh>&,
91             const dictionary&
92         );
94         //- Construct by mapping given patchField<Type> onto a new patch
95         mixedPointPatchField
96         (
97             const mixedPointPatchField<Type>&,
98             const pointPatch&,
99             const DimensionedField<Type, pointMesh>&,
100             const pointPatchFieldMapper&
101         );
103         //- Construct and return a clone
104         virtual autoPtr<pointPatchField<Type> > clone() const
105         {
106             return autoPtr<pointPatchField<Type> >
107             (
108                 new mixedPointPatchField<Type>
109                 (
110                     *this
111                 )
112             );
113         }
115         //- Construct as copy setting internal field reference
116         mixedPointPatchField
117         (
118             const mixedPointPatchField<Type>&,
119             const DimensionedField<Type, pointMesh>&
120         );
122         //- Construct and return a clone setting internal field reference
123         virtual autoPtr<pointPatchField<Type> > clone
124         (
125             const DimensionedField<Type, pointMesh>& iF
126         ) const
127         {
128             return autoPtr<pointPatchField<Type> >
129             (
130                 new mixedPointPatchField<Type>
131                 (
132                     *this,
133                     iF
134                 )
135             );
136         }
139     // Member functions
141         // Return defining fields
143             virtual Field<Type>& refValue()
144             {
145                 return refValue_;
146             }
148             virtual const Field<Type>& refValue() const
149             {
150                 return refValue_;
151             }
153             virtual scalarField& valueFraction()
154             {
155                 return valueFraction_;
156             }
158             virtual const scalarField& valueFraction() const
159             {
160                 return valueFraction_;
161             }
164         // Mapping functions
166             //- Map (and resize as needed) from self given a mapping object
167             virtual void autoMap
168             (
169                 const pointPatchFieldMapper&
170             );
172             //- Reverse map the given PointPatchField onto
173             //  this PointPatchField
174             virtual void rmap
175             (
176                 const pointPatchField<Type>&,
177                 const labelList&
178             );
181         // Evaluation functions
183             //- Update the patch field
184             virtual void evaluate
185             (
186                 const Pstream::commsTypes commsType=Pstream::blocking
187             );
190         //- Write
191         virtual void write(Ostream&) const;
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 } // End namespace Foam
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 #ifdef NoRepository
202 #    include "mixedPointPatchField.C"
203 #endif
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 #endif
209 // ************************************************************************* //