Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / finiteVolume / fields / fvPatchFields / basic / sliced / slicedFvPatchField.H
blob6fa18a35d2d5de6fb86fb9498913d6566eaf52de
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::slicedFvPatchField
27 Description
28     Specialization of fvPatchField which creates the underlying
29     fvPatchField as a slice of the given complete field.
31     The destructor is wrapped to avoid deallocation of the storage of the
32     complete fields when this is destroyed.
34     Should only used as a template argument for SlicedGeometricField.
36 SourceFiles
37     slicedFvPatchField.C
39 \*---------------------------------------------------------------------------*/
41 #ifndef slicedFvPatchField_H
42 #define slicedFvPatchField_H
44 #include "fvPatchField.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                            Class slicedFvPatch Declaration
53 \*---------------------------------------------------------------------------*/
55 template<class Type>
56 class slicedFvPatchField
58     public fvPatchField<Type>
61 public:
63     //- Runtime type information
64     TypeName("sliced");
67     // Constructors
69         //- Construct from patch, internal field and field to slice
70         slicedFvPatchField
71         (
72             const fvPatch&,
73             const DimensionedField<Type, volMesh>&,
74             const Field<Type>&
75         );
77         //- Construct from patch and internal field. Assign value later.
78         slicedFvPatchField
79         (
80             const fvPatch&,
81             const DimensionedField<Type, volMesh>&
82         );
84         //- Construct from patch, internal field and dictionary
85         slicedFvPatchField
86         (
87             const fvPatch&,
88             const DimensionedField<Type, volMesh>&,
89             const dictionary&
90         );
92         //- Construct by mapping the given slicedFvPatchField<Type>
93         //  onto a new patch
94         slicedFvPatchField
95         (
96             const slicedFvPatchField<Type>&,
97             const fvPatch&,
98             const DimensionedField<Type, volMesh>&,
99             const fvPatchFieldMapper&
100         );
102         //- Construct as copy
103         slicedFvPatchField(const slicedFvPatchField<Type>&);
105         //- Construct and return a clone
106         virtual tmp<fvPatchField<Type> > clone() const;
108         //- Construct as copy setting internal field reference
109         slicedFvPatchField
110         (
111             const slicedFvPatchField<Type>&,
112             const DimensionedField<Type, volMesh>&
113         );
115         //- Construct and return a clone setting internal field reference
116         virtual tmp<fvPatchField<Type> > clone
117         (
118             const DimensionedField<Type, volMesh>& iF
119         ) const;
122     // Destructor
124         virtual ~slicedFvPatchField();
127     // Member functions
129         // Access
131             //- Return true if this patch field fixes a value.
132             //  Needed to check if a level has to be specified while solving
133             //  Poissons equations.
134             virtual bool fixesValue() const
135             {
136                 return true;
137             }
140         // Evaluation functions
142             //- Return patch-normal gradient
143             virtual tmp<Field<Type> > snGrad() const;
145             //- Update the coefficients associated with the patch field
146             //  Sets Updated to true
147             virtual void updateCoeffs();
149             //- Return internal field next to patch as patch field
150             virtual tmp<Field<Type> > patchInternalField() const;
152             //- Return neighbour coupled given internal cell data
153             virtual tmp<Field<Type> > patchNeighbourField
154             (
155                 const Field<Type>& iField
156             ) const;
158             //- Return patchField of the values on the patch or on the
159             //  opposite patch
160             virtual tmp<Field<Type> > patchNeighbourField() const;
162             //- Initialise the evaluation of the patch field
163             virtual void initEvaluate
164             (
165                 const Pstream::commsTypes commsType = Pstream::blocking
166             )
167             {}
169             //- Evaluate the patch field, sets Updated to false
170             virtual void evaluate
171             (
172                 const Pstream::commsTypes commsType = Pstream::blocking
173             )
174             {}
176             //- Return the matrix diagonal coefficients corresponding to the
177             //  evaluation of the value of this patchField with given weights
178             virtual tmp<Field<Type> > valueInternalCoeffs
179             (
180                 const tmp<scalarField>&
181             ) const;
183             //- Return the matrix source coefficients corresponding to the
184             //  evaluation of the value of this patchField with given weights
185             virtual tmp<Field<Type> > valueBoundaryCoeffs
186             (
187                 const tmp<scalarField>&
188             ) const;
190             //- Return the matrix diagonal coefficients corresponding to the
191             //  evaluation of the gradient of this patchField
192             virtual tmp<Field<Type> > gradientInternalCoeffs() const;
194             //- Return the matrix source coefficients corresponding to the
195             //  evaluation of the gradient of this patchField
196             virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
199         //- Write
200         virtual void write(Ostream&) const;
203     // Member operators
205         virtual void operator=(const UList<Type>&) {}
207         virtual void operator=(const fvPatchField<Type>&) {}
208         virtual void operator+=(const fvPatchField<Type>&) {}
209         virtual void operator-=(const fvPatchField<Type>&) {}
210         virtual void operator*=(const fvPatchField<scalar>&) {}
211         virtual void operator/=(const fvPatchField<scalar>&) {}
213         virtual void operator+=(const Field<Type>&) {}
214         virtual void operator-=(const Field<Type>&) {}
216         virtual void operator*=(const Field<scalar>&) {}
217         virtual void operator/=(const Field<scalar>&) {}
219         virtual void operator=(const Type&) {}
220         virtual void operator+=(const Type&) {}
221         virtual void operator-=(const Type&) {}
222         virtual void operator*=(const scalar) {}
223         virtual void operator/=(const scalar) {}
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 } // End namespace Foam
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 #ifdef NoRepository
234 #   include "slicedFvPatchField.C"
235 #endif
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 #endif
241 // ************************************************************************* //