initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / OpenFOAM / fields / DimensionedFields / DimensionedField / SubDimensionedFieldI.H
blob833781b2d7c3b7906f8e63380377184f6a49d8d7
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 namespace Foam
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 template<class Type, class GeoMesh>
35 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
37     const SubField<Type>& slist
40     SubField<Type>(slist)
43 template<class Type, class GeoMesh>
44 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
46     const UList<Type>& list,
47     const label subSize
50     SubField<Type>(list, subSize)
54 template<class Type, class GeoMesh>
55 inline SubDimensionedField<Type, GeoMesh>::SubDimensionedField
57     const UList<Type>& list,
58     const label subSize,
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
72     refCount(),
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
92     const direction d
93 ) const
95     return
96     (
97         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
98     ).component(d);
102 template<class Type, class GeoMesh>
103 inline tmp<DimensionedField<Type, GeoMesh> >
104 SubDimensionedField<Type, GeoMesh>::T() const
106     return
107     (
108         reinterpret_cast<const DimensionedField<Type, GeoMesh>&>(*this)
109     ).T();
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 // ************************************************************************* //