OpenFOAM
v2406
The open source CFD toolbox
getTimeIndex.H
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) 2011 OpenFOAM Foundation
9
Copyright (C) 2016-2021 OpenCFD Ltd.
10
-------------------------------------------------------------------------------
11
License
12
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
13
14
Description
15
Read time index from ../uniform/time, but treat 0 and constant specially
16
or simply increment from the '-index' option if it was supplied
17
18
Note
19
Does a 'continue' out of the loop if not possible to obtain an index
20
21
\*---------------------------------------------------------------------------*/
22
23
label
timeIndex
= 0;
24
{
25
bool
goodTimeIndex =
true
;
26
27
if
(doConsecutive)
28
{
29
timeIndex
= indexingNumber++;
30
}
31
else
if
32
(
33
runTime
.timeName() !=
runTime
.constant()
34
&&
runTime
.timeName() !=
"0"
35
)
36
{
37
IOobject
io
38
(
39
"time"
,
40
runTime
.timeName(),
41
"uniform"
,
42
runTime
,
43
IOobject::READ_IF_PRESENT,
44
IOobject::NO_WRITE,
45
IOobject::NO_REGISTER
46
);
47
48
if
(
io
.typeHeaderOk<IOdictionary>(
true
,
false
))
49
{
50
io
.readOpt(IOobject::MUST_READ_IF_MODIFIED);
51
IOdictionary timeObject(
io
);
52
53
timeObject.readEntry(
"index"
,
timeIndex
);
54
}
55
else
56
{
57
goodTimeIndex =
false
;
58
Info
<<
"skip ... missing file: "
<<
io
.objectRelPath() <<
endl
;
59
}
60
}
61
62
if
(!goodTimeIndex)
63
{
64
continue
;
65
}
66
}
67
68
69
// ************************************************************************* //
runTime
engineTime & runTime
Definition:
createEngineTime.H:13
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition:
Ostream.H:531
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
io
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
timeIndex
label timeIndex
Definition:
getTimeIndex.H:24
applications
utilities
postProcessing
dataConversion
foamToEnsight
getTimeIndex.H
Generated by
1.8.14