IOmapDistribute.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) 2014-2015 OpenFOAM Foundation
9  Copyright (C) 2015-2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "IOmapDistribute.H"
30 
31 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(IOmapDistribute, 0);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
43  regIOobject(io)
44 {
45  // Warn for MUST_READ_IF_MODIFIED
46  warnNoRereading<IOmapDistribute>();
47 
48  if
49  (
50  (
53  )
55  )
56  {
57  readStream(typeName) >> *this;
58  close();
59  }
60 }
61 
62 
64 (
65  const IOobject& io,
66  const mapDistribute& map
67 )
68 :
69  regIOobject(io)
70 {
71  // Warn for MUST_READ_IF_MODIFIED
72  warnNoRereading<IOmapDistribute>();
73 
74  if
75  (
76  (
79  )
80  || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
81  )
82  {
83  readStream(typeName) >> *this;
84  close();
85  }
86  else
87  {
89  }
90 }
91 
92 
94 (
95  const IOobject& io,
96  mapDistribute&& map
97 )
98 :
99  regIOobject(io)
100 {
101  // Warn for MUST_READ_IF_MODIFIED
102  warnNoRereading<IOmapDistribute>();
103 
105 
106  if
107  (
108  (
111  )
112  || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
113  )
114  {
115  readStream(typeName) >> *this;
116  close();
117  }
118 }
119 
120 
121 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 
124 {
125  return (is >> *this).good();
126 }
127 
128 
130 {
131  return (os << *this).good();
132 }
133 
134 
135 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::mapDistribute::operator=
void operator=(const mapDistribute &rhs)
Copy assignment.
Definition: mapDistribute.C:548
Foam::IOmapDistribute::IOmapDistribute
IOmapDistribute(const IOobject &io)
Construct given an IOobject.
Definition: IOmapDistribute.C:41
Foam::IOmapDistribute::writeData
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition: IOmapDistribute.C:129
Foam::mapDistribute::transfer
void transfer(mapDistribute &map)
Transfer the contents of the argument and annul the argument.
Definition: mapDistribute.C:533
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:163
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
Foam::IOmapDistribute::readData
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition: IOmapDistribute.C:123
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
IOmapDistribute.H
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:171
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::regIOobject::readStream
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
Definition: regIOobjectRead.C:129
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::regIOobject::headerOk
bool headerOk()
Read and check header info.
Definition: regIOobject.C:436
Foam::IOobject::MUST_READ
Definition: IOobject.H:185