Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
10License
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 * * * * * * * * * * * * * * //
30template<class Type>
31inline constexpr Foam::Field<Type>::Field() noexcept
32{}
33
34
35template<class Type>
36inline Foam::Field<Type>::Field(const label len)
37:
38 List<Type>(len)
39{}
40
41
42template<class Type>
43inline Foam::Field<Type>::Field(const label len, const Type& val)
44:
45 List<Type>(len, val)
46{}
47
48
49template<class Type>
50inline Foam::Field<Type>::Field(const label len, Foam::zero)
51:
52 List<Type>(len, Foam::zero{})
53{}
54
55
56template<class Type>
57inline Foam::Field<Type>::Field(Foam::one, const Type& val)
58:
59 List<Type>(Foam::one{}, val)
60{}
61
62
63template<class Type>
65:
66 List<Type>(Foam::one{}, std::move(val))
67{}
68
69
70template<class Type>
72:
73 List<Type>(Foam::one{}, Foam::zero{})
74{}
75
76
77template<class Type>
79:
80 List<Type>(fld)
81{}
82
83
84template<class Type>
85inline Foam::Field<Type>::Field(const UList<Type>& list)
87 List<Type>(list)
88{}
89
90
91template<class Type>
92template<class Addr>
94:
95 List<Type>(list)
96{}
97
98
99template<class Type>
101:
102 List<Type>(std::move(static_cast<List<Type>&>(fld)))
103{}
104
105
106template<class Type>
109 List<Type>(std::move(list))
110{}
111
112
113template<class Type>
114template<int SizeMin>
116:
117 List<Type>()
118{
120}
121
122
123template<class Type>
125:
126 List<Type>(fld, reuse)
127{}
128
129
130template<class Type>
131inline Foam::Field<Type>::Field(const tmp<Field<Type>>& tfld)
132:
133 List<Type>(tfld.constCast(), tfld.movable())
134{
135 tfld.clear();
136}
137
138
139template<class Type>
141:
142 List<Type>(is)
143{}
144
145
146template<class Type>
148{
149 return tmp<Field<Type>>::New(*this);
150}
151
152
153// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
154
155template<class Type>
160
161
162template<class Type>
166}
167
168
169template<class Type>
170template<class Addr>
172(
175{
177}
178
179
180template<class Type>
185
186
187template<class Type>
191}
192
193
194template<class Type>
195template<int SizeMin>
200
201
202template<class Type>
203inline void Foam::Field<Type>::operator=(const Type& val)
204{
206}
207
208
209template<class Type>
211{
213}
214
215
216// ************************************************************************* //
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
void operator=(const Field< Type > &)
Copy assignment.
Definition Field.C:781
constexpr Field() noexcept
Default construct.
Definition FieldI.H:24
tmp< Field< Type > > clone() const
Clone.
Definition FieldI.H:140
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
Definition List.C:347
void operator=(const UList< T > &list)
Assignment to UList operator. Takes linear time.
Definition List.C:381
SubField is a Field obtained as a section of another Field, without its own allocation....
Definition SubField.H:58
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition one.H:57
A class for managing temporary objects.
Definition tmp.H:75
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
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.
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
const direction noexcept
Definition scalarImpl.H:265
A non-counting (dummy) refCount.
Definition refCount.H:55