1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 template<class Type, class GeoMesh>
34 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
36 const SubField<Type>& slist
42 template<class Type, class GeoMesh>
43 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
45 const UList<Type>& list,
49 SubField<Type>(list, subSize)
53 template<class Type, class GeoMesh>
54 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
56 const UList<Type>& list,
58 const label startIndex
61 SubField<Type>(list, subSize, startIndex)
65 template<class Type, class GeoMesh>
66 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
68 const SubDimensionedField<Type, GeoMesh>& sfield
72 SubField<Type>(sfield)
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
78 // Return a null Field
79 template<class Type, class GeoMesh>
80 inline const SubDimensionedField<Type, GeoMesh>&
81 SubDimensionedField<Type, GeoMesh>::null()
83 return *reinterpret_cast< SubDimensionedField<Type, GeoMesh>* >(0);
87 template<class Type, class GeoMesh>
88 inline tmp<Field<typename SubDimensionedField<Type, GeoMesh>::cmptType> >
89 SubDimensionedField<Type, GeoMesh>::component
96 reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
101 template<class Type, class GeoMesh>
102 inline tmp<DimensionedField<Type, GeoMesh> >
103 SubDimensionedField<Type, GeoMesh>::T() const
107 reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
112 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
114 template<class Type, class GeoMesh>
115 inline void SubDimensionedField<Type, GeoMesh>::operator=
117 const SubDimensionedField<Type, GeoMesh>& rhs
120 dimensions() = rhs.dimensions();
121 SubField<Type>::operator=(rhs);
125 // Allow cast to a const DimensionedField<Type, GeoMesh>&
126 template<class Type, class GeoMesh>
127 inline SubDimensionedField<Type, GeoMesh>::operator
128 const DimensionedField<Type, GeoMesh>&() const
130 return *(reinterpret_cast<const DimensionedField<Type, GeoMesh>*>(this));
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // ************************************************************************* //