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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 
30 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
31 
32 namespace Foam
33 {
34 defineTypeNameAndDebug(IOmapDistributePolyMesh, 0);
35 }
36 
37 
38 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 
41 :
42  regIOobject(io)
43 {
44  // Warn for MUST_READ_IF_MODIFIED
45  warnNoRereading<IOmapDistributePolyMesh>();
46 
47  if
48  (
49  (
52  )
54  )
55  {
56  readStream(typeName) >> *this;
57  close();
58  }
59 }
60 
61 
63 (
64  const IOobject& io,
65  const mapDistributePolyMesh& map
66 )
67 :
68  regIOobject(io)
69 {
70  // Warn for MUST_READ_IF_MODIFIED
71  warnNoRereading<IOmapDistributePolyMesh>();
72 
73  if
74  (
75  (
78  )
79  || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
80  )
81  {
82  readStream(typeName) >> *this;
83  close();
84  }
85  else
86  {
88  }
89 }
90 
91 
93 (
94  const IOobject& io,
96 )
97 :
98  regIOobject(io)
99 {
100  // Warn for MUST_READ_IF_MODIFIED
101  warnNoRereading<IOmapDistributePolyMesh>();
102 
104 
105  if
106  (
107  (
110  )
111  || (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
112  )
113  {
114  readStream(typeName) >> *this;
115  close();
116  }
117 }
118 
119 
120 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
121 
123 {
124  return (is >> *this).good();
125 }
126 
127 
129 {
130  return (os << *this).good();
131 }
132 
133 
134 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
IOmapDistributePolyMesh.H
Foam::IOmapDistributePolyMesh::IOmapDistributePolyMesh
IOmapDistributePolyMesh(const IOobject &io)
Construct given an IOobject.
Definition: IOmapDistributePolyMesh.C:40
Foam::mapDistributePolyMesh::transfer
void transfer(mapDistributePolyMesh &map)
Transfer the contents of the argument and annul the argument.
Definition: mapDistributePolyMesh.C:193
Foam::IOmapDistributePolyMesh::readData
virtual bool readData(Istream &is)
The readData method for regIOobject read operation.
Definition: IOmapDistributePolyMesh.C:122
Foam::mapDistributePolyMesh::operator=
void operator=(const mapDistributePolyMesh &map)
Copy assignment.
Definition: mapDistributePolyMesh.C:284
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::IOobject::readOpt
readOption readOpt() const noexcept
The read option.
Definition: IOobjectI.H:164
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:73
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:171
Foam::IOobject::MUST_READ_IF_MODIFIED
Definition: IOobject.H:186
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::regIOobject::readStream
Istream & readStream(const word &, const bool valid=true)
Return Istream and check object type against that given.
Definition: regIOobjectRead.C:129
Foam::mapDistributePolyMesh
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Definition: mapDistributePolyMesh.H:66
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::regIOobject::headerOk
bool headerOk()
Read and check header info.
Definition: regIOobject.C:436
Foam::IOmapDistributePolyMesh::writeData
virtual bool writeData(Ostream &os) const
The writeData method for regIOobject write operation.
Definition: IOmapDistributePolyMesh.C:128
Foam::IOobject::MUST_READ
Definition: IOobject.H:185