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
amdis
amdis-core
Commits
1a8ac387
Commit
1a8ac387
authored
Oct 01, 2018
by
Praetorius, Simon
Browse files
enforced more uniform code style
parent
af1bf33d
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/amdis/AdaptBase.cpp
deleted
100644 → 0
View file @
af1bf33d
#include "AdaptBase.hpp"
namespace
AMDiS
{
int
AdaptBase
::
info
=
10
;
}
// end namespace AMDiS
src/amdis/AdaptBase.hpp
View file @
1a8ac387
...
...
@@ -15,20 +15,20 @@ namespace AMDiS
{
public:
/// Constructor
AdaptBase
(
std
::
string
s
name
,
AdaptBase
(
std
::
string
name
,
ProblemIterationInterface
*
problemIteration
,
AdaptInfo
&
adapt
,
AdaptInfo
&
adapt
Info
,
ProblemTimeInterface
*
problemTime
=
nullptr
,
AdaptInfo
*
initialAdaptInfo
=
nullptr
)
:
name
(
sname
)
,
problemIteration
(
problemIteration
)
,
adaptInfo
(
adapt
)
,
problemTime
(
problemTime
)
,
initialAdaptInfo
(
initialAdaptInfo
)
:
name
_
(
s
td
::
move
(
name
)
)
,
problemIteration
_
(
problemIteration
)
,
adaptInfo
_
(
adapt
Info
)
,
problemTime
_
(
problemTime
)
,
initialAdaptInfo
_
(
initialAdaptInfo
)
{}
/// Destructor
virtual
~
AdaptBase
()
{}
virtual
~
AdaptBase
()
=
default
;
/** \brief
* Pure virtual method. Must be overloaded by sub classes to perform
...
...
@@ -39,66 +39,63 @@ namespace AMDiS
/// Returns \ref name
std
::
string
getName
()
const
{
return
name
;
return
name
_
;
}
/// Returns \ref problemIteration
ProblemIterationInterface
*
getProblemIteration
()
const
{
return
problemIteration
;
return
problemIteration
_
;
}
///
void
setProblemIteration
(
ProblemIterationInterface
*
p
ii
)
void
setProblemIteration
(
ProblemIterationInterface
*
p
roblemIteration
)
{
problemIteration
=
p
ii
;
problemIteration
_
=
p
roblemIteration
;
}
/// Returns \ref adaptInfo
AdaptInfo
&
getAdaptInfo
()
const
{
return
adaptInfo
;
return
adaptInfo
_
;
}
/// Returns \ref problemTime
ProblemTimeInterface
*
getProblemTime
()
const
{
return
problemTime
;
return
problemTime
_
;
}
///
void
setProblemTime
(
ProblemTimeInterface
*
p
ti
)
void
setProblemTime
(
ProblemTimeInterface
*
p
roblemTime
)
{
problemTime
=
p
ti
;
problemTime
_
=
p
roblemTime
;
}
/// Returns \ref initialAdaptInfo
AdaptInfo
&
getInitialAdaptInfo
()
const
{
return
*
initialAdaptInfo
;
return
*
initialAdaptInfo
_
;
}
protected:
/// Name of the adaption loop
std
::
string
name
;
std
::
string
name
_
;
/// Problem iteration interface
ProblemIterationInterface
*
problemIteration
;
ProblemIterationInterface
*
problemIteration
_
;
/// Main adapt info
AdaptInfo
&
adaptInfo
;
AdaptInfo
&
adaptInfo
_
;
/// problem time interface
ProblemTimeInterface
*
problemTime
;
ProblemTimeInterface
*
problemTime
_
;
/** \brief
* Adapt info for initial adapt. Will be given to
* problemTime->solveInitialProblem().
*/
AdaptInfo
*
initialAdaptInfo
;
/// Info level
static
int
info
;
AdaptInfo
*
initialAdaptInfo_
;
};
}
// end namespace AMDiS
src/amdis/AdaptInstationary.cpp
View file @
1a8ac387
...
...
@@ -11,19 +11,18 @@
namespace
AMDiS
{
AdaptInstationary
::
AdaptInstationary
(
std
::
string
name
,
ProblemIterationInterface
&
problem
Stat
,
ProblemIterationInterface
&
problem
Iteration
,
AdaptInfo
&
adaptInfo
,
ProblemTimeInterface
&
problem
Instat
,
AdaptInfo
&
initialInfo
)
:
AdaptBase
(
name
,
&
problem
Stat
,
adaptInfo
,
&
problem
Instat
,
&
initialInfo
)
ProblemTimeInterface
&
problem
Time
,
AdaptInfo
&
initial
Adapt
Info
)
:
AdaptBase
(
name
,
&
problem
Iteration
,
adaptInfo
,
&
problem
Time
,
&
initial
Adapt
Info
)
{
Parameters
::
get
(
name
+
"->strategy"
,
strategy
);
Parameters
::
get
(
name
+
"->time delta 1"
,
timeDelta1
);
Parameters
::
get
(
name
+
"->time delta 2"
,
timeDelta2
);
Parameters
::
get
(
name
+
"->info"
,
info
);
Parameters
::
get
(
name
+
"->break when stable"
,
breakWhenStable
);
Parameters
::
get
(
name
+
"->strategy"
,
strategy_
);
Parameters
::
get
(
name
+
"->time delta 1"
,
timeDelta1_
);
Parameters
::
get
(
name
+
"->time delta 2"
,
timeDelta2_
);
Parameters
::
get
(
name
+
"->break when stable"
,
breakWhenStable_
);
fixedTimestep
=
(
adaptInfo
.
getMinTimestep
()
==
adaptInfo
.
getMaxTimestep
());
fixedTimestep
_
=
(
adaptInfo
_
.
getMinTimestep
()
==
adaptInfo
_
.
getMaxTimestep
());
}
...
...
@@ -32,24 +31,24 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::explicitTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo
.
getTime
()
<=
adaptInfo
.
getStartTime
())
problemIteration
->
oneIteration
(
adaptInfo
,
ESTIMATE
);
if
(
adaptInfo
_
.
getTime
()
<=
adaptInfo
_
.
getStartTime
())
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
ESTIMATE
);
// increment time
adaptInfo
.
setTime
(
adaptInfo
.
getTime
()
+
adaptInfo
.
getTimestep
());
adaptInfo
_
.
setTime
(
adaptInfo
_
.
getTime
()
+
adaptInfo
_
.
getTimestep
());
problemTime
->
setTime
(
adaptInfo
);
problemTime
_
->
setTime
(
adaptInfo
_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo
.
getTime
(),
adaptInfo
.
getTimestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo
_
.
getTime
(),
adaptInfo
_
.
getTimestep
());
adaptInfo
.
setSpaceIteration
(
0
);
adaptInfo
_
.
setSpaceIteration
(
0
);
// do the iteration
problemIteration
->
beginIteration
(
adaptInfo
);
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
.
setLastProcessedTimestep
(
adaptInfo
.
getTimestep
());
problemIteration
_
->
beginIteration
(
adaptInfo
_
);
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
FULL_ITERATION
);
problemIteration
_
->
endIteration
(
adaptInfo
_
);
adaptInfo
_
.
setLastProcessedTimestep
(
adaptInfo
_
.
getTimestep
());
}
...
...
@@ -59,86 +58,86 @@ namespace AMDiS
do
{
adaptInfo
.
setTime
(
adaptInfo
.
getTime
()
+
adaptInfo
.
getTimestep
());
problemTime
->
setTime
(
adaptInfo
);
adaptInfo
_
.
setTime
(
adaptInfo
_
.
getTime
()
+
adaptInfo
_
.
getTimestep
());
problemTime
_
->
setTime
(
adaptInfo
_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo
.
getTime
(),
adaptInfo
.
getTimestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo
_
.
getTime
(),
adaptInfo
_
.
getTimestep
());
problemIteration
->
oneIteration
(
adaptInfo
,
NO_ADAPTION
);
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
NO_ADAPTION
);
adaptInfo
.
incTimestepIteration
();
adaptInfo
_
.
incTimestepIteration
();
if
(
!
fixedTimestep
&&
!
adaptInfo
.
timeToleranceReached
()
&&
adaptInfo
.
getTimestepIteration
()
<=
adaptInfo
.
getMaxTimestepIteration
()
&&
!
(
adaptInfo
.
getTimestep
()
<=
adaptInfo
.
getMinTimestep
()))
if
(
!
fixedTimestep
_
&&
!
adaptInfo
_
.
timeToleranceReached
()
&&
adaptInfo
_
.
getTimestepIteration
()
<=
adaptInfo
_
.
getMaxTimestepIteration
()
&&
!
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMinTimestep
()))
{
adaptInfo
.
setTime
(
adaptInfo
.
getTime
()
-
adaptInfo
.
getTimestep
());
adaptInfo
.
setTimestep
(
adaptInfo
.
getTimestep
()
*
timeDelta1
);
adaptInfo
_
.
setTime
(
adaptInfo
_
.
getTime
()
-
adaptInfo
_
.
getTimestep
());
adaptInfo
_
.
setTimestep
(
adaptInfo
_
.
getTimestep
()
*
timeDelta1
_
);
continue
;
}
adaptInfo
.
setSpaceIteration
(
0
);
adaptInfo
_
.
setSpaceIteration
(
0
);
// === Do space iterations only if the maximum is higher than 0. ===
if
(
adaptInfo
.
getMaxSpaceIteration
()
>
0
)
if
(
adaptInfo
_
.
getMaxSpaceIteration
()
>
0
)
{
// === Space iterations. ===
do
{
problemIteration
->
beginIteration
(
adaptInfo
);
problemIteration
_
->
beginIteration
(
adaptInfo
_
);
Flag
adapted
=
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
Flag
adapted
=
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
FULL_ITERATION
);
if
(
adapted
==
Flag
{
0
})
{
if
(
!
fixedTimestep
&&
!
adaptInfo
.
timeToleranceReached
()
&&
!
(
adaptInfo
.
getTimestep
()
<=
adaptInfo
.
getMinTimestep
()))
if
(
!
fixedTimestep
_
&&
!
adaptInfo
_
.
timeToleranceReached
()
&&
!
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMinTimestep
()))
{
adaptInfo
.
setTime
(
adaptInfo
.
getTime
()
-
adaptInfo
.
getTimestep
());
adaptInfo
.
setTimestep
(
adaptInfo
.
getTimestep
()
*
timeDelta2
);
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
.
incSpaceIteration
();
adaptInfo
_
.
setTime
(
adaptInfo
_
.
getTime
()
-
adaptInfo
_
.
getTimestep
());
adaptInfo
_
.
setTimestep
(
adaptInfo
_
.
getTimestep
()
*
timeDelta2
_
);
problemIteration
_
->
endIteration
(
adaptInfo
_
);
adaptInfo
_
.
incSpaceIteration
();
break
;
}
}
adaptInfo
.
incSpaceIteration
();
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
_
.
incSpaceIteration
();
problemIteration
_
->
endIteration
(
adaptInfo
_
);
}
while
(
!
adaptInfo
.
spaceToleranceReached
()
&&
adaptInfo
.
getSpaceIteration
()
<=
adaptInfo
.
getMaxSpaceIteration
());
while
(
!
adaptInfo
_
.
spaceToleranceReached
()
&&
adaptInfo
_
.
getSpaceIteration
()
<=
adaptInfo
_
.
getMaxSpaceIteration
());
}
else
{
problemIteration
->
endIteration
(
adaptInfo
);
problemIteration
_
->
endIteration
(
adaptInfo
_
);
}
}
while
(
!
adaptInfo
.
timeToleranceReached
()
&&
!
(
adaptInfo
.
getTimestep
()
<=
adaptInfo
.
getMinTimestep
())
&&
adaptInfo
.
getTimestepIteration
()
<=
adaptInfo
.
getMaxTimestepIteration
());
while
(
!
adaptInfo
_
.
timeToleranceReached
()
&&
!
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMinTimestep
())
&&
adaptInfo
_
.
getTimestepIteration
()
<=
adaptInfo
_
.
getMaxTimestepIteration
());
adaptInfo
.
setLastProcessedTimestep
(
adaptInfo
.
getTimestep
());
adaptInfo
_
.
setLastProcessedTimestep
(
adaptInfo
_
.
getTimestep
());
// 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
()
*
timeDelta2
);
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
);
if
(
!
fixedTimestep
_
&&
!
adaptInfo
_
.
timeToleranceReached
()
&&
!
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMinTimestep
()))
adaptInfo
_
.
setTimestep
(
adaptInfo
_
.
getTimestep
()
*
timeDelta1
_
);
}
...
...
@@ -147,27 +146,27 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::simpleAdaptiveTimeStrategy()"
);
// estimate before first adaption
if
(
adaptInfo
.
getTime
()
<=
adaptInfo
.
getStartTime
())
problemIteration
->
oneIteration
(
adaptInfo
,
ESTIMATE
);
if
(
adaptInfo
_
.
getTime
()
<=
adaptInfo
_
.
getStartTime
())
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
ESTIMATE
);
adaptInfo
.
setTime
(
adaptInfo
.
getTime
()
+
adaptInfo
.
getTimestep
());
problemTime
->
setTime
(
adaptInfo
);
adaptInfo
_
.
setTime
(
adaptInfo
_
.
getTime
()
+
adaptInfo
_
.
getTimestep
());
problemTime
_
->
setTime
(
adaptInfo
_
);
msg
(
"time = {}, timestep = {}"
,
adaptInfo
.
getTime
(),
adaptInfo
.
getTimestep
());
msg
(
"time = {}, timestep = {}"
,
adaptInfo
_
.
getTime
(),
adaptInfo
_
.
getTimestep
());
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
FULL_ITERATION
);
adaptInfo
.
setLastProcessedTimestep
(
adaptInfo
.
getTimestep
());
adaptInfo
_
.
setLastProcessedTimestep
(
adaptInfo
_
.
getTimestep
());
// First, check for increase of timestep
if
(
!
fixedTimestep
&&
adaptInfo
.
timeErrorLow
())
adaptInfo
.
setTimestep
(
adaptInfo
.
getTimestep
()
*
timeDelta2
);
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
);
if
(
!
fixedTimestep
_
&&
!
adaptInfo
_
.
timeToleranceReached
()
&&
!
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMinTimestep
()))
adaptInfo
_
.
setTimestep
(
adaptInfo
_
.
getTimestep
()
*
timeDelta1
_
);
}
...
...
@@ -175,9 +174,9 @@ namespace AMDiS
{
AMDIS_FUNCNAME
(
"AdaptInstationary::oneTimestep()"
);
adaptInfo
.
setTimestepIteration
(
0
);
adaptInfo
_
.
setTimestepIteration
(
0
);
switch
(
strategy
)
switch
(
strategy
_
)
{
case
0
:
explicitTimeStrategy
();
...
...
@@ -189,10 +188,10 @@ namespace AMDiS
simpleAdaptiveTimeStrategy
();
break
;
default:
error_exit
(
"Unknown strategy = {}"
,
strategy
);
error_exit
(
"Unknown strategy = {}"
,
strategy
_
);
}
adaptInfo
.
incTimestepNumber
();
adaptInfo
_
.
incTimestepNumber
();
}
...
...
@@ -201,33 +200,33 @@ namespace AMDiS
AMDIS_FUNCNAME
(
"AdaptInstationary::adapt()"
);
int
errorCode
=
0
;
test_exit
(
adaptInfo
.
getTimestep
()
>=
adaptInfo
.
getMinTimestep
(),
test_exit
(
adaptInfo
_
.
getTimestep
()
>=
adaptInfo
_
.
getMinTimestep
(),
"timestep < min timestep"
);
test_exit
(
adaptInfo
.
getTimestep
()
<=
adaptInfo
.
getMaxTimestep
(),
test_exit
(
adaptInfo
_
.
getTimestep
()
<=
adaptInfo
_
.
getMaxTimestep
(),
"timestep > max timestep"
);
test_exit
(
adaptInfo
.
getTimestep
()
>
0
,
"timestep <= 0!"
);
test_exit
(
adaptInfo
_
.
getTimestep
()
>
0
,
"timestep <= 0!"
);
if
(
adaptInfo
.
getTimestepNumber
()
==
0
)
if
(
adaptInfo
_
.
getTimestepNumber
()
==
0
)
{
adaptInfo
.
setTime
(
adaptInfo
.
getStartTime
());
initialAdaptInfo
->
setStartTime
(
adaptInfo
.
getStartTime
());
initialAdaptInfo
->
setTime
(
adaptInfo
.
getStartTime
());
adaptInfo
_
.
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
())
while
(
!
adaptInfo
_
.
reachedEndTime
())
{
problemTime
->
initTimestep
(
adaptInfo
);
problemTime
_
->
initTimestep
(
adaptInfo
_
);
oneTimestep
();
problemTime
->
closeTimestep
(
adaptInfo
);
problemTime
_
->
closeTimestep
(
adaptInfo
_
);
if
(
breakWhenStable
&&
(
adaptInfo
.
getSolverIterations
()
==
0
))
if
(
breakWhenStable
_
&&
(
adaptInfo
_
.
getSolverIterations
()
==
0
))
break
;
}
...
...
src/amdis/AdaptInstationary.hpp
View file @
1a8ac387
...
...
@@ -32,15 +32,15 @@ namespace AMDiS
AdaptInfo
&
initialInfo
);
/// Sets \ref strategy to aStrategy
void
setStrategy
(
int
aS
trategy
)
void
setStrategy
(
int
s
trategy
)
{
strategy
=
aS
trategy
;
strategy
_
=
s
trategy
;
}
/// Returns \ref strategy
int
getStrategy
()
const
{
return
strategy
;
return
strategy
_
;
}
/// Implementation of AdaptBase::adapt()
...
...
@@ -76,20 +76,20 @@ namespace AMDiS
protected:
/// Strategy for choosing one timestep
int
strategy
=
0
;
int
strategy
_
=
0
;
/// Parameter \f$ \delta_1 \f$ used in time step reduction
double
timeDelta1
=
0.7071
;
double
timeDelta1
_
=
0.7071
;
/// Parameter \f$ \delta_2 \f$ used in time step enlargement
double
timeDelta2
=
1.4142
;
double
timeDelta2
_
=
1.4142
;
/// If this parameter is 1 and the instationary problem is stable, hence the number
/// of solver iterations to solve the problem is zero, the adaption loop will stop.
bool
breakWhenStable
=
false
;
bool
breakWhenStable
_
=
false
;
/// min-timestep == max-timestep
bool
fixedTimestep
;
bool
fixedTimestep
_
;
};
}
// end namespace AMDiS
src/amdis/AdaptStationary.cpp
View file @
1a8ac387
...
...
@@ -9,39 +9,37 @@
namespace
AMDiS
{
AdaptStationary
::
AdaptStationary
(
std
::
string
name
,
ProblemIterationInterface
&
prob
,
ProblemIterationInterface
&
prob
lemIteration
,
AdaptInfo
&
adaptInfo
)
:
AdaptBase
(
name
,
&
prob
,
adaptInfo
)
{
Parameters
::
get
(
name
+
"->info"
,
info
);
}
:
AdaptBase
(
std
::
move
(
name
),
&
problemIteration
,
adaptInfo
)
{}
int
AdaptStationary
::
adapt
()
{
// initial iteration
if
(
adaptInfo
.
getSpaceIteration
()
==
-
1
)
if
(
adaptInfo
_
.
getSpaceIteration
()
==
-
1
)
{
problemIteration
->
beginIteration
(
adaptInfo
);
problemIteration
->
oneIteration
(
adaptInfo
,
NO_ADAPTION
);
problemIteration
->
endIteration
(
adaptInfo
);
adaptInfo
.
incSpaceIteration
();
problemIteration
_
->
beginIteration
(
adaptInfo
_
);
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
NO_ADAPTION
);
problemIteration
_
->
endIteration
(
adaptInfo
_
);
adaptInfo
_
.
incSpaceIteration
();
}
// adaption loop
while
(
!
adaptInfo
.
spaceToleranceReached
()
&&
(
adaptInfo
.
getSpaceIteration
()
<
adaptInfo
.
getMaxSpaceIteration
()
||
adaptInfo
.
getMaxSpaceIteration
()
<
0
)
)
while
(
!
adaptInfo
_
.
spaceToleranceReached
()
&&
(
adaptInfo
_
.
getSpaceIteration
()
<
adaptInfo
_
.
getMaxSpaceIteration
()
||
adaptInfo
_
.
getMaxSpaceIteration
()
<
0
)
)
{
problemIteration
->
beginIteration
(
adaptInfo
);
Flag
adapted
=
problemIteration
->
oneIteration
(
adaptInfo
,
FULL_ITERATION
);
problemIteration
->
endIteration
(
adaptInfo
);
problemIteration
_
->
beginIteration
(
adaptInfo
_
);
Flag
adapted
=
problemIteration
_
->
oneIteration
(
adaptInfo
_
,
FULL_ITERATION
);
problemIteration
_
->
endIteration
(
adaptInfo
_
);
if
(
adapted
==
Flag
{
0
})
break
;
adaptInfo
.
incSpaceIteration
();
adaptInfo
_
.
incSpaceIteration
();
}
return
0
;
...
...
src/amdis/AdaptStationary.hpp
View file @
1a8ac387
...
...
@@ -31,8 +31,8 @@ namespace AMDiS
public:
/// Creates a AdaptStationary object with given name.
AdaptStationary
(
std
::
string
name
,
ProblemIterationInterface
&
prob
,
AdaptInfo
&
i
nfo
);
ProblemIterationInterface
&
prob
lemIteration
,
AdaptInfo
&
adaptI
nfo
);
/// Implementation of AdaptBase::adapt()
virtual
int
adapt
()
override
;
...
...
src/amdis/CMakeLists.txt
View file @
1a8ac387
#install headers
dune_library_add_sources
(
amdis SOURCES
AdaptBase.cpp
AdaptInfo.cpp
AdaptInstationary.cpp
AdaptStationary.cpp
...
...
src/amdis/ProblemInstat.hpp
View file @
1a8ac387
...
...
@@ -30,13 +30,13 @@ namespace AMDiS
public:
/// Constructs a ProblemInstat with prob as its stationary problem.
ProblemInstat
(
std
::
string
name
,
ProblemType
&
prob
)
:
ProblemInstatBase
(
name
,
nullptr
)
,
problemStat
(
prob
)
:
ProblemInstatBase
(
std
::
move
(
name
)
,
nullptr
)
,
problemStat
_
(
prob
)
{}
ProblemInstat
(
std
::
string
name
,
ProblemType
&
prob
,
ProblemStatBase
&
initialProb
)
:
ProblemInstatBase
(
name
,
&
initialProb
)
,
problemStat
(
prob
)
:
ProblemInstatBase
(
std
::
move
(
name
)
,
&
initialProb
)
,
problemStat
_
(
prob
)
{}
/// Initialisation of the problem.
...
...
@@ -54,15 +54,15 @@ namespace AMDiS
/// Returns \ref problemStat.
ProblemType
&
getStatProblem
()
{
return
problemStat
;
return
problemStat
_
;
}
/// Returns \ref oldSolution.
std
::
unique_ptr
<
SystemVector
>
getOldSolutionVector
()
const
{
test_exit_dbg
(
oldSolution
,
test_exit_dbg
(
oldSolution
_
,
"OldSolution need to be created. Call initialize with INIT_UH_OLD."
);
return
*
oldSolution
;
return
*
oldSolution
_
;
}
/// Return a mutable view to a oldSolution component
...
...
@@ -70,7 +70,7 @@ namespace AMDiS
auto
getOldSolution
(
TreePath
const
&
path
=
{})
{
auto
&&
tp
=
makeTreePath
(
path
);
return
makeDOFVectorView
(
*
oldSolution
,
tp
);
return
makeDOFVectorView
(
*
oldSolution
_
,
tp
);
}
/// Return a const view to a oldSolution component
...
...
@@ -78,7 +78,7 @@ namespace AMDiS
auto
getOldSolution
(
TreePath
const
&
path
=
{})
const
{
auto
&&
tp
=
makeTreePath
(
path
);
return
makeDOFVectorView
(
*
oldSolution
,
tp
);
return
makeDOFVectorView
(
*
oldSolution
_
,
tp
);
}
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
...
...
@@ -86,10 +86,10 @@ namespace AMDiS
protected:
/// Space problem solved in each timestep.
ProblemType
&
problemStat
;
ProblemType
&
problemStat
_
;
/// Solution of the last timestep.
std
::
unique_ptr
<
SystemVector
>
oldSolution
;
std
::
unique_ptr
<
SystemVector
>
oldSolution
_
;
};
...
...
src/amdis/ProblemInstat.inc.hpp
View file @
1a8ac387
...
...
@@ -16,7 +16,7 @@ void ProblemInstat<Traits>::transferInitialSolution(AdaptInfo& adaptInfo)
test_exit
(
adaptInfo
.
getTime
()
==
adaptInfo
.
getStartTime
(),
"after initial solution: time != start time"
);
problemStat
.
writeFiles
(
adaptInfo
,
true
);
problemStat
_
.
writeFiles
(
adaptInfo
,
true
);