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-------------------------------------------------------------------------------
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
27\*---------------------------------------------------------------------------*/
28
29#include "IOmapDistribute.H"
30
31/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32
33namespace Foam
34{
36}
37
38
39// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41bool Foam::IOmapDistribute::readContents()
42{
43 if
44 (
45 (
48 )
50 )
51 {
52 readStream(typeName) >> *this;
53 close();
54 return true;
55 }
56
57 return false;
58}
59
60
61// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
62
64:
66{
67 // Warn for MUST_READ_IF_MODIFIED
68 warnNoRereading<IOmapDistribute>();
69
70 readContents();
71}
72
73
75(
76 const IOobject& io,
77 const mapDistribute& map
78)
79:
81{
82 // Warn for MUST_READ_IF_MODIFIED
83 warnNoRereading<IOmapDistribute>();
84
85 if (!readContents())
86 {
88 }
89}
90
91
93(
94 const IOobject& io,
95 mapDistribute&& map
96)
97:
99{
100 // Warn for MUST_READ_IF_MODIFIED
101 warnNoRereading<IOmapDistribute>();
102
104
105 readContents();
106}
107
108
109// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110
112{
113 return (is >> *this).good();
114}
115
116
118{
119 return (os << *this).good();
120}
121
122
123// ************************************************************************* //
IOmapDistribute is derived from mapDistribute and IOobject to give the mapDistribute automatic IO fun...
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
@ MUST_READ_IF_MODIFIED
Definition: IOobject.H:180
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class containing processor-to-processor mapping information.
void operator=(const mapDistribute &rhs)
Copy assignment.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:76
void close()
Close Istream.
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition: regIOobject.C:438
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
OBJstream os(runTime.globalPath()/outputName)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Namespace for OpenFOAM.