OpenFOAM: API Guide
v2112
The open source CFD toolbox
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
-------------------------------------------------------------------------------
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 "
IOmapDistributePolyMesh.H
"
30
31
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32
33
namespace
Foam
34
{
35
defineTypeNameAndDebug
(
IOmapDistributePolyMesh
, 0);
36
}
37
38
39
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41
bool
Foam::IOmapDistributePolyMesh::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::IOmapDistributePolyMesh::IOmapDistributePolyMesh
(
const
IOobject
&
io
)
64
:
65
regIOobject
(
io
)
66
{
67
// Warn for MUST_READ_IF_MODIFIED
68
warnNoRereading<IOmapDistributePolyMesh>();
69
70
readContents();
71
}
72
73
74
Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
75
(
76
const
IOobject
&
io
,
77
const
mapDistributePolyMesh
& map
78
)
79
:
80
regIOobject
(
io
)
81
{
82
// Warn for MUST_READ_IF_MODIFIED
83
warnNoRereading<IOmapDistributePolyMesh>();
84
85
if
(!readContents())
86
{
87
mapDistributePolyMesh::operator=
(map);
88
}
89
}
90
91
92
Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
93
(
94
const
IOobject
&
io
,
95
mapDistributePolyMesh
&& map
96
)
97
:
98
regIOobject
(
io
)
99
{
100
// Warn for MUST_READ_IF_MODIFIED
101
warnNoRereading<IOmapDistributePolyMesh>();
102
103
mapDistributePolyMesh::transfer
(map);
104
105
readContents();
106
}
107
108
109
Foam::IOmapDistributePolyMeshRef::IOmapDistributePolyMeshRef
110
(
111
const
IOobject
&
io
,
112
const
mapDistributePolyMesh
& map
113
)
114
:
115
regIOobject
(
io
),
116
contentRef_(map)
// cref
117
{}
118
119
120
// Not sure if we need this yet...
121
//
133
134
135
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
136
137
bool
Foam::IOmapDistributePolyMesh::readData
(
Istream
& is)
138
{
139
is >> *
this
;
140
return
is.
good
();
141
}
142
143
144
bool
Foam::IOmapDistributePolyMesh::writeData
(
Ostream
&
os
)
const
145
{
146
os
<< *
this
;
147
return
os
.
good
();
148
}
149
150
151
bool
Foam::IOmapDistributePolyMeshRef::readData
(
Istream
& is)
152
{
153
is >> contentRef_.ref();
154
return
is.
good
();
155
}
156
157
158
bool
Foam::IOmapDistributePolyMeshRef::writeData
(
Ostream
&
os
)
const
159
{
160
os
<< contentRef_.cref();
161
return
os
.
good
();
162
}
163
164
165
// ************************************************************************* //
IOmapDistributePolyMesh.H
Foam::IOmapDistributePolyMeshRef::IOmapDistributePolyMeshRef
IOmapDistributePolyMeshRef()=delete
No default construct.
Foam::IOmapDistributePolyMeshRef::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOmapDistributePolyMesh.C:158
Foam::IOmapDistributePolyMeshRef::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition:
IOmapDistributePolyMesh.C:151
Foam::IOmapDistributePolyMesh
IOmapDistributePolyMesh is derived from mapDistributePolyMesh and IOobject to give the mapDistributeP...
Definition:
IOmapDistributePolyMesh.H:59
Foam::IOmapDistributePolyMesh::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOmapDistributePolyMesh.C:144
Foam::IOmapDistributePolyMesh::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition:
IOmapDistributePolyMesh.C:137
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::IOstream::good
bool good() const noexcept
True if next operation might succeed.
Definition:
IOstream.H:233
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::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition:
mapDistributePolyMesh.H:67
Foam::mapDistributePolyMesh::operator=
void operator=(const mapDistributePolyMesh &map)
Copy assignment.
Definition:
mapDistributePolyMesh.C:356
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
IOmapDistributePolyMesh.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.