OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

slicedFvsPatchField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "slicedFvsPatchField.H"
00028 
00029 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00030 
00031 namespace Foam
00032 {
00033 
00034 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00035 
00036 template<class Type>
00037 slicedFvsPatchField<Type>::slicedFvsPatchField
00038 (
00039     const fvPatch& p,
00040     const DimensionedField<Type, surfaceMesh>& iF,
00041     const Field<Type>& completeField
00042 )
00043 :
00044     fvsPatchField<Type>(p, iF, Field<Type>())
00045 {
00046     // Set the fvsPatchField to a slice of the given complete field
00047     UList<Type>::operator=(p.patchSlice(completeField));
00048 }
00049 
00050 
00051 template<class Type>
00052 slicedFvsPatchField<Type>::slicedFvsPatchField
00053 (
00054     const fvPatch& p,
00055     const DimensionedField<Type, surfaceMesh>& iF
00056 )
00057 :
00058     fvsPatchField<Type>(p, iF)
00059 {}
00060 
00061 
00062 template<class Type>
00063 slicedFvsPatchField<Type>::slicedFvsPatchField
00064 (
00065     const slicedFvsPatchField<Type>& ptf,
00066     const fvPatch& p,
00067     const DimensionedField<Type, surfaceMesh>& iF,
00068     const fvPatchFieldMapper& mapper
00069 )
00070 :
00071     fvsPatchField<Type>(ptf, p, iF, mapper)
00072 {
00073     notImplemented
00074     (
00075         "slicedFvsPatchField<Type>::"
00076         "slicedFvsPatchField(const slicedFvsPatchField<Type>&, "
00077         "const fvPatch&, const Field<Type>&, const fvPatchFieldMapper&)"
00078     );
00079 }
00080 
00081 
00082 template<class Type>
00083 slicedFvsPatchField<Type>::slicedFvsPatchField
00084 (
00085     const fvPatch& p,
00086     const DimensionedField<Type, surfaceMesh>& iF,
00087     const dictionary& dict
00088 )
00089 :
00090     fvsPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
00091 {
00092     notImplemented
00093     (
00094         "slicedFvsPatchField<Type>::"
00095         "slicedFvsPatchField(const Field<Type>&, const dictionary&)"
00096     );
00097 }
00098 
00099 
00100 template<class Type>
00101 slicedFvsPatchField<Type>::slicedFvsPatchField
00102 (
00103     const slicedFvsPatchField<Type>& ptf,
00104     const DimensionedField<Type, surfaceMesh>& iF
00105 )
00106 :
00107     fvsPatchField<Type>(ptf.patch(), iF, Field<Type>())
00108 {
00109     // Transfer the slice from the argument
00110     UList<Type>::operator=(ptf);
00111 }
00112 
00113 template<class Type>
00114 tmp<fvsPatchField<Type> > slicedFvsPatchField<Type>::clone() const
00115 {
00116     return tmp<fvsPatchField<Type> >
00117     (
00118         new slicedFvsPatchField<Type>(*this)
00119     );
00120 }
00121 
00122 
00123 template<class Type>
00124 slicedFvsPatchField<Type>::slicedFvsPatchField
00125 (
00126     const slicedFvsPatchField<Type>& ptf
00127 )
00128 :
00129     fvsPatchField<Type>
00130     (
00131         ptf.patch(),
00132         ptf.dimensionedInternalField(),
00133         Field<Type>()
00134     )
00135 {
00136     // Transfer the slice from the argument
00137     UList<Type>::operator=(ptf);
00138 }
00139 
00140 
00141 template<class Type>
00142 tmp<fvsPatchField<Type> > slicedFvsPatchField<Type>::clone
00143 (
00144     const DimensionedField<Type, surfaceMesh>& iF
00145 ) const
00146 {
00147     return tmp<fvsPatchField<Type> >
00148     (
00149         new slicedFvsPatchField<Type>(*this, iF)
00150     );
00151 }
00152 
00153 
00154 template<class Type>
00155 slicedFvsPatchField<Type>::~slicedFvsPatchField<Type>()
00156 {
00157     // Set the fvsPatchField storage pointer to NULL before its destruction
00158     // to protect the field it a slice of.
00159     UList<Type>::operator=(UList<Type>(NULL, 0));
00160 }
00161 
00162 
00163 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00164 
00165 template<class Type>
00166 void slicedFvsPatchField<Type>::write(Ostream& os) const
00167 {
00168     fvsPatchField<Type>::write(os);
00169     this->writeEntry("value", os);
00170 }
00171 
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 } // End namespace Foam
00176 
00177 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd