Loading...
Searching...
No Matches
GlobalIOField.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) 2015-2017 OpenFOAM Foundation
9 Copyright (C) 2016-2024 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::GlobalIOField
29
30Description
31 IOField with global data (so optionally read from master)
32
33SourceFiles
34 GlobalIOField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_GlobalIOField_H
39#define Foam_GlobalIOField_H
40
41#include "IOField.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class GlobalIOField Declaration
50\*---------------------------------------------------------------------------*/
51
52template<class Type>
53class GlobalIOField
54:
55 public regIOobject,
56 public Field<Type>
57{
58public:
59
60 //- The underlying content type
62
63 //- Runtime type information
64 TypeName("Field");
65
66
67 // Constructors
68
69 //- Default copy construct
70 GlobalIOField(const GlobalIOField&) = default;
72 //- Construct from IOobject. Will be zero size if not read.
73 explicit GlobalIOField(const IOobject& io);
74
75 //- Construct from IOobject and field size (if not read)
76 GlobalIOField(const IOobject& io, const label len);
77
78 //- Construct from IOobject and copy of List/Field content
79 GlobalIOField(const IOobject& io, const UList<Type>& content);
80
81 //- Construct by transferring the Field content
82 GlobalIOField(const IOobject& io, Field<Type>&& content);
83
84 //- Construct by copying/moving tmp content
85 GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tfld);
87
88 // Factory Methods
89
90 //- Read and return contents. The IOobject is never registered
92
93
94 //- Destructor
95 virtual ~GlobalIOField() = default;
97
98 // Member Functions
99
100 //- The object is global
101 virtual bool global() const
102 {
103 return true;
105
106 //- Return complete path + object name if the file exists
107 //- either in the case/processor or case, otherwise null
108 virtual fileName filePath() const
109 {
111 }
112
113 //- The readData method for regIOobject read operation
114 virtual bool readData(Istream& is);
115
116 //- The writeData method for regIOobject write operation
117 bool writeData(Ostream& os) const;
119
120 // Member Operators
121
122 //- Copy or move assignment of entries
123 using Field<Type>::operator=;
124
125 //- Copy assignment of entries
129 }
130
131 //- Move assignment of entries
133 {
134 Field<Type>::operator=(std::move(static_cast<Field<Type>&>(rhs)));
136};
137
138
139// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141} // End namespace Foam
142
143// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144
145#ifdef NoRepository
146# include "GlobalIOField.C"
147#endif
148
149// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150
151#endif
152
153// ************************************************************************* //
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
IOField with global data (so optionally read from master).
GlobalIOField(const IOobject &io, const tmp< Field< Type > > &tfld)
Construct by copying/moving tmp content.
void operator=(const GlobalIOField< Type > &rhs)
Copy assignment of entries.
GlobalIOField(const IOobject &io, Field< Type > &&content)
Construct by transferring the Field content.
GlobalIOField(const IOobject &io, const UList< Type > &content)
Construct from IOobject and copy of List/Field content.
bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
virtual bool global() const
The object is global.
GlobalIOField(const IOobject &io)
Construct from IOobject. Will be zero size if not read.
void operator=(GlobalIOField< Type > &&rhs)
Move assignment of entries.
static Field< Type > readContents(const IOobject &io)
Read and return contents. The IOobject is never registered.
GlobalIOField(const IOobject &io, const label len)
Construct from IOobject and field size (if not read).
TypeName("Field")
Runtime type information.
virtual ~GlobalIOField()=default
Destructor.
virtual fileName filePath() const
Return complete path + object name if the file exists either in the case/processor or case,...
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Field< Type > content_type
The underlying content type.
GlobalIOField(const GlobalIOField &)=default
Default copy construct.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
fileName globalFilePath(const word &typeName, const bool search=true) const
Redirect to fileHandler filePath, searching up if in parallel.
Definition IOobject.C:604
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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 for handling file names.
Definition fileName.H:75
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
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Namespace for OpenFOAM.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68