1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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/>.
28 SubField is a Field obtained as a section of another Field.
30 Thus it is itself unallocated so that no storage is allocated or
31 deallocated during its use. To achieve this behaviour, SubField is
32 derived from a SubList rather than a List.
37 \*---------------------------------------------------------------------------*/
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 //- Pre-declare SubField and related Field type
51 template<class Type> class Field;
52 template<class Type> class SubField;
54 /*---------------------------------------------------------------------------*\
55 Class SubField Declaration
56 \*---------------------------------------------------------------------------*/
68 typedef typename pTraits<Type>::cmptType cmptType;
73 //- Construct from a SubList
74 inline SubField(const SubList<Type>&);
76 //- Construct from a UList\<Type\>, using the entire size
77 explicit inline SubField(const UList<Type>&);
79 //- Construct from a UList\<Type\> with a given size
82 const UList<Type>& list,
86 //- Construct from a UList\<Type\> with a given size and start index
89 const UList<Type>& list,
91 const label startIndex
95 inline SubField(const SubField<Type>&);
100 //- Return a null SubField
101 static inline const SubField<Type>& null();
103 //- Return a component field of the field
104 inline tmp<Field<cmptType> > component(const direction) const;
106 //- Return the field transpose (only defined for second rank tensors)
107 tmp<Field<Type> > T() const;
112 //- Assignment via UList operator. Takes linear time.
113 inline void operator=(const SubField<Type>&);
115 //- Allow cast to a const Field\<Type\>&
116 inline operator const Field<Type>&() const;
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace Foam
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 #include "SubFieldI.H"
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 // ************************************************************************* //