Commit c514d77b authored by Backofen, Rainer's avatar Backofen, Rainer
Browse files

extended interface for Rosenbrock analog to standard AdaptInstat

parent 59ec2774
......@@ -163,44 +163,45 @@ namespace AMDiS {
if (nb->getFirstChild() && edgeNo != 2) {
// Search for the next neighbour. In many cases, the neighbour element
// may be refinemed in a way, such that there is no new vertex on the
// common edge. This situation is shown in the following picture:
//
// /|\
// / | \
// / | \
// /\ | \
// / \ | \
// / \| \
// -------------
//
// nb el
//
// Note that we know (because of the last if statement), that the
// neighbour element has children and the common edge is not the
// refinement edge, which has always the number 2, of our element.
/*
* Search for the next neighbour. In many cases, the neighbour element
* may be refinemed in a way, such that there is no new vertex on the
* common edge. This situation is shown in the following picture:
*
* /|\
* / | \
* / | \
* /\ | \
* / \ | \
* / \| \
* -------------
*
* nb el
*
* Note that we know (because of the last if statement), that the
* neighbour element has children and the common edge is not the
* refinement edge, which has always the number 2, of our element.
*/
if (edgeNo == 0) {
// The situation is as follows:
//
// -------
// \ /|\
// \ / | \
// \/ | \
// \ | \
// \ | \
// \| \
// -------
//
// nb el
//
// That means, the edge 0 of the same level neighbour is the common
// edge, i.e., the direct neighbour is the second child of the same
// level neighbour.
/*
* The situation is as follows:
*
* -------
* \ /|\
* \ / | \
* \/ | \
* \ | \
* \ | \
* \| \
* -------
*
* nb el
*
* That means, the edge 0 of the same level neighbour is the common
* edge, i.e., the direct neighbour is the second child of the same
* level neighbour.
*/
nb = neighbour[i] = nb->getSecondChild();
} else {
// The situation is as shown in the picture above. So the next
......
......@@ -32,27 +32,50 @@ namespace AMDiS {
tauGamma(1.0)
{
FUNCNAME("RosenbrockAdaptInstationary::RosenbrockAdaptInstationary()");
initConstructor(problemStat);
}
RosenbrockAdaptInstationary::RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary &problemStat,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestamp)
: AdaptInstationary(name, problemStat, info, problemInstat, initialInfo, initialTimestamp),
rosenbrockStat(&problemStat),
firstTimestep(true),
lastTimestepRejected(false),
succRejection(false),
fixFirstTimesteps(0),
tau(1.0),
tauGamma(1.0)
{
FUNCNAME("RosenbrockAdaptInstationary::RosenbrockAdaptInstationary()");
initConstructor(&problemStat);
}
void RosenbrockAdaptInstationary::initConstructor(
RosenbrockStationary *problemStat)
{
std::string str;
Parameters::get(name + "->rosenbrock method", str);
RosenbrockMethodCreator *creator =
dynamic_cast<RosenbrockMethodCreator*>(CreatorMap<RosenbrockMethod>::getCreator(str));
dynamic_cast<RosenbrockMethodCreator*>(CreatorMap<RosenbrockMethod>::getCreator(str));
rosenbrockMethod = creator->create();
TEST_EXIT_DBG(rosenbrockMethod)("This should not happen!\n");
Parameters::get(name + "->fix first timesteps", fixFirstTimesteps);
problemStat->setRosenbrockMethod(rosenbrockMethod);
adaptInfo->setRosenbrockMode(true);
problemStat->setTauGamma(&tauGamma);
problemStat->setTau(&tau);
}
}
void RosenbrockAdaptInstationary::oneTimestep()
{
void RosenbrockAdaptInstationary::oneTimestep()
{
FUNCNAME("RosenbrockAdaptInstationary::oneTimestep()");
// estimate before first adaption
......
......@@ -34,6 +34,11 @@ namespace AMDiS {
class RosenbrockAdaptInstationary : public AdaptInstationary
{
public:
/** \brief
* Creates a AdaptInstationary object for Rosenbrock method
* with the given name for the time
* dependent problem problemInstat. TODO: Make obsolete!
*/
RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary *problemStat,
AdaptInfo *info,
......@@ -41,8 +46,27 @@ namespace AMDiS {
AdaptInfo *initialInfo,
time_t initialTimestamp = 0);
/** \brief
* Creates a AdaptInstationary object for Rosenbrock method
* with the given name for the time
* dependent problem problemInstat.
*/
RosenbrockAdaptInstationary(std::string name,
RosenbrockStationary &problemStat,
AdaptInfo &info,
ProblemTimeInterface &problemInstat,
AdaptInfo &initialInfo,
time_t initialTimestamp = 0);
/// Runs the Rosenbrock loop until one timestep is accepted.
void oneTimestep();
/** \brief
* This funciton is used only to avoid double code in both constructors. If the
* obsolte constructure, which uses pointers instead of references, will be
* removed, remove also this function.
* TODO: Remove if obsolete constructor will be removed.
*/
void initConstructor(RosenbrockStationary *problemStat);
protected:
/// Pointer to the Rosenbrock method that should be used.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment