OpenFOAM
v2406
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-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 "
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::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::IOmapDistributePolyMesh::IOmapDistributePolyMesh
(
const
IOobject
&
io
)
57
:
58
regIOobject
(
io
)
59
{
60
// Warn for MUST_READ_IF_MODIFIED
61
warnNoRereading<IOmapDistributePolyMesh>();
62
63
readIOcontents();
64
}
65
66
67
Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
68
(
69
const
IOobject
&
io
,
70
const
mapDistributePolyMesh
& map
71
)
72
:
73
regIOobject
(
io
)
74
{
75
// Warn for MUST_READ_IF_MODIFIED
76
warnNoRereading<IOmapDistributePolyMesh>();
77
78
if
(!readIOcontents())
79
{
80
mapDistributePolyMesh::operator=
(map);
81
}
82
}
83
84
85
Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
86
(
87
const
IOobject&
io
,
88
mapDistributePolyMesh&& map
89
)
90
:
91
regIOobject(
io
)
92
{
93
// Warn for MUST_READ_IF_MODIFIED
94
warnNoRereading<IOmapDistributePolyMesh>();
95
96
mapDistributePolyMesh::transfer
(map);
97
98
readIOcontents();
99
}
100
101
102
Foam::IOmapDistributePolyMeshRef::IOmapDistributePolyMeshRef
103
(
104
const
IOobject
&
io
,
105
const
mapDistributePolyMesh
& map
106
)
107
:
108
regIOobject
(
io
),
109
contentRef_(map)
// cref
110
{}
111
112
113
// Not sure if we need this yet...
114
//
126
127
128
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
129
130
bool
Foam::IOmapDistributePolyMesh::readData
(
Istream
& is)
131
{
132
is >> *
this
;
133
return
is.
good
();
134
}
135
136
137
bool
Foam::IOmapDistributePolyMesh::writeData
(
Ostream
&
os
)
const
138
{
139
os
<< *
this
;
140
return
os
.
good
();
141
}
142
143
144
bool
Foam::IOmapDistributePolyMeshRef::readData
(
Istream
& is)
145
{
146
is >> contentRef_.ref();
147
return
is.
good
();
148
}
149
150
151
bool
Foam::IOmapDistributePolyMeshRef::writeData
(
Ostream
&
os
)
const
152
{
153
os
<< contentRef_.cref();
154
return
os
.
good
();
155
}
156
157
158
// ************************************************************************* //
Foam::IOmapDistributePolyMesh::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition:
IOmapDistributePolyMesh.C:123
Foam::mapDistributePolyMesh::operator=
void operator=(const mapDistributePolyMesh &map)
Copy assignment.
Definition:
mapDistributePolyMesh.C:349
Foam::IOmapDistributePolyMeshRef::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition:
IOmapDistributePolyMesh.C:137
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::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition:
mapDistributePolyMesh.H:65
Foam::IOmapDistributePolyMeshRef::IOmapDistributePolyMeshRef
IOmapDistributePolyMeshRef()=delete
No default construct.
Foam::IOobjectOption::isReadOptional
bool isReadOptional() const noexcept
True if (LAZY_READ) bits are set [same as READ_IF_PRESENT].
Definition:
IOobjectOption.H:346
IOmapDistributePolyMesh.H
Foam::IOmapDistributePolyMeshRef::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOmapDistributePolyMesh.C:144
Foam::mapDistributePolyMesh::transfer
void transfer(mapDistributePolyMesh &map)
Transfer the contents of the argument and annul the argument.
Definition:
mapDistributePolyMesh.C:252
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::IOmapDistributePolyMesh::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition:
IOmapDistributePolyMesh.C:130
Foam::IOstream::good
bool good() const noexcept
True if next operation might succeed.
Definition:
IOstream.H:281
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::IOmapDistributePolyMesh::IOmapDistributePolyMesh
IOmapDistributePolyMesh(const IOobject &io)
Construct from IOobject.
Definition:
IOmapDistributePolyMesh.C:49
Foam
Namespace for OpenFOAM.
Definition:
atmBoundaryLayer.C:26
src
OpenFOAM
meshes
polyMesh
mapPolyMesh
mapDistribute
IOmapDistributePolyMesh.C
Generated by
1.8.14