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
29 SubField is a Field obtained as a section of another Field.
31 Thus it is itself unallocated so that no storage is allocated or
32 deallocated during its use. To achieve this behaviour, SubField is
33 derived from a SubList rather than a List.
38 \*---------------------------------------------------------------------------*/
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 //- Pre-declare SubField and related Field type
52 template<class Type> class Field;
53 template<class Type> class SubField;
55 /*---------------------------------------------------------------------------*\
56 Class SubField Declaration
57 \*---------------------------------------------------------------------------*/
69 typedef typename pTraits<Type>::cmptType cmptType;
74 //- Construct from a SubList
75 inline SubField(const SubList<Type>&);
77 //- Construct from a UList\<Type\>, using the entire size
78 explicit inline SubField(const UList<Type>&);
80 //- Construct from a UList\<Type\> with a given size
83 const UList<Type>& list,
87 //- Construct from a UList\<Type\> with a given size and start index
90 const UList<Type>& list,
92 const label startIndex
96 inline SubField(const SubField<Type>&);
101 //- Return a null SubField
102 static inline const SubField<Type>& null();
104 //- Return a component field of the field
105 inline tmp<Field<cmptType> > component(const direction) const;
107 //- Return the field transpose (only defined for second rank tensors)
108 tmp<Field<Type> > T() const;
113 //- Assignment via UList operator. Takes linear time.
114 inline void operator=(const SubField<Type>&);
116 //- Allow cast to a const Field\<Type\>&
117 inline operator const Field<Type>&() const;
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 } // End namespace Foam
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 #include "SubFieldI.H"
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 // ************************************************************************* //