GlobalIOField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "GlobalIOField.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 :
33  regIOobject(io)
34 {
35  // Check for MUST_READ_IF_MODIFIED
36  warnNoRereading<GlobalIOField<Type>>();
37 
38  readHeaderOk(IOstream::BINARY, typeName);
39 }
40 
41 
42 template<class Type>
44 :
45  regIOobject(io)
46 {
47  // Check for MUST_READ_IF_MODIFIED
48  warnNoRereading<GlobalIOField<Type>>();
49 
50  if (!readHeaderOk(IOstream::BINARY, typeName))
51  {
53  }
54 }
55 
56 
57 template<class Type>
59 (
60  const IOobject& io,
61  const Field<Type>& f
62 )
63 :
64  regIOobject(io)
65 {
66  // Check for MUST_READ_IF_MODIFIED
67  warnNoRereading<GlobalIOField<Type>>();
68 
69  if (!readHeaderOk(IOstream::BINARY, typeName))
70  {
72  }
73 }
74 
75 
76 template<class Type>
78 (
79  const IOobject& io,
80  Field<Type>&& f
81 )
82 :
83  regIOobject(io),
84  Field<Type>(move(f))
85 
86 {
87  // Check for MUST_READ_IF_MODIFIED
88  warnNoRereading<GlobalIOField<Type>>();
89 
90  readHeaderOk(IOstream::BINARY, typeName);
91 }
92 
93 
94 template<class Type>
96 (
97  const GlobalIOField<Type>& field
98 )
99 :
100  regIOobject(field),
102 {}
103 
104 
105 template<class Type>
107 (
108  GlobalIOField<Type>&& field
109 )
110 :
111  regIOobject(move(field)),
112  Field<Type>(move(field))
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
117 
118 template<class Type>
120 {}
121 
122 
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
124 
125 template<class Type>
127 {
128  is >> *this;
129  return is.good();
130 }
131 
132 
133 template<class Type>
135 {
136  return (os << static_cast<const Field<Type>&>(*this)).good();
137 }
138 
139 
140 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
141 
142 template<class Type>
144 {
146 }
147 
148 
149 template<class Type>
151 {
152  Field<Type>::operator=(move(rhs));
153 }
154 
155 
156 template<class Type>
158 {
160 }
161 
162 
163 template<class Type>
165 {
166  Field<Type>::operator=(move(rhs));
167 }
168 
169 
170 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void operator=(const GlobalIOField< Type > &)
bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
virtual ~GlobalIOField()
Destructor.
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:330
points setSize(newPointi)
Pre-declare SubField and related Field type.
Definition: Field.H:56
IOField with global data (so optionally read from master)
Definition: GlobalIOField.H:50
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
GlobalIOField(const IOobject &)
Construct from IOobject.
Definition: GlobalIOField.C:31
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:52
rDeltaTY field()
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92