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

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