1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 template<class Type, class GeoMesh>
35 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
37 const SubField<Type>& slist
43 template<class Type, class GeoMesh>
44 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
46 const UList<Type>& list,
50 SubField<Type>(list, subSize)
54 template<class Type, class GeoMesh>
55 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
57 const UList<Type>& list,
59 const label startIndex
62 SubField<Type>(list, subSize, startIndex)
66 template<class Type, class GeoMesh>
67 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
69 const SubDimensionedField<Type, GeoMesh>& sfield
73 SubField<Type>(sfield)
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 // Return a null Field
80 template<class Type, class GeoMesh>
81 inline const SubDimensionedField<Type, GeoMesh>&
82 SubDimensionedField<Type, GeoMesh>::null()
84 return *reinterpret_cast< SubDimensionedField<Type, GeoMesh>* >(0);
88 template<class Type, class GeoMesh>
89 inline tmp<Field<typename SubDimensionedField<Type, GeoMesh>::cmptType> >
90 SubDimensionedField<Type, GeoMesh>::component
97 reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
102 template<class Type, class GeoMesh>
103 inline tmp<DimensionedField<Type, GeoMesh> >
104 SubDimensionedField<Type, GeoMesh>::T() const
108 reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
113 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
115 template<class Type, class GeoMesh>
116 inline void SubDimensionedField<Type, GeoMesh>::operator=
118 const SubDimensionedField<Type, GeoMesh>& rhs
121 dimensions() = rhs.dimensions();
122 SubField<Type>::operator=(rhs);
126 // Allow cast to a const DimensionedField<Type, GeoMesh>&
127 template<class Type, class GeoMesh>
128 inline SubDimensionedField<Type, GeoMesh>::operator
129 const DimensionedField<Type, GeoMesh>&() const
131 return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this));
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // ************************************************************************* //