OpenFOAM
v2406
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-2024 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::readIOcontents()
42
{
43
if
(
isReadRequired
() || (
isReadOptional
() &&
headerOk
()))
44
{
45
readStream
(typeName) >> *
this
;
46
close
();
47
return
true
;
48
}
49
50
return
false
;
51
}
52
53
54
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55
56
Foam::IOmapDistribute::IOmapDistribute
(
const
IOobject
&
io
)
57
:
58
regIOobject
(
io
)
59
{
60
// Warn for MUST_READ_IF_MODIFIED
61
warnNoRereading<IOmapDistribute>();
62
63
readIOcontents();
64
}
65
66
67
Foam::IOmapDistribute::IOmapDistribute
68
(
69
const
IOobject
&
io
,
70
const
mapDistribute
& map
71
)
72
:
73
regIOobject
(
io
)
74
{
75
// Warn for MUST_READ_IF_MODIFIED
76
warnNoRereading<IOmapDistribute>();
77
78
if
(!readIOcontents())
79
{
80
mapDistribute::operator=
(map);
81
}
82
}
83
84
85
Foam::IOmapDistribute::IOmapDistribute
86
(
87
const
IOobject&
io
,
88
mapDistribute&& map
89
)
90
:
91
regIOobject(
io
)
92
{
93
// Warn for MUST_READ_IF_MODIFIED
94
warnNoRereading<IOmapDistribute>();
95
96
mapDistribute::transfer
(map);
97
98
readIOcontents();
99
}
100
101
102
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
103
104
bool
Foam::IOmapDistribute::readData
(
Istream
& is)
105
{
106
return
(is >> *
this
).good();
107
}
108
109
110
bool
Foam::IOmapDistribute::writeData
(
Ostream
&
os
)
const
111
{
112
return
(
os
<< *
this
).good();
113
}
114
115
116
// ************************************************************************* //
IOmapDistribute.H
Foam::IOmapDistribute::IOmapDistribute
IOmapDistribute(const IOobject &io)
Construct from IOobject.
Definition:
IOmapDistribute.C:49
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition:
Istream.H:57
Foam::regIOobject::headerOk
bool headerOk()
Read and check header info. Does not check the headerClassName.
Definition:
regIOobject.C:505
Foam::mapDistribute::operator=
void operator=(const mapDistribute &rhs)
Copy assignment.
Definition:
mapDistribute.C:507
Foam::IOobjectOption::isReadOptional
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
Definition:
IOobjectOption.H:346
Foam::IOmapDistribute::writeData
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
Definition:
IOmapDistribute.C:103
Foam::regIOobject::close
void close()
Close Istream.
Definition:
regIOobjectRead.C:161
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition:
Ostream.H:56
os
OBJstream os(runTime.globalPath()/outputName)
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::IOobjectOption::isReadRequired
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
Definition:
IOobjectOption.H:330
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition:
mapDistribute.H:156
Foam::mapDistribute::transfer
void transfer(mapDistribute &map)
Transfer the contents of the argument and annul the argument.
Definition:
mapDistribute.C:492
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition:
regIOobject.H:68
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition:
IOobject.H:180
Foam::regIOobject::readStream
Istream & readStream(const word &, const bool readOnProc=true)
Return Istream and check object type against that given.
Definition:
regIOobjectRead.C:119
Foam::IOmapDistribute::readData
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
Definition:
IOmapDistribute.C:97
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
src
OpenFOAM
meshes
polyMesh
mapPolyMesh
mapDistribute
IOmapDistribute.C
Generated by
1.8.14