IOmapDistributePolyMesh.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) 2015 OpenFOAM Foundation
9 Copyright (C) 2022 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
30
31/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32
33namespace Foam
34{
36}
37
38
39// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41bool Foam::IOmapDistributePolyMesh::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<IOmapDistributePolyMesh>();
69
70 readContents();
71}
72
73
75(
76 const IOobject& io,
77 const mapDistributePolyMesh& map
78)
79:
81{
82 // Warn for MUST_READ_IF_MODIFIED
83 warnNoRereading<IOmapDistributePolyMesh>();
84
85 if (!readContents())
86 {
88 }
89}
90
91
93(
94 const IOobject& io,
96)
97:
99{
100 // Warn for MUST_READ_IF_MODIFIED
101 warnNoRereading<IOmapDistributePolyMesh>();
102
104
105 readContents();
106}
107
108
110(
111 const IOobject& io,
112 const mapDistributePolyMesh& map
113)
114:
116 contentRef_(map) // cref
117{}
118
119
120// Not sure if we need this yet...
121//
133
134
135// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136
138{
139 is >> *this;
140 return is.good();
141}
142
143
145{
146 os << *this;
147 return os.good();
148}
149
150
152{
153 is >> contentRef_.ref();
154 return is.good();
155}
156
157
159{
160 os << contentRef_.cref();
161 return os.good();
162}
163
164
165// ************************************************************************* //
IOmapDistributePolyMeshRef()=delete
No default construct.
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
IOmapDistributePolyMesh is derived from mapDistributePolyMesh and IOobject to give the mapDistributeP...
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
virtual bool readData(Istream &is)
The readData method 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
bool good() const noexcept
True if next operation might succeed.
Definition: IOstream.H:233
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 mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void operator=(const mapDistributePolyMesh &map)
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.