diff --git a/AMDiS/src/ElInfo2d.cc b/AMDiS/src/ElInfo2d.cc index 1d6aa035726506eceb1dcf6b408c702c6bfb1dc1..1988a5408762d3d44d04d62c14bd9d7837867645 100644 --- a/AMDiS/src/ElInfo2d.cc +++ b/AMDiS/src/ElInfo2d.cc @@ -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 diff --git a/AMDiS/src/time/RosenbrockAdaptInstationary.cc b/AMDiS/src/time/RosenbrockAdaptInstationary.cc index 97ffa94161001d315fd90d8e1d6213d34108db85..2b1477b081c999e7970fa2ad95c7b621cb024c38 100644 --- a/AMDiS/src/time/RosenbrockAdaptInstationary.cc +++ b/AMDiS/src/time/RosenbrockAdaptInstationary.cc @@ -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 diff --git a/AMDiS/src/time/RosenbrockAdaptInstationary.h b/AMDiS/src/time/RosenbrockAdaptInstationary.h index 97b5b68329f7627327e1168033281073cd0ec1d5..e9fc31a9452b0849c8f07b70b8c92341120113b1 100644 --- a/AMDiS/src/time/RosenbrockAdaptInstationary.h +++ b/AMDiS/src/time/RosenbrockAdaptInstationary.h @@ -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.