Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
0752591f
Commit
0752591f
authored
Sep 09, 2013
by
mattijs
Browse files
ENH: Time: fast time comparison
parent
98c75b87
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOobject/IOobject.C
View file @
0752591f
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-201
2
OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-201
3
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -323,8 +323,8 @@ Foam::fileName Foam::IOobject::filePath() const
)
{
fileName
parentObjectPath
=
rootPath
()
/
c
aseName
()
/
".."
/
instance
()
/
db_
.
dbDir
()
/
local
()
/
name
();
rootPath
()
/
time
().
globalC
aseName
()
/
instance
()
/
db_
.
dbDir
()
/
local
()
/
name
();
if
(
isFile
(
parentObjectPath
))
{
...
...
src/OpenFOAM/db/Time/Time.C
View file @
0752591f
...
...
@@ -384,7 +384,9 @@ Foam::Time::Time
:
TimePaths
(
args
.
parRunControl
().
parRun
(),
args
.
rootPath
(),
args
.
globalCaseName
(),
args
.
caseName
(),
systemName
,
constantName
...
...
@@ -700,13 +702,27 @@ Foam::instantList Foam::Time::times() const
Foam
::
word
Foam
::
Time
::
findInstancePath
(
const
instant
&
t
)
const
{
instantList
timeDirs
=
findTimes
(
path
(),
constant
());
const
fileName
directory
=
path
();
const
word
&
constantName
=
constant
();
// Read directory entries into a list
fileNameList
dirEntries
(
readDir
(
directory
,
fileName
::
DIRECTORY
));
forAll
(
dirEntries
,
i
)
{
scalar
timeValue
;
if
(
readScalar
(
dirEntries
[
i
].
c_str
(),
timeValue
)
&&
t
.
equal
(
timeValue
))
{
return
dirEntries
[
i
];
}
}
forAllReverse
(
timeDirs
,
timeI
)
if
(
t
.
equal
(
0
.
0
)
)
{
if
(
timeDirs
[
timeI
]
==
t
)
// Looking for 0 or constant. 0 already checked above.
if
(
isDir
(
directory
/
constantName
))
{
return
timeDirs
[
timeI
].
n
ame
()
;
return
constantN
ame
;
}
}
...
...
src/OpenFOAM/db/Time/TimePaths.C
View file @
0752591f
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -35,11 +35,41 @@ Foam::TimePaths::TimePaths
const
word
&
constantName
)
:
processorCase_
(
caseName
.
find
(
"processor"
)
!=
string
::
npos
),
processorCase_
(
false
),
rootPath_
(
rootPath
),
case_
(
caseName
),
system_
(
systemName
),
constant_
(
constantName
)
{
std
::
string
::
size_type
pos
=
caseName
.
find
(
"processor"
);
if
(
pos
!=
string
::
npos
)
{
processorCase_
=
true
;
globalCaseName_
=
caseName
(
pos
-
1
);
}
else
{
globalCaseName_
=
caseName
;
}
}
Foam
::
TimePaths
::
TimePaths
(
const
bool
processorCase
,
const
fileName
&
rootPath
,
const
fileName
&
globalCaseName
,
const
fileName
&
caseName
,
const
word
&
systemName
,
const
word
&
constantName
)
:
processorCase_
(
processorCase
),
rootPath_
(
rootPath
),
globalCaseName_
(
globalCaseName
),
case_
(
caseName
),
system_
(
systemName
),
constant_
(
constantName
)
{}
...
...
src/OpenFOAM/db/Time/TimePaths.H
View file @
0752591f
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011
-2013
OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
...
...
@@ -52,10 +52,11 @@ class TimePaths
// Private data
bool
processorCase_
;
fileName
rootPath_
;
fileName
case_
;
word
system_
;
word
constant_
;
const
fileName
rootPath_
;
fileName
globalCaseName_
;
const
fileName
case_
;
const
word
system_
;
const
word
constant_
;
public:
...
...
@@ -72,6 +73,18 @@ public:
);
//- Construct given database name, rootPath and casePath
TimePaths
(
const
bool
processorCase
,
const
fileName
&
rootPath
,
const
fileName
&
globalCaseName
,
const
fileName
&
caseName
,
const
word
&
systemName
,
const
word
&
constantName
);
// Member functions
//- Return true if this is a processor case
...
...
@@ -86,6 +99,12 @@ public:
return
rootPath_
;
}
//- Return global case name
const
fileName
&
globalCaseName
()
const
{
return
globalCaseName_
;
}
//- Return case name
const
fileName
&
caseName
()
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment