initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / fields / DimensionedFields / DimensionedField / SubDimensionedField.H
blob856253ecc4d58d4aa27cabd3a4a00029da1add89
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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 Class
26     Foam::SubDimensionedField
28 Description
29     SubDimensionedField is a DimensionedField obtained as a section of another
30     DimensionedField.
32     Thus it is itself unallocated so that no storage is allocated or
33     deallocated during its use.  To achieve this behaviour,
34     SubDimensionedField is derived from SubField rather than Field.
36 SourceFiles
37     SubDimensionedFieldI.H
39 \*---------------------------------------------------------------------------*/
41 #ifndef SubDimensionedField_H
42 #define SubDimensionedField_H
44 #include "Field.H"
45 #include "SubField.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 /*---------------------------------------------------------------------------*\
53                       Class SubDimensionedField Declaration
54 \*---------------------------------------------------------------------------*/
56 template<class Type, class GeoMesh>
57 class SubDimensionedField
59     public regIOobject,
60     public SubField<Type>
63 public:
65     // Public typedefs
67         typedef typename GeoMesh::Mesh Mesh;
68         typedef typename Field<Type>::cmptType cmptType;
71     // Constructors
73         //- Construct from a SubField
74         inline SubDimensionedField
75         (
76             const SubField<Type>& slist
77         );
79         //- Construct from a UList and size
80         inline SubDimensionedField
81         (
82             const UList<Type>& list,
83             const label subSize
84         );
86         //- Construct from a UList start and end indices
87         inline SubDimensionedField
88         (
89             const UList<Type>& list,
90             const label subSize,
91             const label startIndex
92         );
94         //- Construct as copy
95         inline SubDimensionedField
96         (
97             const SubDimensionedField<cmptType, GeoMesh>& sfield
98         );
101     // Member functions
103         //- Return a null SubDimensionedField
104         static inline const SubDimensionedField<Type, GeoMesh>& null();
106         //- Return a component field of the field
107         inline tmp<DimensionedField<cmptType, GeoMesh> > component
108         (
109             const direction
110         ) const;
112         //- Return the field transpose (only defined for second rank tensors)
113         tmp<DimensionedField<Type, GeoMesh> > T() const;
116     // Member operators
118         //- Assignment
119         inline void operator=(const SubDimensionedField<Type, GeoMesh>&);
121         //- Allow cast to a const DimensionedField<Type, GeoMesh>&
122         inline operator const DimensionedField<Type, GeoMesh>&() const;
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 } // End namespace Foam
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 #include "SubDimensionedFieldI.H"
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 #endif
138 // ************************************************************************* //