SubDimensionedField.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::SubDimensionedField
28 
29 Description
30  SubDimensionedField is a DimensionedField obtained as a section of another
31  DimensionedField.
32 
33  Thus it is itself unallocated so that no storage is allocated or
34  deallocated during its use. To achieve this behaviour,
35  SubDimensionedField is derived from SubField rather than Field.
36 
37 SourceFiles
38  SubDimensionedFieldI.H
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef SubDimensionedField_H
43 #define SubDimensionedField_H
44 
45 #include "Field.H"
46 #include "SubField.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class SubDimensionedField Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type, class GeoMesh>
59 :
60  public regIOobject,
61  public SubField<Type>
62 {
63 
64 public:
65 
66  // Public typedefs
67 
68  typedef typename GeoMesh::Mesh Mesh;
69  typedef typename Field<Type>::cmptType cmptType;
70 
71 
72  // Constructors
73 
74  //- Construct from a SubField
75  inline SubDimensionedField(const SubField<Type>& sfield);
76 
77  //- Construct from a UList and size
78  inline SubDimensionedField
79  (
80  const UList<Type>& list,
81  const label subSize
82  );
83 
84  //- Construct from a UList start and end indices
85  inline SubDimensionedField
86  (
87  const UList<Type>& list,
88  const label subSize,
89  const label startIndex
90  );
91 
92  //- Construct from UList and a (start,size) range.
93  // The range is subsetted with the list size itself to ensure that the
94  // result always addresses a valid section of the list.
95  inline SubDimensionedField
96  (
97  const UList<Type>& list,
98  const labelRange& range
99  );
100 
101  //- Construct from UList and a (start,size) range, but bypassing
102  //- run-time range checking.
103  inline SubDimensionedField
104  (
105  const labelRange& range,
106  const UList<Type>& list
107  );
108 
109 
110  //- Construct as copy
111  inline SubDimensionedField
112  (
114  );
115 
116 
117  // Member functions
118 
119  //- Return a null SubDimensionedField
120  static inline const SubDimensionedField<Type, GeoMesh>& null();
121 
122  //- Return a component field of the field
124  (
125  const direction d
126  ) const;
127 
128  //- Return the field transpose (only defined for second rank tensors)
130 
131 
132  // Member operators
133 
134  //- Assignment
135  inline void operator=(const SubDimensionedField<Type, GeoMesh>& rhs);
136 
137  //- Allow cast to a const DimensionedField<Type, GeoMesh>&
138  inline operator const DimensionedField<Type, GeoMesh>&() const;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #include "SubDimensionedFieldI.H"
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 #endif
153 
154 // ************************************************************************* //
SubField.H
Foam::SubDimensionedField::T
tmp< DimensionedField< Type, GeoMesh > > T() const
Return the field transpose (only defined for second rank tensors)
Definition: SubDimensionedFieldI.H:126
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::SubField
SubField is a Field obtained as a section of another Field, without its own allocation....
Definition: Field.H:64
Foam::Field::cmptType
pTraits< Type >::cmptType cmptType
Component type.
Definition: Field.H:86
Field.H
Foam::labelRange
A range or interval of labels defined by a start and a size.
Definition: labelRange.H:55
Foam::SubDimensionedField
SubDimensionedField is a DimensionedField obtained as a section of another DimensionedField.
Definition: SubDimensionedField.H:57
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
range
scalar range
Definition: LISASMDCalcMethod1.H:12
Foam::SubDimensionedField::Mesh
GeoMesh::Mesh Mesh
Definition: SubDimensionedField.H:67
Foam::SubDimensionedField::operator=
void operator=(const SubDimensionedField< Type, GeoMesh > &rhs)
Assignment.
Definition: SubDimensionedFieldI.H:139
Foam::SubDimensionedField::cmptType
Field< Type >::cmptType cmptType
Definition: SubDimensionedField.H:68
Foam::UList< Type >
Foam::direction
uint8_t direction
Definition: direction.H:52
Foam::SubDimensionedField::component
tmp< DimensionedField< cmptType, GeoMesh > > component(const direction d) const
Return a component field of the field.
SubDimensionedFieldI.H
Foam::GeoMesh::Mesh
MESH Mesh
Definition: GeoMesh.H:62
Foam::SubDimensionedField::SubDimensionedField
SubDimensionedField(const SubField< Type > &sfield)
Construct from a SubField.
Definition: SubDimensionedFieldI.H:32
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54