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
21470979
Commit
21470979
authored
Apr 15, 2010
by
Thomas Witkowski
Browse files
New time strategy.
parent
19107682
Changes
6
Hide whitespace changes
Inline
Side-by-side
AMDiS/libtool
View file @
21470979
...
...
@@ -30,10 +30,10 @@
# the same distribution terms that you use for the rest of that program.
# A sed program that does not truncate output.
SED
=
"/
usr/
bin/sed"
SED
=
"/bin/sed"
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed
=
"/
usr/
bin/sed -e 1s/^X//"
Xsed
=
"/bin/sed -e 1s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
...
...
@@ -44,7 +44,7 @@ available_tags=" CXX F77"
# ### BEGIN LIBTOOL CONFIG
# Libtool was configured on host
deimos104
:
# Libtool was configured on host
NWRW15
:
# Shell to use when invoking shell scripts.
SHELL
=
"/bin/sh"
...
...
@@ -66,12 +66,12 @@ fast_install=yes
# The host system.
host_alias
=
host
=
x86_64-unknown
-linux-gnu
host
=
i686-pc
-linux-gnu
host_os
=
linux-gnu
# The build system.
build_alias
=
build
=
x86_64-unknown
-linux-gnu
build
=
i686-pc
-linux-gnu
build_os
=
linux-gnu
# An echo program that does not interpret backslashes.
...
...
@@ -97,7 +97,7 @@ with_gcc=yes
EGREP
=
"grep -E"
# The linker used to build libraries.
LD
=
"/usr/
x86_64-suse-linux/bin/ld -m elf_x86_64
"
LD
=
"/usr/
bin/ld
"
# Whether we need hard or soft links.
LN_S
=
"ln -s"
...
...
@@ -325,10 +325,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs
=
unknown
# Compile-time system search path for libraries
sys_lib_search_path_spec
=
" /u
sr/lib64/gcc/x86_64-suse
-linux/4.1.2/ /usr/lib/gcc/
x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../../
x86_64-suse-linux/lib/x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../../
x86_64-suse
-linux/lib/
../lib64/
/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib
/ /usr/lib/"
sys_lib_search_path_spec
=
" /u
/witkowski/local/lib/i386-redhat-linux/4.1.2/ /u/witkowski/local/lib/ /usr/lib/gcc/i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../../
i386-redhat-linux/lib/i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../../
i386-redhat
-linux/lib/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../
i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../
/lib/i386-redhat-linux/4.1.2/ /lib/ /usr/lib/i386-redhat-linux/4.1.2
/ /usr/lib/"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale
3.
0
/lib
/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2
/lib
so
"
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
lib/octave-2.9.9 /usr/lib/qt-
3.
3
/lib
/usr/lib/qt4
/lib "
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path
=
""
...
...
@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
# End:
# ### BEGIN LIBTOOL TAG CONFIG: CXX
# Libtool was configured on host
deimos104
:
# Libtool was configured on host
NWRW15
:
# Shell to use when invoking shell scripts.
SHELL
=
"/bin/sh"
...
...
@@ -6782,12 +6782,12 @@ fast_install=yes
# The host system.
host_alias
=
host
=
x86_64-unknown
-linux-gnu
host
=
i686-pc
-linux-gnu
host_os
=
linux-gnu
# The build system.
build_alias
=
build
=
x86_64-unknown
-linux-gnu
build
=
i686-pc
-linux-gnu
build_os
=
linux-gnu
# An echo program that does not interpret backslashes.
...
...
@@ -6813,7 +6813,7 @@ with_gcc=yes
EGREP
=
"grep -E"
# The linker used to build libraries.
LD
=
"/usr/
x86_64-suse-linux/bin/ld -m elf_x86_64
"
LD
=
"/usr/
bin/ld
"
# Whether we need hard or soft links.
LN_S
=
"ln -s"
...
...
@@ -6942,11 +6942,11 @@ striplib="strip --strip-unneeded"
# Dependencies to place before the objects being linked to create a
# shared library.
predep_objects
=
"/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
../lib64/
crti.o /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/crtbeginS.o"
predep_objects
=
"/usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../crti.o /usr/lib/gcc/
i386-redhat
-linux/4.1.2/crtbeginS.o"
# Dependencies to place after the objects being linked to create a
# shared library.
postdep_objects
=
"/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/crtendS.o /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
../lib64/
crtn.o"
postdep_objects
=
"/usr/lib/gcc/
i386-redhat
-linux/4.1.2/crtendS.o /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../crtn.o"
# Dependencies to place before the objects being linked to create a
# shared library.
...
...
@@ -6958,7 +6958,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
# The library search path used internally by the compiler when linking
# a shared library.
compiler_lib_search_path
=
"-L/u
sr/lib64/gcc/x86_64-suse-linux/4.1.2
-L/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2
/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib
-L/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../.."
compiler_lib_search_path
=
"-L/u
/witkowski/local/lib
-L/usr/lib/gcc/
i386-redhat
-linux/4.1.2
-L/usr/lib/gcc/i386-redhat-linux/4.1.2
-L/usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../.."
# Method to check whether dependent libraries are shared objects.
deplibs_check_method
=
"pass_all"
...
...
@@ -7038,10 +7038,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs
=
unknown
# Compile-time system search path for libraries
sys_lib_search_path_spec
=
" /u
sr/lib64/gcc/x86_64-suse
-linux/4.1.2/ /usr/lib/gcc/
x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../../
x86_64-suse-linux/lib/x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../../
x86_64-suse
-linux/lib/
../lib64/
/usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
x86_64-suse
-linux/4.1.2/ /usr/lib
64
/gcc/
x86_64-suse
-linux/4.1.2/../../../
../lib64/ /lib/x86_64-suse-linux/4.1.2/ /lib/../lib64/ /usr/lib/x86_64-suse-linux/4.1.2/ /usr/lib/../lib64/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/lib/ /usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../ /lib
/ /usr/lib/"
sys_lib_search_path_spec
=
" /u
/witkowski/local/lib/i386-redhat-linux/4.1.2/ /u/witkowski/local/lib/ /usr/lib/gcc/i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../../
i386-redhat-linux/lib/i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../../
i386-redhat
-linux/lib/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../
i386-redhat
-linux/4.1.2/ /usr/lib/gcc/
i386-redhat
-linux/4.1.2/../../../
/lib/i386-redhat-linux/4.1.2/ /lib/ /usr/lib/i386-redhat-linux/4.1.2
/ /usr/lib/"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale
3.
0
/lib
/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2
/lib
so
"
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
lib/octave-2.9.9 /usr/lib/qt-
3.
3
/lib
/usr/lib/qt4
/lib "
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path
=
""
...
...
@@ -7065,7 +7065,7 @@ include_expsyms=""
# ### BEGIN LIBTOOL TAG CONFIG: F77
# Libtool was configured on host
deimos104
:
# Libtool was configured on host
NWRW15
:
# Shell to use when invoking shell scripts.
SHELL
=
"/bin/sh"
...
...
@@ -7087,12 +7087,12 @@ fast_install=yes
# The host system.
host_alias
=
host
=
x86_64-unknown
-linux-gnu
host
=
i686-pc
-linux-gnu
host_os
=
linux-gnu
# The build system.
build_alias
=
build
=
x86_64-unknown
-linux-gnu
build
=
i686-pc
-linux-gnu
build_os
=
linux-gnu
# An echo program that does not interpret backslashes.
...
...
@@ -7112,13 +7112,13 @@ LTCFLAGS="-g -O2"
CC
=
"g77"
# Is the compiler the GNU C compiler?
with_gcc
=
with_gcc
=
yes
# An ERE matcher.
EGREP
=
"grep -E"
# The linker used to build libraries.
LD
=
"/usr/
x86_64-suse-linux/bin/ld -m elf_x86_64
"
LD
=
"/usr/
bin/ld
"
# Whether we need hard or soft links.
LN_S
=
"ln -s"
...
...
@@ -7346,10 +7346,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM
link_all_deplibs
=
unknown
# Compile-time system search path for libraries
sys_lib_search_path_spec
=
" /u
sr/lib64/gcc-lib/x86_64-suse
-linux/3.
3.5
/ /usr/lib/gcc/
x86_64-suse
-linux/3.
3.5
/ /usr/lib
64
/gcc
-lib/x86_64-suse
-linux/3.
3.5
/../../../../
x86_64-suse-linux/lib/x86_64-suse
-linux/3.
3.5
/ /usr/lib
64
/gcc
-lib/x86_64-suse
-linux/3.
3.5
/../../../../
x86_64-suse
-linux/lib/ /usr/lib
64
/gcc
-lib/x86_64-suse
-linux/3.
3.5
/../../../
x86_64-suse
-linux/3.
3.5
/ /usr/lib
64
/gcc
-lib/x86_64-suse
-linux/3.
3.5
/../../../ /lib/
x86_64-suse
-linux/3.
3.5
/ /lib/ /usr/lib/
x86_64-suse
-linux/3.
3.5
/ /usr/lib/"
sys_lib_search_path_spec
=
" /u
/witkowski/local/lib/i386-redhat-linux/3.4.6/ /u/witkowski/local/lib/ /usr/lib/gcc/i386-redhat
-linux/3.
4.6
/ /usr/lib/gcc/
i386-redhat
-linux/3.
4.6
/ /usr/lib/gcc
/i386-redhat
-linux/3.
4.6
/../../../../
i386-redhat-linux/lib/i386-redhat
-linux/3.
4.6
/ /usr/lib/gcc
/i386-redhat
-linux/3.
4.6
/../../../../
i386-redhat
-linux/lib/ /usr/lib/gcc
/i386-redhat
-linux/3.
4.6
/../../../
i386-redhat
-linux/3.
4.6
/ /usr/lib/gcc
/i386-redhat
-linux/3.
4.6
/../../../ /lib/
i386-redhat
-linux/3.
4.6
/ /lib/ /usr/lib/
i386-redhat
-linux/3.
4.6
/ /usr/lib/"
# Run-time system search path for libraries
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
X11R6/lib64/Xaw3d /usr/X11R6/lib64 /usr/X11R6/lib/Xaw3d /usr/X11R6/lib /usr/x86_64-suse-linux/lib /usr/local/lib64 /usr/local/lib /opt/kde3/lib64 /opt/kde3/lib /opt/gnome/lib64 /opt/gnome/lib /lib64 /lib /usr/lib64 /usr/lib /opt/cluster/intel/cce/9.1.042/lib /opt/cluster/intel/fce/9.1.036/lib /opt/cluster/Pathscale3.0/lib/2.9.99 /opt/cluster/Pathscale
3.
0
/lib
/2.9.99/32 /work/licsoft/compilers/pgi/linux86-64/6.2/lib /work/licsoft/compilers/pgi/linux86-64/6.2
/lib
so
"
sys_lib_dlsearch_path_spec
=
"/lib /usr/lib /usr/
lib/octave-2.9.9 /usr/lib/qt-
3.
3
/lib
/usr/lib/qt4
/lib "
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path
=
""
...
...
AMDiS/src/AdaptBase.cc
View file @
21470979
...
...
@@ -2,6 +2,6 @@
namespace
AMDiS
{
int
AdaptBase
::
info
_
=
10
;
int
AdaptBase
::
info
=
10
;
}
AMDiS/src/AdaptBase.h
View file @
21470979
...
...
@@ -33,15 +33,15 @@ namespace AMDiS {
public:
/// Constructor
AdaptBase
(
std
::
string
sname
,
ProblemIterationInterface
*
problemIteration
,
ProblemIterationInterface
*
problemIteration
_
,
AdaptInfo
*
adapt
,
ProblemTimeInterface
*
problemTime
=
NULL
,
AdaptInfo
*
initialAdaptInfo
=
NULL
)
ProblemTimeInterface
*
problemTime
_
=
NULL
,
AdaptInfo
*
initialAdaptInfo
_
=
NULL
)
:
name
(
sname
),
problemIteration
_
(
problemIteration
),
problemIteration
(
problemIteration
_
),
adaptInfo
(
adapt
),
problemTime
_
(
problemTime
),
initialAdaptInfo
_
(
initialAdaptInfo
)
problemTime
(
problemTime
_
),
initialAdaptInfo
(
initialAdaptInfo
_
)
{}
/// Destructor
...
...
@@ -62,13 +62,13 @@ namespace AMDiS {
/// Returns \ref problemIteration_
inline
ProblemIterationInterface
*
getProblemIteration
()
{
return
problemIteration
_
;
return
problemIteration
;
}
///
inline
void
setProblemIteration
(
ProblemIterationInterface
*
pii
)
{
problemIteration
_
=
pii
;
problemIteration
=
pii
;
}
/// Returns \ref adaptInfo
...
...
@@ -80,19 +80,19 @@ namespace AMDiS {
/// Returns \ref problemTime_
inline
ProblemTimeInterface
*
getProblemTime
()
{
return
problemTime
_
;
return
problemTime
;
}
///
inline
void
setProblemTime
(
ProblemTimeInterface
*
pti
)
{
problemTime
_
=
pti
;
problemTime
=
pti
;
}
/// Returns \ref initialAdaptInfo_
inline
AdaptInfo
*
getInitialAdaptInfo
()
{
return
initialAdaptInfo
_
;
return
initialAdaptInfo
;
}
protected:
...
...
@@ -100,22 +100,22 @@ namespace AMDiS {
std
::
string
name
;
/// Problem iteration interface
ProblemIterationInterface
*
problemIteration
_
;
ProblemIterationInterface
*
problemIteration
;
/// Main adapt info
AdaptInfo
*
adaptInfo
;
/// problem time interface
ProblemTimeInterface
*
problemTime
_
;
ProblemTimeInterface
*
problemTime
;
/** \brief
* Adapt info for initial adapt. Will be given to
* problemTime_->solveInitialProblem().
*/
AdaptInfo
*
initialAdaptInfo
_
;
AdaptInfo
*
initialAdaptInfo
;
/// Info level
static
int
info
_
;
static
int
info
;
};
}
...
...
AMDiS/src/AdaptInstationary.cc
View file @
21470979
...
...
@@ -26,6 +26,7 @@ namespace AMDiS {
initConstructor
(
problemStat
,
info
,
initialInfo
,
initialTimestamp
);
}
AdaptInstationary
::
AdaptInstationary
(
std
::
string
name
,
ProblemIterationInterface
&
problemStat
,
AdaptInfo
&
info
,
...
...
@@ -41,6 +42,7 @@ namespace AMDiS {
initConstructor
(
&
problemStat
,
&
info
,
&
initialInfo
,
initialTimestamp
);
}
void
AdaptInstationary
::
initConstructor
(
ProblemIterationInterface
*
problemStat
,
AdaptInfo
*
info
,
AdaptInfo
*
initialInfo
,
...
...
@@ -48,12 +50,12 @@ namespace AMDiS {
{
initialize
(
name
);
fixedTimestep
_
=
(
info
->
getMinTimestep
()
==
info
->
getMaxTimestep
());
fixedTimestep
=
(
info
->
getMinTimestep
()
==
info
->
getMaxTimestep
());
if
(
initialTimestamp
==
0
)
initialTimestamp
_
=
time
(
NULL
);
initialTimestamp
=
time
(
NULL
);
else
initialTimestamp
_
=
initialTimestamp
;
initialTimestamp
=
initialTimestamp
;
// Check if the problem should be deserialized because of the -rs parameter.
std
::
string
serializationFilename
=
""
;
...
...
@@ -62,9 +64,9 @@ namespace AMDiS {
if
(
serializationFilename
.
compare
(
""
))
{
// The value of the -rs argument is ignored, because we want to use the
// serialization file mentioned in the used init file.
MSG
(
"Deserialization from file: %s
\n
"
,
queueSerializationFilename
_
.
c_str
());
MSG
(
"Deserialization from file: %s
\n
"
,
queueSerializationFilename
.
c_str
());
std
::
ifstream
in
(
queueSerializationFilename
_
.
c_str
());
std
::
ifstream
in
(
queueSerializationFilename
.
c_str
());
deserialize
(
in
);
in
.
close
();
...
...
@@ -94,58 +96,61 @@ namespace AMDiS {
}
}
AdaptInstationary
::~
AdaptInstationary
()
{
}
void
AdaptInstationary
::
explicitTimeStrategy
()
{
FUNCNAME
(
"AdaptInstationary::explicitTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo
->
getTime
()
<=
adaptInfo
->
getStartTime
())
problemIteration
_
->
oneIteration
(
adaptInfo
,
ESTIMATE
);
problemIteration
->
oneIteration
(
adaptInfo
,
ESTIMATE
);
// increment time
adaptInfo
->
setTime
(
adaptInfo
->
getTime
()
+
adaptInfo
->
getTimestep
());
problemTime
_
->
setTime
(
adaptInfo
);
problemTime
->
setTime
(
adaptInfo
);
INFO
(
info
_
,
6
)(
"time = %e, timestep = %e
\n
"
,
INFO
(
info
,
6
)(
"time = %e, timestep = %e
\n
"
,
adaptInfo
->
getTime
(),
adaptInfo
->
getTimestep
());
adaptInfo
->
setSpaceIteration
(
0
);
// do the iteration
problemIteration
_
->
beginIteration
(
adaptInfo
);
problemIteration
_
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
problemIteration
_
->
endIteration
(
adaptInfo
);
problemIteration
->
beginIteration
(
adaptInfo
);
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
->
setLastProcessedTimestep
(
adaptInfo
->
getTimestep
());
}
void
AdaptInstationary
::
implicitTimeStrategy
()
{
FUNCNAME
(
"AdaptInstationary::implicitTimeStrategy()"
);
do
{
adaptInfo
->
setTime
(
adaptInfo
->
getTime
()
+
adaptInfo
->
getTimestep
());
problemTime
_
->
setTime
(
adaptInfo
);
problemTime
->
setTime
(
adaptInfo
);
INFO
(
info
_
,
6
)(
"time = %e, try timestep = %e
\n
"
,
adaptInfo
->
getTime
(),
adaptInfo
->
getTimestep
());
INFO
(
info
,
6
)(
"time = %e, try timestep = %e
\n
"
,
adaptInfo
->
getTime
(),
adaptInfo
->
getTimestep
());
problemIteration
_
->
oneIteration
(
adaptInfo
,
NO_ADAPTION
);
problemIteration
->
oneIteration
(
adaptInfo
,
NO_ADAPTION
);
adaptInfo
->
incTimestepIteration
();
if
(
!
fixedTimestep
_
&&
if
(
!
fixedTimestep
&&
!
adaptInfo
->
timeToleranceReached
()
&&
adaptInfo
->
getTimestepIteration
()
<=
adaptInfo
->
getMaxTimestepIteration
()
&&
!
(
adaptInfo
->
getTimestep
()
<=
adaptInfo
->
getMinTimestep
()))
{
adaptInfo
->
setTime
(
adaptInfo
->
getTime
()
-
adaptInfo
->
getTimestep
());
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
_d
elta
_
1
);
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
D
elta1
);
continue
;
}
...
...
@@ -159,28 +164,28 @@ namespace AMDiS {
/* === Space iterations === */
do
{
problemIteration
_
->
beginIteration
(
adaptInfo
);
problemIteration
->
beginIteration
(
adaptInfo
);
if
(
problemIteration
_
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
))
{
if
(
!
fixedTimestep
_
&&
if
(
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
))
{
if
(
!
fixedTimestep
&&
!
adaptInfo
->
timeToleranceReached
()
&&
!
(
adaptInfo
->
getTimestep
()
<=
adaptInfo
->
getMinTimestep
()))
{
adaptInfo
->
setTime
(
adaptInfo
->
getTime
()
-
adaptInfo
->
getTimestep
());
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
_d
elta
_1
);
problemIteration
_
->
endIteration
(
adaptInfo
);
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
D
elta
2
);
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
->
incSpaceIteration
();
break
;
}
}
adaptInfo
->
incSpaceIteration
();
problemIteration
_
->
endIteration
(
adaptInfo
);
problemIteration
->
endIteration
(
adaptInfo
);
}
while
(
!
adaptInfo
->
spaceToleranceReached
()
&&
adaptInfo
->
getSpaceIteration
()
<=
adaptInfo
->
getMaxSpaceIteration
());
}
else
{
problemIteration
_
->
endIteration
(
adaptInfo
);
problemIteration
->
endIteration
(
adaptInfo
);
}
...
...
@@ -193,8 +198,8 @@ namespace AMDiS {
// After successful iteration/timestep the timestep will be changed according
// adaption rules for next timestep.
// First, check for increase of timestep
if
(
!
fixedTimestep
_
&&
adaptInfo
->
timeErrorLow
())
{
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
_d
elta
_
2
);
if
(
!
fixedTimestep
&&
adaptInfo
->
timeErrorLow
())
{
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time
D
elta2
);
if
(
dbgMode
)
{
// print information about timestep increase
}
...
...
@@ -202,20 +207,51 @@ namespace AMDiS {
if
(
dbgMode
)
{
std
::
cout
<<
"=== ADAPT INFO DEBUG MODE ===
\n
"
;
std
::
cout
<<
" Do not increase timestep:
\n
"
;
if
(
fixedTimestep
_
)
if
(
fixedTimestep
)
std
::
cout
<<
" fixedTimestep = true
\n
"
;
if
(
!
adaptInfo
->
timeErrorLow
())
adaptInfo
->
printTimeErrorLowInfo
();
}
}
// Second, check for decrease of timestep
if
(
!
fixedTimestep
_
&&
if
(
!
fixedTimestep
&&
!
adaptInfo
->
timeToleranceReached
()
&&
!
(
adaptInfo
->
getTimestep
()
<=
adaptInfo
->
getMinTimestep
()))
{
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
time_delta_1
);
}
!
(
adaptInfo
->
getTimestep
()
<=
adaptInfo
->
getMinTimestep
()))
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
timeDelta1
);
}
void
AdaptInstationary
::
simpleAdaptiveTimeStrategy
()
{
FUNCNAME
(
"AdaptInstationary::explicitTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo
->
getTime
()
<=
adaptInfo
->
getStartTime
())
problemIteration
->
oneIteration
(
adaptInfo
,
ESTIMATE
);
adaptInfo
->
setTime
(
adaptInfo
->
getTime
()
+
adaptInfo
->
getTimestep
());
problemTime
->
setTime
(
adaptInfo
);
INFO
(
info
,
6
)(
"time = %e, timestep = %e
\n
"
,
adaptInfo
->
getTime
(),
adaptInfo
->
getTimestep
());
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
adaptInfo
->
setLastProcessedTimestep
(
adaptInfo
->
getTimestep
());
// First, check for increase of timestep
if
(
!
fixedTimestep
&&
adaptInfo
->
timeErrorLow
())
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
timeDelta2
);
// Second, check for decrease of timestep
if
(
!
fixedTimestep
&&
!
adaptInfo
->
timeToleranceReached
()
&&
!
(
adaptInfo
->
getTimestep
()
<=
adaptInfo
->
getMinTimestep
()))
adaptInfo
->
setTimestep
(
adaptInfo
->
getTimestep
()
*
timeDelta1
);
}
void
AdaptInstationary
::
oneTimestep
()
{
FUNCNAME
(
"AdaptInstationary::oneTimestep()"
);
...
...
@@ -229,14 +265,17 @@ namespace AMDiS {
case
1
:
implicitTimeStrategy
();
break
;
case
2
:
simpleAdaptiveTimeStrategy
();
break
;
default:
MSG
(
"unknown strategy = %d; use explicit strategy
\n
"
,
strategy
);
explicitTimeStrategy
();
ERROR_EXIT
(
"Unknown strategy = %d!
\n
"
,
strategy
);
}
adaptInfo
->
incTimestepNumber
();
}
int
AdaptInstationary
::
adapt
()
{
FUNCNAME
(
"AdaptInstationary::adapt()"
);
...
...
@@ -252,22 +291,22 @@ namespace AMDiS {
if
(
adaptInfo
->
getTimestepNumber
()
==
0
)
{
adaptInfo
->
setTime
(
adaptInfo
->
getStartTime
());
initialAdaptInfo
_
->
setStartTime
(
adaptInfo
->
getStartTime
());
initialAdaptInfo
_
->
setTime
(
adaptInfo
->
getStartTime
());
initialAdaptInfo
->
setStartTime
(
adaptInfo
->
getStartTime
());
initialAdaptInfo
->
setTime
(
adaptInfo
->
getStartTime
());
problemTime
_
->
setTime
(
adaptInfo
);
problemTime
->
setTime
(
adaptInfo
);
// initial adaption
problemTime
_
->
solveInitialProblem
(
initialAdaptInfo
_
);
problemTime
_
->
transferInitialSolution
(
adaptInfo
);
problemTime
->
solveInitialProblem
(
initialAdaptInfo
);
problemTime
->
transferInitialSolution
(
adaptInfo
);
}
while
(
!
adaptInfo
->
reachedEndTime
())
{
iterationTimestamp
_
=
time
(
NULL
);
iterationTimestamp
=
time
(
NULL
);
problemTime
_
->
initTimestep
(
adaptInfo
);
problemTime
->
initTimestep
(
adaptInfo
);
oneTimestep
();
problemTime
_
->
closeTimestep
(
adaptInfo
);
problemTime
->
closeTimestep
(
adaptInfo
);
if
(
breakWhenStable
&&
(
adaptInfo
->
getSolverIterations
()
==
0
))
{
break
;
...
...
@@ -285,53 +324,54 @@ namespace AMDiS {
return
errorCode
;
}
void
AdaptInstationary
::
initialize
(
std
::
string
aName
)
{
FUNCNAME
(
"AdaptInstationary::initialize()"
);
strategy
=
0
;
time
_d
elta
_
1
=
0.7071
;
time
_d
elta
_
2
=
1.4142
;
queueRuntime
_
=
-
1
;
queueSerializationFilename
_
=
"__serialized_problem.ser"
;
time
D
elta1
=
0.7071
;
time
D
elta2
=
1.4142
;
queueRuntime
=
-
1
;
queueSerializationFilename
=
"__serialized_problem.ser"
;
GET_PARAMETER
(
0
,
aName
+
"->strategy"
,
"%d"
,
&
strategy
);
GET_PARAMETER
(
0
,
aName
+
"->time delta 1"
,
"%f"
,
&
time
_d
elta
_
1
);
GET_PARAMETER
(
0
,
aName
+
"->time delta 2"
,
"%f"
,
&
time
_d
elta
_
2
);
GET_PARAMETER
(
0
,
aName
+
"->info"
,
"%d"
,
&
info
_
);
GET_PARAMETER
(
0
,
aName
+
"->time delta 1"
,
"%f"
,
&
time
D
elta1
);
GET_PARAMETER
(
0
,
aName
+
"->time delta 2"
,
"%f"
,
&
time
D
elta2
);
GET_PARAMETER
(
0
,
aName
+
"->info"
,
"%d"
,
&
info
);
GET_PARAMETER
(
0
,
aName
+
"->break when stable"
,
"%d"
,
&
breakWhenStable
);
GET_PARAMETER
(
0
,
aName
+
"->queue->runtime"
,
"%d"
,
&
queueRuntime
_
);
GET_PARAMETER
(
0
,
aName
+
"->queue->runtime"
,
"%d"
,
&
queueRuntime
);
GET_PARAMETER
(
0
,
aName
+
"->queue->serialization filename"
,
&
queueSerializationFilename
_
);
&
queueSerializationFilename
);
}
void
AdaptInstationary
::
serialize
(
std
::
ostream
&
out
)
{
FUNCNAME
(
"AdaptInstationary::serialize()"
);
problemIteration
_
->
serialize
(
out
);
problemIteration
->
serialize
(
out
);
adaptInfo
->
serialize
(
out
);
if
(
problemTime_
)
{
problemTime_
->
serialize
(
out
);
}
if
(
problemTime
)
problemTime
->
serialize
(
out
);
}
void
AdaptInstationary
::
deserialize
(
std
::
istream
&
in
)
{
FUNCNAME
(
"AdaptInstationary::deserialize()"
);
problemIteration
_
->
deserialize
(
in
);
problemIteration
->
deserialize
(
in
);
adaptInfo
->
deserialize
(
in
);
if
(
problemTime_
)
{
problemTime_
->
deserialize
(
in
);
}
if
(
problemTime
)
problemTime
->
deserialize
(
in
);
}
bool
AdaptInstationary
::
checkQueueRuntime
()
{
// If there is no time limited runtime queue, there is also nothing to check.
if
(
queueRuntime
_
==
-
1
)
{
if
(
queueRuntime
==
-
1
)
{
return
false
;
}
...
...
@@ -339,24 +379,23 @@ namespace AMDiS {
time_t
currentTimestamp
=
time
(
NULL
);
// Update list with the last iteration runtimes.
lastIterationsDuration
_
.
push
(
currentTimestamp
-
iterationTimestamp
_
);
lastIterationsDuration
.
push
(
currentTimestamp
-
iterationTimestamp
);
// The list should not contain more than 5 elements. If so, delete the oldest one.
if
(
lastIterationsDuration_
.
size
()
>
5
)
{
lastIterationsDuration_
.
pop
();
}
if
(
lastIterationsDuration
.
size
()
>
5
)
lastIterationsDuration
.
pop
();
// Calculate the avarage of the last iterations.
std
::
queue
<
int
>
tmpQueue
=
lastIterationsDuration
_
;
std
::
queue
<
int
>
tmpQueue
=
lastIterationsDuration
;
int
avrgLastIterations
=
0
;