Loading...
Searching...
No Matches
DimensionedField.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 Copyright (C) 2015-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::DimensionedField
29
30Description
31 Field with dimensions and associated with geometry type GeoMesh which is
32 used to size the field and a reference to it is maintained.
33
34SourceFiles
35 DimensionedFieldI.H
36 DimensionedField.C
37 DimensionedFieldIO.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef Foam_DimensionedField_H
42#define Foam_DimensionedField_H
43
44#include "regIOobject.H"
45#include "DynamicField.H"
46#include "dimensionedType.H"
47#include "orientedType.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
54// Forward Declarations
55template<class Type, class GeoMesh> class DimensionedField;
56
57template<class Type, class GeoMesh>
58Ostream& operator<<
59(
62);
63
64template<class Type, class GeoMesh>
65Ostream& operator<<
66(
67 Ostream& os,
69);
70
71
72/*---------------------------------------------------------------------------*\
73 Class DimensionedField Declaration
74\*---------------------------------------------------------------------------*/
75
76template<class Type, class GeoMesh>
78:
79 public regIOobject,
80 public DynamicField<Type>
81{
82public:
83
84 // Public Typedefs
85
86 //- The template instance used for this DimensionedField type
88
89 //- The mesh type for the DimensionedField
90 typedef typename GeoMesh::Mesh Mesh;
91
92 //- The DimensionedField is usually synonymous with an internal field
95 //- Type of the field from which this DimensionedField is derived
97
98 //- Component type of the field elements
100
101
102private:
103
104 // Private Data
105
106 //- Reference to mesh
107 const Mesh& mesh_;
108
109 //- Dimension set for this field
110 dimensionSet dimensions_;
111
112 //- Oriented flag
113 orientedType oriented_;
114
115
116 // Private Member Functions
117
118 //- Assert that non-zero field size == mesh size
119 void checkFieldSize() const;
120
121 //- Read from file if it is present. Checks the readOption flag
122 bool readIfPresent(const word& fieldDictEntry = "value");
123
124 //- Read the field - create the field dictionary on-the-fly
125 void readField(const word& fieldDictEntry = "value");
126
127 //- Implementation for 'New' with specified registerObject preference.
128 // For LEGACY_REGISTER, registration is determined by
129 // objectRegistry::is_cacheTemporaryObject().
130 template<class... Args>
132 (
134 const word& name,
135 const Mesh& mesh,
136 Args&&... args
137 );
138
139public:
140
141 //- Runtime type information
142 TypeName("DimensionedField");
143
144
145 // Static Member Functions
146
147 //- Return a null DimensionedField (reference to a nullObject).
148 static const this_type& null() noexcept
149 {
151 }
152
153
154 // Constructors
155
156 //- Construct from components, copy initial field content
158 (
159 const IOobject& io,
160 const Mesh& mesh,
161 const dimensionSet& dims,
162 const Field<Type>& field
163 );
165 //- Construct from components, transferring initial field content
167 (
168 const IOobject& io,
169 const Mesh& mesh,
170 const dimensionSet& dims,
172 );
173
174 //- Construct from components, transferring initial field content
176 (
177 const IOobject& io,
178 const Mesh& mesh,
179 const dimensionSet& dims,
181 );
182
183 //- Construct from components, copy or transfer tmp content
185 (
186 const IOobject& io,
187 const Mesh& mesh,
188 const dimensionSet& dims,
189 const tmp<Field<Type>>& tfield
190 );
191
192 //- Construct from components, setting initial size and dimensions,
193 //- but not initialising any field values.
194 // Used for temporary fields which are initialised after construction
196 (
197 const IOobject& io,
198 const Mesh& mesh,
199 const dimensionSet& dims,
201 const bool checkIOFlags = true,
203 const bool extraCapacity = false
204 );
206 //- Construct from components, setting dimensions and initial
207 //- uniform field value.
209 (
210 const IOobject& io,
211 const Mesh& mesh,
212 const Type& value,
213 const dimensionSet& dims,
215 const bool checkIOFlags = true,
217 const bool extraCapacity = false
218 );
219
220 //- Construct from components, setting dimensions and initial
221 //- uniform field value.
222 // The name of the dimensioned<Type> has no influence.
224 (
225 const IOobject& io,
226 const Mesh& mesh,
227 const dimensioned<Type>& dt,
229 const bool checkIOFlags = true,
231 const bool extraCapacity = false
232 );
233
234 //- Construct from Istream (uses an intermediate dictionary)
236 (
237 const IOobject& io,
238 const Mesh& mesh,
239 const word& fieldDictEntry = "value",
241 const bool extraCapacity = false
242 );
243
244 //- Construct from dictionary
246 (
247 const IOobject& io,
248 const Mesh& mesh,
249 const dictionary& fieldDict,
250 const word& fieldDictEntry = "value",
252 const bool extraCapacity = false
253 );
254
255 //- Copy construct
257
258 //- Move construct
260
261 //- Copy construct or reuse (move) as specified.
264 //- Construct from tmp<DimensionedField> deleting argument
266 (
268 );
269
270 //- Copy construct, resetting IO parameters
272 (
273 const IOobject& io,
275 );
276
277 //- Move construct, resetting IO parameters
279 (
280 const IOobject& io,
282 );
283
284 //- Copy or move construct, resetting IO parameters.
286 (
287 const IOobject& io,
289 bool reuse
290 );
291
292 //- Construct from tmp<DimensionedField> deleting argument,
293 //- resetting IO parameters.
295 (
296 const IOobject& io,
298 );
299
300 //- Copy construct with a new name
303 const word& newName,
305 );
306
307 //- Move construct with a new name
309 (
310 const word& newName,
312 );
313
314 //- Copy or move construct, resetting name.
316 (
317 const word& newName,
319 bool reuse
320 );
321
322 //- Construct with a new name from tmp<DimensionedField>
324 (
325 const word& newName,
327 );
328
329 //- Clone
331
332
333 // Factory Methods
335 //- Return tmp field (NO_READ, NO_WRITE)
336 //- from name, mesh, dimensions, copy of internal field.
337 //- [Takes current timeName from the mesh registry].
338 // For LEGACY_REGISTER, registration is determined by
339 // objectRegistry::is_cacheTemporaryObject().
341 (
342 const word& name,
344 const Mesh& mesh,
345 const dimensionSet& dims,
346 const Field<Type>& iField
347 );
348
349 //- Return tmp field (NO_READ, NO_WRITE)
350 //- from name, mesh, dimensions, copy of internal field.
351 //- [Takes current timeName from the mesh registry].
352 // Registration/persistence determined by
353 // objectRegistry::is_cacheTemporaryObject().
355 (
356 const word& name,
357 const Mesh& mesh,
358 const dimensionSet& dims,
359 const Field<Type>& iField
360 );
361
362 //- Return tmp field (NO_READ, NO_WRITE)
363 //- from name, mesh, dimensions, move internal field contents.
364 //- [Takes current timeName from the mesh registry].
365 // For LEGACY_REGISTER, registration is determined by
366 // objectRegistry::is_cacheTemporaryObject().
368 (
369 const word& name,
371 const Mesh& mesh,
372 const dimensionSet& dims,
373 Field<Type>&& iField
374 );
375
376 //- Return tmp field (NO_READ, NO_WRITE)
377 //- from name, mesh, dimensions, move internal field contents.
378 //- [Takes current timeName from the mesh registry].
379 // Registration/persistence determined by
380 // objectRegistry::is_cacheTemporaryObject().
382 (
383 const word& name,
384 const Mesh& mesh,
385 const dimensionSet& dims,
386 Field<Type>&& iField
387 );
388
389 //- Return tmp field (NO_READ, NO_WRITE)
390 //- from name, mesh, dimensions, primitive field (tmp).
391 //- [Takes current timeName from the mesh registry].
392 // For LEGACY_REGISTER, registration is determined by
393 // objectRegistry::is_cacheTemporaryObject().
395 (
396 const word& name,
398 const Mesh& mesh,
399 const dimensionSet& dims,
400 const tmp<Field<Type>>& tfield
401 );
402
403 //- Return tmp field (NO_READ, NO_WRITE)
404 //- from name, mesh, dimensions, primitive field (tmp).
405 //- [Takes current timeName from the mesh registry].
406 // Registration/persistence determined by
407 // objectRegistry::is_cacheTemporaryObject().
409 (
410 const word& name,
411 const Mesh& mesh,
412 const dimensionSet& dims,
413 const tmp<Field<Type>>& tfield
414 );
415
416 //- Return tmp field (NO_READ, NO_WRITE)
417 //- from name, mesh, dimensions.
418 //- [Takes current timeName from the mesh registry].
419 // For LEGACY_REGISTER, registration is determined by
420 // objectRegistry::is_cacheTemporaryObject().
422 (
423 const word& name,
425 const Mesh& mesh,
426 const dimensionSet& dims
427 );
428
429 //- Return tmp field (NO_READ, NO_WRITE)
430 //- from name, mesh, dimensions.
431 //- [Takes current timeName from the mesh registry].
432 // Registration/persistence determined by
433 // objectRegistry::is_cacheTemporaryObject().
435 (
436 const word& name,
437 const Mesh& mesh,
438 const dimensionSet& dims
439 );
440
441 //- Return tmp field (NO_READ, NO_WRITE)
442 //- from name, mesh, value, dimensions.
443 //- [Takes current timeName from the mesh registry].
444 // For LEGACY_REGISTER, registration is determined by
445 // objectRegistry::is_cacheTemporaryObject().
447 (
448 const word& name,
450 const Mesh& mesh,
451 const Type& value,
452 const dimensionSet& dims
453 );
454
455 //- Return tmp field (NO_READ, NO_WRITE)
456 //- from name, mesh, value, dimensions.
457 //- [Takes current timeName from the mesh registry].
458 // Registration/persistence determined by
459 // objectRegistry::is_cacheTemporaryObject().
461 (
462 const word& name,
463 const Mesh& mesh,
464 const Type& value,
465 const dimensionSet& dims
466 );
467
468 //- Return tmp field (NO_READ, NO_WRITE)
469 //- from name, mesh, dimensioned-type.
470 //- [Takes current timeName from the mesh registry].
471 // For LEGACY_REGISTER, registration is determined by
472 // objectRegistry::is_cacheTemporaryObject().
474 (
475 const word& name,
477 const Mesh& mesh,
478 const dimensioned<Type>& dt
479 );
480
481 //- Return tmp field (NO_READ, NO_WRITE)
482 //- from name, mesh, dimensioned-type.
483 //- [Takes current timeName from the mesh registry].
484 // Registration/persistence determined by
485 // objectRegistry::is_cacheTemporaryObject().
487 (
488 const word& name,
489 const Mesh& mesh,
490 const dimensioned<Type>& dt
491 );
492
493 //- Return renamed tmp field (NO_READ, NO_WRITE)
494 //- retaining its instance/local.
495 // For LEGACY_REGISTER, registration is determined by
496 // objectRegistry::is_cacheTemporaryObject().
498 (
499 const word& newName,
502 );
503
504 //- Return renamed tmp field (NO_READ, NO_WRITE)
505 //- retaining its instance/local.
506 // Registration/persistence determined by
507 // objectRegistry::is_cacheTemporaryObject().
509 (
510 const word& newName,
512 );
513
514 //- Construct tmp field (NO_READ, NO_WRITE)
515 //- based on mesh/registry information from an existing field.
516 //- [Takes instance from the field].
517 // Registration/persistence determined by
518 // objectRegistry::is_cacheTemporaryObject().
519 template<class AnyType>
521 (
523 const word& name,
524 const dimensionSet& dims
525 );
526
527 //- Construct tmp field (NO_READ, NO_WRITE)
528 //- based on mesh/registry information from an existing field
529 //- and initialise with value.
530 // Registration/persistence determined by
531 // objectRegistry::is_cacheTemporaryObject().
532 template<class AnyType>
534 (
536 const word& name,
537 const dimensioned<Type>& dt
538 );
539
540
541 //- Destructor
542 virtual ~DimensionedField();
544
545 // Member Functions
546
547 //- Resize to the mesh size and read the field from the dictionary.
548 //- Internal implementation checks field vs mesh size.
549 void readField
550 (
551 const dictionary& fieldDict,
552 const word& fieldDictEntry = "value"
553 );
554
555 //- Return non-const reference to this field
557 {
558 return const_cast<this_type&>(*this);
559 }
561 //- Return const reference to mesh
562 const Mesh& mesh() const noexcept { return mesh_; }
563
564 //- Return dimensions
565 const dimensionSet& dimensions() const noexcept { return dimensions_; }
566
567 //- Return non-const access to dimensions
568 dimensionSet& dimensions() noexcept { return dimensions_; }
569
570 //- Return oriented type
571 orientedType oriented() const noexcept { return oriented_; }
572
573 //- Return non-const access to the oriented type
574 orientedType& oriented() noexcept { return oriented_; }
575
576 //- True if field is ORIENTED
577 inline bool is_oriented() const noexcept;
578
579 //- Set the oriented flag: on/off
580 inline void setOriented(bool on = true) noexcept;
581
582 //- Return const-reference to the primitive field values
583 const DynamicField<Type>& field() const noexcept { return *this; }
584
585 //- Return reference to the primitive field values
586 DynamicField<Type>& field() noexcept { return *this; }
587
588
589 //- Return a component field of the field
590 tmp<DimensionedField<cmptType, GeoMesh>> component
591 (
592 const direction d
593 ) const;
594
595 //- Replace a component field of the field
596 void replace
597 (
598 const direction d,
600 );
601
602 //- Replace a component field of the field
603 void replace
604 (
605 const direction d,
607 );
608
609 // Inherits clamp, clamp_min, clamp_max (without dimensions) from Field
610
611 //- Return the field transpose (only defined for second rank tensors)
613
614 //- Return the global arithmetic average
615 dimensioned<Type> average(const label comm = UPstream::worldComm) const;
616
617 //- Return the global weighted average
619 (
621 const label comm = UPstream::worldComm
622 ) const;
623
624 //- Return the global weighted average
626 (
627 const tmp<DimensionedField<scalar, GeoMesh>>& tweights,
628 const label comm = UPstream::worldComm
629 ) const;
630
631
632 // Write
633
634 //- Write dimensions, oriented flag (if valid) and the
635 //- field data as a dictionary entry with the specified name.
636 bool writeData(Ostream& os, const word& fieldDictEntry) const;
637
638 //- The writeData function (required by regIOobject),
639 //- calls writeData with dictionary entry name = "value"
640 bool writeData(Ostream& os) const { return writeData(os, "value"); }
641
642
643 // Member Operators
644
647
648 //- Assign value (with dimension check)
649 void operator=(const dimensioned<Type>& dt);
650
651 //- Assign value zero (no dimension checks)
652 void operator=(Foam::zero);
653
656
659
665
666 void operator+=(const dimensioned<Type>& dt);
667 void operator-=(const dimensioned<Type>& dt);
668
669 void operator*=(const dimensioned<scalar>& dt);
670 void operator/=(const dimensioned<scalar>& dt);
672
673 // Ostream Operators
674
675 //- Calls DimensionedField::writeData()
677 (
678 Ostream& os,
680 );
681
682 //- Calls DimensionedField::writeData()
684 (
685 Ostream& os,
687 );
689
690
691// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
692
693} // End namespace Foam
694
695// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
696
697#include "DimensionedFieldI.H"
699
700#ifdef NoRepository
701 #include "DimensionedField.C"
702#endif
704// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
705
706#endif
707
708// ************************************************************************* //
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))
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< DimensionedField< Type, GeoMesh > > T() const
Return the field transpose (only defined for second rank tensors).
DynamicField< Type > & field() noexcept
Return reference to the primitive field values.
bool is_oriented() const noexcept
True if field is ORIENTED.
tmp< DimensionedField< Type, GeoMesh > > clone() const
Clone.
dimensionSet & dimensions() noexcept
Return non-const access to dimensions.
void operator=(Foam::zero)
Assign value zero (no dimension checks).
void readField(const dictionary &fieldDict, const word &fieldDictEntry="value")
Resize to the mesh size and read the field from the dictionary. Internal implementation checks field ...
void setOriented(bool on=true) noexcept
DimensionedField(const IOobject &io, const Mesh &mesh, const word &fieldDictEntry="value", const bool extraCapacity=false)
Construct from Istream (uses an intermediate dictionary).
DimensionedField(const word &newName, DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy or move construct, resetting name.
void operator/=(const DimensionedField< scalar, GeoMesh > &df)
static const this_type & null() noexcept
Return a null DimensionedField (reference to a nullObject).
DimensionedField(const IOobject &io, const Mesh &mesh, const Type &value, const dimensionSet &dims, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting dimensions and initial uniform field value.
TypeName("DimensionedField")
Runtime type information.
DimensionedField(const DimensionedField< Type, GeoMesh > &df)
Copy construct.
void operator-=(const dimensioned< Type > &dt)
void operator=(const dimensioned< Type > &dt)
Assign value (with dimension check).
void operator+=(const DimensionedField< Type, GeoMesh > &df)
DimensionedField< Type, areaMesh > Internal
static tmp< DimensionedField< Type, GeoMesh > > New(const word &newName, const tmp< DimensionedField< Type, GeoMesh > > &tfld)
Return renamed tmp field (NO_READ, NO_WRITE) retaining its instance/local.
DimensionedField< Type, areaMesh > this_type
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, move internal field contents....
void operator=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
DimensionedField(DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy construct or reuse (move) as specified.
void operator-=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &field)
Construct from components, copy initial field content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions. [Takes current timeName from the me...
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&field)
Construct from components, transferring initial field content.
bool writeData(Ostream &os) const
The writeData function (required by regIOobject), calls writeData with dictionary entry name = "value...
this_type & constCast() const noexcept
Return non-const reference to this field.
DimensionedField(const IOobject &io, DimensionedField< Type, GeoMesh > &df, bool reuse)
Copy or move construct, resetting IO parameters.
const DynamicField< Type > & field() const noexcept
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions. [Takes current timeName from the me...
void operator*=(const DimensionedField< scalar, GeoMesh > &df)
void operator/=(const tmp< DimensionedField< scalar, GeoMesh > > &tdf)
tmp< DimensionedField< cmptType, GeoMesh > > component(const direction d) const
Return a component field of the field.
DimensionedField(const IOobject &io, const Mesh &mesh, const dictionary &fieldDict, const word &fieldDictEntry="value", const bool extraCapacity=false)
Construct from dictionary.
void operator/=(const dimensioned< scalar > &dt)
const dimensionSet & dimensions() const noexcept
Return dimensions.
void operator=(const DimensionedField< Type, GeoMesh > &df)
void replace(const direction d, const DimensionedField< cmptType, GeoMesh > &df)
Replace a component field of the field.
orientedType oriented() const noexcept
Return oriented type.
bool writeData(Ostream &os, const word &fieldDictEntry) const
Write dimensions, oriented flag (if valid) and the field data as a dictionary entry with the specifie...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, primitive field (tmp)....
DimensionedField(const word &newName, const DimensionedField< Type, GeoMesh > &df)
Copy construct with a new name.
void operator+=(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
DimensionedField(const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct from tmp<DimensionedField> deleting argument.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensioned< Type > &dt, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting dimensions and initial uniform field value.
DimensionedField(const IOobject &io, const DimensionedField< Type, GeoMesh > &df)
Copy construct, resetting IO parameters.
void operator*=(const tmp< DimensionedField< scalar, GeoMesh > > &tdf)
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field....
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, List< Type > &&field)
Construct from components, transferring initial field content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensioned< Type > &dt)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensioned-type. [Takes current timeName from ...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const Type &value, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, value, dimensions. [Takes current timeName from...
DimensionedField(const IOobject &io, const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct from tmp<DimensionedField> deleting argument, resetting IO parameters.
static tmp< DimensionedField< Type, GeoMesh > > New(const DimensionedField< AnyType, GeoMesh > &fld, const word &name, const dimensionSet &dims)
Construct tmp field (NO_READ, NO_WRITE) based on mesh/registry information from an existing field....
dimensioned< Type > average(const label comm=UPstream::worldComm) const
Return the global arithmetic average.
friend Ostream & operator(Ostream &os, const DimensionedField< Type, GeoMesh > &df)
Calls DimensionedField::writeData().
DimensionedField(DimensionedField< Type, GeoMesh > &&df)
Move construct.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const bool checkIOFlags=true, const bool extraCapacity=false)
Construct from components, setting initial size and dimensions, but not initialising any field values...
dimensioned< Type > weightedAverage(const tmp< DimensionedField< scalar, GeoMesh > > &tweights, const label comm=UPstream::worldComm) const
Return the global weighted average.
void replace(const direction d, const tmp< DimensionedField< cmptType, GeoMesh > > &tdf)
Replace a component field of the field.
DimensionedField(const IOobject &io, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Construct from components, copy or transfer tmp content.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const tmp< Field< Type > > &tfield)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, primitive field (tmp)....
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weights, const label comm=UPstream::worldComm) const
Return the global weighted average.
orientedType & oriented() noexcept
Return non-const access to the oriented type.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensionSet &dims, Field< Type > &&iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, move internal field contents....
void operator-=(const DimensionedField< Type, GeoMesh > &df)
void operator*=(const dimensioned< scalar > &dt)
void operator+=(const dimensioned< Type > &dt)
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field....
DimensionedField(const word &newName, DimensionedField< Type, GeoMesh > &&df)
Move construct with a new name.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &newName, IOobjectOption::registerOption regOpt, const tmp< DimensionedField< Type, GeoMesh > > &tfld)
Return renamed tmp field (NO_READ, NO_WRITE) retaining its instance/local.
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const Type &value, const dimensionSet &dims)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, value, dimensions. [Takes current timeName from...
DimensionedField(const IOobject &io, DimensionedField< Type, GeoMesh > &&df)
Move construct, resetting IO parameters.
DimensionedField(const word &newName, const tmp< DimensionedField< Type, GeoMesh > > &tdf)
Construct with a new name from tmp<DimensionedField>.
static tmp< DimensionedField< Type, GeoMesh > > New(const DimensionedField< AnyType, GeoMesh > &fld, const word &name, const dimensioned< Type > &dt)
Construct tmp field (NO_READ, NO_WRITE) based on mesh/registry information from an existing field and...
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, const Mesh &mesh, const dimensioned< Type > &dt)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensioned-type. [Takes current timeName from ...
virtual ~DimensionedField()
Destructor.
Dynamically sized Field. Similar to DynamicList, but inheriting from a Field instead of a List.
constexpr DynamicField() noexcept
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
pTraits< Type >::cmptType cmptType
Component type.
Definition Field.H:178
registerOption
Enumeration for use with registerObject(). Values map to bool (false/true).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
const word & name() const noexcept
Return the object name.
Definition IOobjectI.H:205
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
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
Definition UPstream.H:1069
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Dimension set for the base types, which can be used to implement rigorous dimension checking for alge...
Generic dimensioned Type class.
Class to determine the 'oriented' status of surface fields.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
rDeltaTY field()
dynamicFvMesh & mesh
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Namespace for OpenFOAM.
const T & NullObjectRef() noexcept
Const reference (of type T) to the nullObject.
Definition nullObject.H:228
uint8_t direction
Definition direction.H:49
const direction noexcept
Definition scalarImpl.H:265
Foam::argList args(argc, argv)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68