Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
960408e0
Commit
960408e0
authored
Jun 14, 2010
by
Backofen, Rainer
Browse files
fixed bug in runtime calculation, initialTimestamp was not set correctly
parent
8daad3cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/AdaptInstationary.cc
View file @
960408e0
...
...
@@ -13,7 +13,7 @@ namespace AMDiS {
AdaptInfo
*
info
,
ProblemTimeInterface
*
problemInstat
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
:
AdaptBase
(
name
,
problemStat
,
info
,
problemInstat
,
initialInfo
),
breakWhenStable
(
0
),
dbgMode
(
false
)
...
...
@@ -23,8 +23,9 @@ namespace AMDiS {
// MSG("You make use of the obsolete constructor AdaptInstationary::AdaptInstationary(...)!\n");
// MSG("Please use the constructor that uses references instead of pointers!\n");
initConstructor
(
problemStat
,
info
,
initialInfo
,
initialTimestamp
);
}
initConstructor
(
problemStat
,
info
,
initialInfo
,
initialTimestampSet
);
}
AdaptInstationary
::
AdaptInstationary
(
std
::
string
name
,
...
...
@@ -32,31 +33,32 @@ namespace AMDiS {
AdaptInfo
&
info
,
ProblemTimeInterface
&
problemInstat
,
AdaptInfo
&
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
:
AdaptBase
(
name
,
&
problemStat
,
&
info
,
&
problemInstat
,
&
initialInfo
),
breakWhenStable
(
0
),
dbgMode
(
false
)
{
FUNCNAME
(
"AdaptInstationary::AdaptInstationary()"
);
initConstructor
(
&
problemStat
,
&
info
,
&
initialInfo
,
initialTimestamp
);
initConstructor
(
&
problemStat
,
&
info
,
&
initialInfo
,
initialTimestampSet
);
}
void
AdaptInstationary
::
initConstructor
(
ProblemIterationInterface
*
problemStat
,
AdaptInfo
*
info
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
)
time_t
initialTimestamp
Set
)
{
initialize
(
name
);
fixedTimestep
=
(
info
->
getMinTimestep
()
==
info
->
getMaxTimestep
());
if
(
initialTimestamp
==
0
)
if
(
initialTimestamp
Set
==
0
)
initialTimestamp
=
time
(
NULL
);
else
initialTimestamp
=
initialTimestamp
;
initialTimestamp
=
initialTimestamp
Set
;
// Check if the problem should be deserialized because of the -rs parameter.
std
::
string
serializationFilename
=
""
;
GET_PARAMETER
(
0
,
"argv->rs"
,
&
serializationFilename
);
...
...
@@ -279,7 +281,6 @@ namespace AMDiS {
int
AdaptInstationary
::
adapt
()
{
FUNCNAME
(
"AdaptInstationary::adapt()"
);
int
errorCode
=
0
;
TEST_EXIT
(
adaptInfo
->
getTimestep
()
>=
adaptInfo
->
getMinTimestep
())
...
...
@@ -308,10 +309,12 @@ namespace AMDiS {
oneTimestep
();
problemTime
->
closeTimestep
(
adaptInfo
);
if
(
breakWhenStable
&&
(
adaptInfo
->
getSolverIterations
()
==
0
))
{
if
(
breakWhenStable
&&
(
adaptInfo
->
getSolverIterations
()
==
0
))
break
;
}
/*
if (adaptInfo->forceBreak)
break;
*/
// Check if there is a runtime limitation. If there is a runtime limitation
// and there is no more time for a next adaption loop, than return the error
// code for rescheduling the problem and break the adaption loop.
...
...
@@ -374,7 +377,6 @@ namespace AMDiS {
if
(
queueRuntime
==
-
1
)
{
return
false
;
}
// Get the current time.
time_t
currentTimestamp
=
time
(
NULL
);
...
...
@@ -388,11 +390,11 @@ namespace AMDiS {
std
::
queue
<
int
>
tmpQueue
=
lastIterationsDuration
;
int
avrgLastIterations
=
0
;
while
(
!
tmpQueue
.
empty
())
{
avrgLastIterations
+=
tmpQueue
.
front
();
tmpQueue
.
pop
();
avrgLastIterations
+=
tmpQueue
.
front
();
tmpQueue
.
pop
();
}
avrgLastIterations
/=
lastIterationsDuration
.
size
();
// Check if there is enough time for a further iteration.
if
(
initialTimestamp
+
queueRuntime
-
currentTimestamp
<
avrgLastIterations
*
2
)
{
std
::
ofstream
out
(
queueSerializationFilename
.
c_str
());
...
...
AMDiS/src/AdaptInstationary.h
View file @
960408e0
...
...
@@ -50,7 +50,7 @@ namespace AMDiS {
AdaptInfo
*
info
,
ProblemTimeInterface
*
problemInstat
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
=
0
);
time_t
initialTimestamp
Set
=
0
);
/** \brief
* Creates a AdaptInstationary object with the given name for the time
...
...
@@ -61,7 +61,7 @@ namespace AMDiS {
AdaptInfo
&
info
,
ProblemTimeInterface
&
problemInstat
,
AdaptInfo
&
initialInfo
,
time_t
initialTimestamp
=
0
);
time_t
initialTimestamp
Set
=
0
);
/** \brief
* This funciton is used only to avoid double code in both constructors. If the
...
...
@@ -72,7 +72,7 @@ namespace AMDiS {
void
initConstructor
(
ProblemIterationInterface
*
problemStat
,
AdaptInfo
*
info
,
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
);
time_t
initialTimestamp
Set
);
/// Destructor
virtual
~
AdaptInstationary
();
...
...
@@ -88,7 +88,6 @@ namespace AMDiS {
{
return
strategy
;
}
/// Implementation of AdaptBase::adapt()
virtual
int
adapt
();
...
...
@@ -152,7 +151,6 @@ namespace AMDiS {
* of solver iterations to solve the problem is zero, the adaption loop will stop.
*/
int
breakWhenStable
;
///
bool
fixedTimestep
;
...
...
Write
Preview
Supports
Markdown
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