FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <finiteVolume/slicedFvsPatchField.H>
00027 
00028 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00029 
00030 namespace Foam
00031 {
00032 
00033 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00034 
00035 template<class Type>
00036 slicedFvsPatchField<Type>::slicedFvsPatchField
00037 (
00038     const fvPatch& p,
00039     const DimensionedField<Type, surfaceMesh>& iF,
00040     const Field<Type>& completeField
00041 )
00042 :
00043     fvsPatchField<Type>(p, iF, Field<Type>())
00044 {
00045     // Set the fvsPatchField to a slice of the given complete field
00046     UList<Type>::operator=(p.patchSlice(completeField));
00047 }
00048 
00049 
00050 template<class Type>
00051 slicedFvsPatchField<Type>::slicedFvsPatchField
00052 (
00053     const fvPatch& p,
00054     const DimensionedField<Type, surfaceMesh>& iF
00055 )
00056 :
00057     fvsPatchField<Type>(p, iF)
00058 {}
00059 
00060 
00061 template<class Type>
00062 slicedFvsPatchField<Type>::slicedFvsPatchField
00063 (
00064     const slicedFvsPatchField<Type>& ptf,
00065     const fvPatch& p,
00066     const DimensionedField<Type, surfaceMesh>& iF,
00067     const fvPatchFieldMapper& mapper
00068 )
00069 :
00070     fvsPatchField<Type>(ptf, p, iF, mapper)
00071 {
00072     notImplemented
00073     (
00074         "slicedFvsPatchField<Type>::"
00075         "slicedFvsPatchField(const slicedFvsPatchField<Type>&, "
00076         "const fvPatch&, const Field<Type>&, const fvPatchFieldMapper&)"
00077     );
00078 }
00079 
00080 
00081 template<class Type>
00082 slicedFvsPatchField<Type>::slicedFvsPatchField
00083 (
00084     const fvPatch& p,
00085     const DimensionedField<Type, surfaceMesh>& iF,
00086     const dictionary& dict
00087 )
00088 :
00089     fvsPatchField<Type>(p, iF, Field<Type>("value", dict, p.size()))
00090 {
00091     notImplemented
00092     (
00093         "slicedFvsPatchField<Type>::"
00094         "slicedFvsPatchField(const Field<Type>&, const dictionary&)"
00095     );
00096 }
00097 
00098 
00099 template<class Type>
00100 slicedFvsPatchField<Type>::slicedFvsPatchField
00101 (
00102     const slicedFvsPatchField<Type>& ptf,
00103     const DimensionedField<Type, surfaceMesh>& iF
00104 )
00105 :
00106     fvsPatchField<Type>(ptf.patch(), iF, Field<Type>())
00107 {
00108     // Transfer the slice from the argument
00109     UList<Type>::operator=(ptf);
00110 }
00111 
00112 template<class Type>
00113 tmp<fvsPatchField<Type> > slicedFvsPatchField<Type>::clone() const
00114 {
00115     return tmp<fvsPatchField<Type> >
00116     (
00117         new slicedFvsPatchField<Type>(*this)
00118     );
00119 }
00120 
00121 
00122 template<class Type>
00123 slicedFvsPatchField<Type>::slicedFvsPatchField
00124 (
00125     const slicedFvsPatchField<Type>& ptf
00126 )
00127 :
00128     fvsPatchField<Type>
00129     (
00130         ptf.patch(),
00131         ptf.dimensionedInternalField(),
00132         Field<Type>()
00133     )
00134 {
00135     // Transfer the slice from the argument
00136     UList<Type>::operator=(ptf);
00137 }
00138 
00139 
00140 template<class Type>
00141 tmp<fvsPatchField<Type> > slicedFvsPatchField<Type>::clone
00142 (
00143     const DimensionedField<Type, surfaceMesh>& iF
00144 ) const
00145 {
00146     return tmp<fvsPatchField<Type> >
00147     (
00148         new slicedFvsPatchField<Type>(*this, iF)
00149     );
00150 }
00151 
00152 
00153 template<class Type>
00154 slicedFvsPatchField<Type>::~slicedFvsPatchField<Type>()
00155 {
00156     // Set the fvsPatchField storage pointer to NULL before its destruction
00157     // to protect the field it a slice of.
00158     UList<Type>::operator=(UList<Type>(NULL, 0));
00159 }
00160 
00161 
00162 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00163 
00164 template<class Type>
00165 void slicedFvsPatchField<Type>::write(Ostream& os) const
00166 {
00167     fvsPatchField<Type>::write(os);
00168     this->writeEntry("value", os);
00169 }
00170 
00171 
00172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00173 
00174 } // End namespace Foam
00175 
00176 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines