Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
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\*---------------------------------------------------------------------------*/
29#include "IOmapDistribute.H"
30
31/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32
33namespace Foam
34{
36}
37
38
39// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41bool Foam::IOmapDistribute::readIOcontents()
42{
43 if (isReadRequired() || (isReadOptional() && headerOk()))
44 {
45 readStream(typeName) >> *this;
46 close();
47 return true;
48 }
50 return false;
51}
52
53
54// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
55
57:
59{
60 // Warn for MUST_READ_IF_MODIFIED
62
63 readIOcontents();
64}
65
66
68(
69 const IOobject& io,
70 const mapDistribute& map
71)
72:
74{
75 // Warn for MUST_READ_IF_MODIFIED
77
78 if (!readIOcontents())
79 {
81 }
82}
83
84
86(
87 const IOobject& io,
88 mapDistribute&& map
89)
90:
91 regIOobject(io)
92{
93 // Warn for MUST_READ_IF_MODIFIED
95
98 readIOcontents();
99}
100
101
102// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105{
106 return (is >> *this).good();
107}
108
109
111{
112 return (os << *this).good();
113}
114
115
116// ************************************************************************* //
IOmapDistribute is derived from mapDistribute and IOobject to give the mapDistribute automatic IO fun...
IOmapDistribute(const IOobject &io)
Construct from IOobject.
virtual bool writeData(Ostream &) const
WriteData function required for regIOobject write operation.
virtual bool readData(Istream &)
ReadData function required for regIOobject read operation.
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
bool isReadRequired() const noexcept
True if (MUST_READ | READ_MODIFIED) bits are set.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
void warnNoRereading() const
Helper: warn that type does not support re-reading.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class containing processor-to-processor mapping information.
void operator=(const mapDistribute &rhs)
Copy assignment.
mapDistribute() noexcept
Default construct - uses worldComm.
void transfer(mapDistribute &map)
Transfer the contents of the argument and annul the argument.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition regIOobject.H:71
void close()
Close Istream.
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
Definition regIOobject.C:43
bool headerOk()
Read and check header info. Does not check the headerClassName.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
OBJstream os(runTime.globalPath()/outputName)
const auto & io
Namespace for OpenFOAM.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")