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

SubDimensionedFieldI.H

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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00027 
00028 namespace Foam
00029 {
00030 
00031 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00032 
00033 template<class Type, class GeoMesh>
00034 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
00035 (
00036     const SubField<Type>& slist
00037 )
00038 :
00039     SubField<Type>(slist)
00040 {}
00041 
00042 template<class Type, class GeoMesh>
00043 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
00044 (
00045     const UList<Type>& list,
00046     const label subSize
00047 )
00048 :
00049     SubField<Type>(list, subSize)
00050 {}
00051 
00052 
00053 template<class Type, class GeoMesh>
00054 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
00055 (
00056     const UList<Type>& list,
00057     const label subSize,
00058     const label startIndex
00059 )
00060 :
00061     SubField<Type>(list, subSize, startIndex)
00062 {}
00063 
00064 
00065 template<class Type, class GeoMesh>
00066 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
00067 (
00068     const SubDimensionedField<Type, GeoMesh>& sfield
00069 )
00070 :
00071     refCount(),
00072     SubField<Type>(sfield)
00073 {}
00074 
00075 
00076 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00077 
00078 // Return a null Field
00079 template<class Type, class GeoMesh>
00080 inline const SubDimensionedField<Type, GeoMesh>&
00081 SubDimensionedField<Type, GeoMesh>::null()
00082 {
00083     return *reinterpret_cast< SubDimensionedField<Type, GeoMesh>* >(0);
00084 }
00085 
00086 
00087 template<class Type, class GeoMesh>
00088 inline tmp<Field<typename SubDimensionedField<Type, GeoMesh>::cmptType> >
00089 SubDimensionedField<Type, GeoMesh>::component
00090 (
00091     const direction d
00092 ) const
00093 {
00094     return
00095     (
00096         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
00097     ).component(d);
00098 }
00099 
00100 
00101 template<class Type, class GeoMesh>
00102 inline tmp<DimensionedField<Type, GeoMesh> >
00103 SubDimensionedField<Type, GeoMesh>::T() const
00104 {
00105     return
00106     (
00107         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
00108     ).T();
00109 }
00110 
00111 
00112 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00113 
00114 template<class Type, class GeoMesh>
00115 inline void SubDimensionedField<Type, GeoMesh>::operator=
00116 (
00117     const SubDimensionedField<Type, GeoMesh>& rhs
00118 )
00119 {
00120     dimensions() = rhs.dimensions();
00121     SubField<Type>::operator=(rhs);
00122 }
00123 
00124 
00125 // Allow cast to a const DimensionedField<Type, GeoMesh>&
00126 template<class Type, class GeoMesh>
00127 inline SubDimensionedField<Type, GeoMesh>::operator
00128 const DimensionedField<Type, GeoMesh>&() const
00129 {
00130     return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this));
00131 }
00132 
00133 
00134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00135 
00136 } // End namespace Foam
00137 
00138 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines