OpenFOAM: API Guide
v2112
The open source CFD toolbox
extendedEdgeMeshFormat.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) 2013-2017 OpenFOAM Foundation
9
Copyright (C) 2019 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 "
extendedEdgeMeshFormat.H
"
30
#include "
IFstream.H
"
31
#include "
Time.H
"
32
#include "
extendedFeatureEdgeMesh.H
"
33
34
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
36
Foam::fileFormats::extendedEdgeMeshFormat::extendedEdgeMeshFormat
37
(
38
const
fileName
& filename
39
)
40
{
41
read
(filename);
42
}
43
44
45
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
46
47
bool
Foam::fileFormats::extendedEdgeMeshFormat::read
48
(
49
const
fileName
& filename
50
)
51
{
52
clear
();
53
54
// Use dummy Time for objectRegistry
55
autoPtr<Time>
dummyTimePtr(
Time::New
());
56
57
// Construct IOobject to re-use the headerOk & readHeader
58
// (so we can read ascii and binary)
59
IOobject
io
60
(
61
filename,
62
*dummyTimePtr,
63
IOobject::NO_READ
,
64
IOobject::NO_WRITE
,
65
false
66
);
67
68
if
(!
io
.typeHeaderOk<
extendedFeatureEdgeMesh
>(
false
))
69
{
70
FatalErrorInFunction
71
<<
"Cannot read file "
<< filename
72
<<
exit
(
FatalError
);
73
}
74
75
const
fileName
fName(typeFilePath<extendedFeatureEdgeMesh>(
io
));
76
77
autoPtr<IFstream>
isPtr(
new
IFstream
(fName));
78
bool
ok =
false
;
79
if
(isPtr().good())
80
{
81
Istream
& is = isPtr();
82
ok =
io
.readHeader(is);
83
84
if
(ok)
85
{
86
// Use extendedEdgeMesh IO
87
is >> *
this
;
88
ok = is.
good
();
89
}
90
}
91
92
return
ok;
93
}
94
95
96
// ************************************************************************* //
IFstream.H
Time.H
Foam::IFstream
Input from file stream, using an ISstream.
Definition:
IFstream.H:57
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition:
IOobject.H:170
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition:
IOobject.H:187
Foam::IOobject::NO_READ
@ NO_READ
Definition:
IOobject.H:178
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::RASModels::kEpsilonLopesdaCosta::read
virtual bool read()
Re-read model coefficients if they have changed.
Definition:
kEpsilonLopesdaCosta.C:380
Foam::Time::New
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition:
Time.C:717
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition:
autoPtr.H:66
Foam::extendedFeatureEdgeMesh
extendedEdgeMesh + IO.
Definition:
extendedFeatureEdgeMesh.H:60
Foam::fileFormats::extendedEdgeMeshFormat
Provide a means of reading/writing the single-file OpenFOAM extendedEdgeMesh format.
Definition:
extendedEdgeMeshFormat.H:57
Foam::fileFormats::extendedEdgeMeshFormat::read
virtual bool read(const fileName &)
Read from file.
Definition:
extendedEdgeMeshFormat.C:48
Foam::fileName
A class for handling file names.
Definition:
fileName.H:76
clear
patchWriters clear()
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition:
error.H:453
extendedEdgeMeshFormat.H
extendedFeatureEdgeMesh.H
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
Foam::FatalError
error FatalError
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition:
errorManip.H:130
src
meshTools
edgeMesh
extendedEdgeMesh
extendedEdgeMeshFormat.C
Generated by
1.9.5
OPENFOAM® is a registered
trademark
of OpenCFD Ltd.