FieldI.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) 2018-2021 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 :
33  List<Type>()
34 {}
35 
36 
37 template<class Type>
38 inline Foam::Field<Type>::Field(const label len)
39 :
40  List<Type>(len)
41 {}
42 
43 
44 template<class Type>
45 inline Foam::Field<Type>::Field(const label len, const Type& val)
46 :
47  List<Type>(len, val)
48 {}
49 
50 
51 template<class Type>
52 inline Foam::Field<Type>::Field(const label len, const Foam::zero)
53 :
54  List<Type>(len, Foam::zero{})
55 {}
56 
57 
58 template<class Type>
59 inline Foam::Field<Type>::Field(const Foam::one, const Type& val)
60 :
61  List<Type>(Foam::one{}, val)
62 {}
63 
64 
65 template<class Type>
66 inline Foam::Field<Type>::Field(const Foam::one, Type&& val)
67 :
68  List<Type>(Foam::one{}, std::move(val))
69 {}
70 
71 
72 template<class Type>
74 :
75  List<Type>(Foam::one{}, Foam::zero{})
76 {}
77 
78 
79 template<class Type>
81 :
82  List<Type>(fld)
83 {}
84 
85 
86 template<class Type>
87 inline Foam::Field<Type>::Field(const UList<Type>& list)
88 :
89  List<Type>(list)
90 {}
91 
92 
93 template<class Type>
94 template<class Addr>
96 :
97  List<Type>(list)
98 {}
99 
100 
101 template<class Type>
103 :
104  List<Type>(std::move(static_cast<List<Type>&>(fld)))
105 {}
106 
107 
108 template<class Type>
110 :
111  List<Type>(std::move(list))
112 {}
113 
114 
115 template<class Type>
116 template<int SizeMin>
118 :
119  List<Type>()
120 {
121  List<Type>::transfer(list);
122 }
123 
124 
125 template<class Type>
127 :
128  List<Type>(fld, reuse)
129 {}
130 
131 
132 template<class Type>
133 inline Foam::Field<Type>::Field(const tmp<Field<Type>>& tfld)
134 :
135  List<Type>(tfld.constCast(), tfld.movable())
136 {
137  tfld.clear();
138 }
139 
140 
141 template<class Type>
143 :
144  List<Type>(is)
145 {}
146 
147 
148 template<class Type>
150 {
151  return tmp<Field<Type>>::New(*this);
152 }
153 
154 
155 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
156 
157 template<class Type>
159 {
161 }
162 
163 
164 template<class Type>
165 inline void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
166 {
168 }
169 
170 
171 template<class Type>
172 template<class Addr>
173 inline void Foam::Field<Type>::operator=
174 (
176 )
177 {
179 }
180 
181 
182 template<class Type>
184 {
186 }
187 
188 
189 template<class Type>
190 inline void Foam::Field<Type>::operator=(List<Type>&& rhs)
191 {
193 }
194 
195 
196 template<class Type>
197 template<int SizeMin>
199 {
201 }
202 
203 
204 template<class Type>
205 inline void Foam::Field<Type>::operator=(const Type& val)
206 {
208 }
209 
210 
211 template<class Type>
212 inline void Foam::Field<Type>::operator=(const Foam::zero)
213 {
215 }
216 
217 
218 // ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
SubField is a Field obtained as a section of another Field, without its own allocation. SubField is derived from a SubList rather than a List.
Definition: Field.H:63
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:51
Generic templated field type.
Definition: Field.H:62
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:130
tmp< Field< Type > > clone() const
Clone.
Definition: FieldI.H:142
const direction noexcept
Definition: Scalar.H:258
void operator=(const Field< Type > &)
Copy assignment.
Definition: Field.C:747
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
constexpr Field() noexcept
Default construct.
Definition: FieldI.H:24
A class for managing temporary objects.
Definition: HashPtrTable.H:50
A non-counting (dummy) refCount.
Definition: refCount.H:55
Namespace for OpenFOAM.
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:56