Loading...
Searching...
No Matches
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-2025 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\*---------------------------------------------------------------------------*/
30
31/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
32
33namespace Foam
34{
36}
37
38
39// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
40
41bool Foam::IOmapDistributePolyMesh::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 mapDistributePolyMesh& 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 mapDistributePolyMesh&& map
89)
90:
91 regIOobject(io)
92{
93 // Warn for MUST_READ_IF_MODIFIED
104 const IOobject& io,
105 const mapDistributePolyMesh& map
106)
107:
109 contentRef_(map) // cref
110{}
111
112
113// Not sure if we need this yet...
114//
122/// contentRef_()
123/// {
124/// contentRef_.ref(map); // writable reference
125/// }
126
127// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
128
130(
131 const IOobject& io,
132 const mapDistributePolyMesh& map
133)
134{
136 (
138 map
139 );
141 writer.write();
142}
143
144
145// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
146
148{
149 is >> *this;
150 return is.good();
151}
152
153
155{
156 os << *this;
157 return os.good();
158}
159
160
162{
163 is >> contentRef_.ref();
164 return is.good();
165}
166
167
169{
170 os << contentRef_.cref();
171 return os.good();
172}
173
174
175// ************************************************************************* //
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
A IOmapDistributePolyMesh wrapper for using referenced external data.
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...
static void writeContents(const IOobject &io, const mapDistributePolyMesh &map)
Write contents. The IOobject is never registered.
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
IOmapDistributePolyMesh(const IOobject &io)
Construct from IOobject.
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
@ NO_REGISTER
Do not request registration (bool: false).
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.
bool good() const noexcept
True if next operation might succeed.
Definition IOstream.H:281
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 mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
void operator=(const mapDistributePolyMesh &map)
Copy assignment.
mapDistributePolyMesh()
Default construct - uses worldComm.
void transfer(mapDistributePolyMesh &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")