OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen 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-2007 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 SubDimensionedField<Type, GeoMesh>&
00082 SubDimensionedField<Type, GeoMesh>::null()
00083 {
00084     SubDimensionedField<Type, GeoMesh>* nullPtr
00085         = reinterpret_cast<SubDimensionedField<Type, GeoMesh>*>(NULL);
00086     return *nullPtr;
00087 }
00088 
00089 
00090 template<class Type, class GeoMesh>
00091 inline tmp<Field<typename SubDimensionedField<Type, GeoMesh>::cmptType> >
00092 SubDimensionedField<Type, GeoMesh>::component
00093 (
00094     const direction d
00095 ) const
00096 {
00097     return
00098     (
00099         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
00100     ).component(d);
00101 }
00102 
00103 
00104 template<class Type, class GeoMesh>
00105 inline tmp<DimensionedField<Type, GeoMesh> >
00106 SubDimensionedField<Type, GeoMesh>::T() const
00107 {
00108     return
00109     (
00110         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
00111     ).T();
00112 }
00113 
00114 
00115 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00116 
00117 template<class Type, class GeoMesh>
00118 inline void SubDimensionedField<Type, GeoMesh>::operator=
00119 (
00120     const SubDimensionedField<Type, GeoMesh>& rhs
00121 )
00122 {
00123     dimensions() = rhs.dimensions();
00124     SubField<Type>::operator=(rhs);
00125 }
00126 
00127 
00128 // Allow cast to a const DimensionedField<Type, GeoMesh>&
00129 template<class Type, class GeoMesh>
00130 inline SubDimensionedField<Type, GeoMesh>::operator
00131 const DimensionedField<Type, GeoMesh>&() const
00132 {
00133     return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this));
00134 }
00135 
00136 
00137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00138 
00139 } // End namespace Foam
00140 
00141 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd