OpenFOAM: API Guide
v2112
The open source CFD toolbox
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
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41
bool
Foam::IOmapDistribute::readContents()
42
{
43
if
44
(
45
(
46
readOpt
() ==
IOobject::MUST_READ
47
||
readOpt
() ==
IOobject::MUST_READ_IF_MODIFIED
48
)
49
|| (
readOpt
() ==
IOobject::READ_IF_PRESENT
&&
headerOk
())
50
)
51
{
52
readStream(typeName) >> *
this
;
53
close
();
54
return
true
;
55
}
56
57
return
false
;
58
}
59
60
61
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
62
63
Foam::IOmapDistribute::IOmapDistribute
(
const
IOobject
&
io
)
64
:
65
regIOobject
(
io
)
66
{
67
// Warn for MUST_READ_IF_MODIFIED
68
warnNoRereading<IOmapDistribute>();
69
70
readContents();
71
}
72
73
74
Foam::IOmapDistribute::IOmapDistribute
75
(
76
const
IOobject
&
io
,
77
const
mapDistribute
& map
78
)
79
:
80
regIOobject
(
io
)
81
{
82
// Warn for MUST_READ_IF_MODIFIED
83
warnNoRereading<IOmapDistribute>();
84
85
if
(!readContents())
86
{
87
mapDistribute::operator=
(map);
88
}
89
}
90
91
92
Foam::IOmapDistribute::IOmapDistribute
93
(
94
const
IOobject
&
io
,
95
mapDistribute
&& map
96
)
97
:
98
regIOobject
(
io
)
99
{
100
// Warn for MUST_READ_IF_MODIFIED
101
warnNoRereading<IOmapDistribute>();
102
103
mapDistribute::transfer
(map);
104
105
readContents();
106
}
107
108
109
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
110
111
bool
Foam::IOmapDistribute::readData
(
Istream
& is)
112
{
113
return
(is >> *
this
).good();
114
}
115
116
117
bool
Foam::IOmapDistribute::writeData
(
Ostream
&
os
)
const
118
{
119
return
(
os
<< *
this
).good();
120
}
121
122
123
// ************************************************************************* //
IOmapDistribute.H
Foam::IOmapDistribute
IOmapDistribute is derived from mapDistribute and IOobject to give the mapDistribute automatic IO fun...
Definition:
IOmapDistribute.H:58
Foam::IOmapDistribute::writeData
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition:
IOmapDistribute.C:117
Foam::IOmapDistribute::readData
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition:
IOmapDistribute.C:111
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition:
IOobjectI.H:164
Foam::IOobject::MUST_READ_IF_MODIFIED
@ MUST_READ_IF_MODIFIED
Definition:
IOobject.H:180
Foam::IOobject::READ_IF_PRESENT
@ READ_IF_PRESENT
Definition:
IOobject.H:181
Foam::IOobject::MUST_READ
@ MUST_READ
Definition:
IOobject.H:179
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition:
Istream.H:64
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition:
Ostream.H:62
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition:
mapDistribute.H:163
Foam::mapDistribute::operator=
void operator=(const mapDistribute &rhs)
Copy assignment.
Definition:
mapDistribute.C:477
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:76
Foam::regIOobject::close
void close()
Close Istream.
Definition:
regIOobjectRead.C:173
Foam::regIOobject::headerOk
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition:
regIOobject.C:438
Foam::regionModels::surfaceFilmModels::kinematicSingleLayer::transfer
transferModelList & transfer()
Transfer.
Definition:
kinematicSingleLayerI.H:188
defineTypeNameAndDebug
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition:
className.H:121
os
OBJstream os(runTime.globalPath()/outputName)
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:34
src
OpenFOAM
meshes
polyMesh
mapPolyMesh
mapDistribute
IOmapDistribute.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.