DimensionedFieldNew.C
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) 2022 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 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
29 
30 template<class Type, class GeoMesh>
33 (
34  const word& name,
35  const Mesh& mesh,
36  const dimensionSet& ds,
37  const Field<Type>& iField
38 )
39 {
41  (
42  IOobject
43  (
44  name,
45  mesh.thisDb().time().timeName(),
46  mesh.thisDb(),
47  IOobjectOption::NO_READ,
48  IOobjectOption::NO_WRITE,
49  IOobjectOption::NO_REGISTER
50  ),
51  mesh,
52  ds,
53  iField
54  );
55 }
56 
57 
58 template<class Type, class GeoMesh>
61 (
62  const word& name,
63  const Mesh& mesh,
64  const dimensionSet& ds,
65  Field<Type>&& iField
66 )
67 {
69  (
70  IOobject
71  (
72  name,
73  mesh.thisDb().time().timeName(),
74  mesh.thisDb(),
75  IOobjectOption::NO_READ,
76  IOobjectOption::NO_WRITE,
77  IOobjectOption::NO_REGISTER
78  ),
79  mesh,
80  ds,
81  std::move(iField)
82  );
83 }
84 
85 
86 template<class Type, class GeoMesh>
89 (
90  const word& name,
91  const Mesh& mesh,
92  const dimensionSet& ds
93 )
94 {
96  (
97  IOobject
98  (
99  name,
100  mesh.thisDb().time().timeName(),
101  mesh.thisDb(),
102  IOobjectOption::NO_READ,
103  IOobjectOption::NO_WRITE,
104  IOobjectOption::NO_REGISTER
105  ),
106  mesh,
107  ds,
108  false // checkIOFlags = true
109  );
110 }
111 
112 
113 template<class Type, class GeoMesh>
116 (
117  const word& name,
118  const Mesh& mesh,
119  const dimensioned<Type>& dt
120 )
121 {
123  (
124  IOobject
125  (
126  name,
127  mesh.thisDb().time().timeName(),
128  mesh.thisDb(),
129  IOobjectOption::NO_READ,
130  IOobjectOption::NO_WRITE,
131  IOobjectOption::NO_REGISTER
132  ),
133  mesh,
134  dt,
135  false // checkIOFlags = true
136  );
137 }
138 
139 
140 template<class Type, class GeoMesh>
143 (
144  const word& newName,
146 )
147 {
149  (
150  IOobject
151  (
152  newName,
153  tfld().instance(),
154  tfld().local(),
155  tfld().db(),
156  IOobjectOption::NO_READ,
157  IOobjectOption::NO_WRITE,
158  IOobjectOption::NO_REGISTER
159  ),
160  tfld
161  );
162 }
163 
164 
165 template<class Type, class GeoMesh>
166 template<class AnyType>
169 (
171  const word& name,
172  const dimensionSet& dims
173 )
174 {
176  (
177  IOobject
178  (
179  name,
180  fld.instance(),
181  fld.db(),
182  IOobjectOption::NO_READ,
183  IOobjectOption::NO_WRITE,
184  IOobjectOption::NO_REGISTER
185  ),
186  fld.mesh(),
187  dims
188  );
189 }
190 
191 
192 template<class Type, class GeoMesh>
193 template<class AnyType>
196 (
198  const word& name,
199  const dimensioned<Type>& dt
200 )
201 {
203  (
204  IOobject
205  (
206  name,
207  fld.instance(),
208  fld.db(),
209  IOobjectOption::NO_READ,
210  IOobjectOption::NO_WRITE,
211  IOobjectOption::NO_REGISTER
212  ),
213  fld.mesh(),
214  dt
215  );
216 }
217 
218 
219 // ************************************************************************* //
Generic dimensioned Type class.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Definition: dimensionSet.H:105
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
Generic templated field type.
Definition: Field.H:61
A class for handling words, derived from Foam::string.
Definition: word.H:63
bool local
Definition: EEqn.H:20
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &ds, const Field< Type > &iField)
Return tmp field from name, mesh, dimensions, copy of internal field.
Foam::pointMesh ::Mesh Mesh
Type of mesh on which this DimensionedField is instantiated.
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))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166