GlobalIOList.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-2018 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 "GlobalIOList.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class Type>
32 :
33  regIOobject(io)
34 {
35  // Check for MUST_READ_IF_MODIFIED
36  warnNoRereading<GlobalIOList<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<GlobalIOList<Type>>();
49 
50  if (!readHeaderOk(IOstream::BINARY, typeName))
51  {
52  List<Type>::setSize(size);
53  }
54 }
55 
56 
57 template<class Type>
59 :
60  regIOobject(io)
61 {
62  // Check for MUST_READ_IF_MODIFIED
63  warnNoRereading<GlobalIOList<Type>>();
64 
65  if (!readHeaderOk(IOstream::BINARY, typeName))
66  {
68  }
69 }
70 
71 
72 template<class Type>
74 (
75  const IOobject& io,
76  const Xfer<List<Type>>& f
77 )
78 :
79  regIOobject(io)
80 {
81  // Check for MUST_READ_IF_MODIFIED
82  warnNoRereading<GlobalIOList<Type>>();
83 
85 
86  readHeaderOk(IOstream::BINARY, typeName);
87 }
88 
89 
90 // * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
91 
92 template<class Type>
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class Type>
101 {
102  is >> *this;
103  return is.good();
104 }
105 
106 
107 template<class Type>
109 {
110  return (os << *this).good();
111 }
112 
113 
114 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
115 
116 template<class Type>
118 {
120 }
121 
122 
123 template<class Type>
125 {
127 }
128 
129 
130 // ************************************************************************* //
A simple container for copying or transferring objects of type <T>.
Definition: Xfer.H:85
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
bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: GlobalIOList.C:108
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition: GlobalIOList.C:100
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:333
regIOobject(const IOobject &, const bool isTime=false)
Construct from IOobject. Optional flag for if IOobject is the.
Definition: regIOobject.C:56
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual ~GlobalIOList()
Destructor.
Definition: GlobalIOList.C:93
IOList with global data (so optionally read from master)
Definition: GlobalIOList.H:50
labelList f(nPoints)
void operator=(const UList< T > &)
Assignment to UList operator. Takes linear time.
Definition: List.C:376
void setSize(const label)
Reset size of List.
Definition: List.C:281
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
GlobalIOList(const IOobject &)
Construct from IOobject.
Definition: GlobalIOList.C:31
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
label size() const
Return the number of elements in the UList.
Definition: ListI.H:170
bool readHeaderOk(const IOstream::streamFormat PstreamFormat, const word &typeName)
Helper: check readOpt flags and read if necessary.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:342
void operator=(const GlobalIOList< Type > &)
Definition: GlobalIOList.C:117