Commit 0e305139 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

CouplingBaseProblem added

parent 276a067a
/** \file CoupledBaseProblem.h */ /** \file CouplingBaseProblem.h */
#ifndef COUPLED_BASE_PROBLEM_H #ifndef COUPLING_BASE_PROBLEM_H
#define COUPLED_BASE_PROBLEM_H #define COUPLING_BASE_PROBLEM_H
#include "AMDiS.h" #include "AMDiS.h"
...@@ -21,14 +21,14 @@ using namespace AMDiS; ...@@ -21,14 +21,14 @@ using namespace AMDiS;
* \brief * \brief
*/ */
template<class ProblemType=ProblemStat, class BaseProblemType=BaseProblem<ProblemStat> > template<class ProblemType=ProblemStat, class BaseProblemType=BaseProblem<ProblemStat> >
class CoupledBaseProblem : public CouplingIterationInterface, class CouplingBaseProblem : public CouplingIterationInterface,
public CouplingTimeInterface, public CouplingTimeInterface,
public CouplingProblemStatImpl<ProblemType> public CouplingProblemStatImpl<ProblemType>
{ {
public: public:
typedef CouplingProblemStatImpl<ProblemType> CProblemStat; typedef CouplingProblemStatImpl<ProblemType> CProblemStat;
CoupledBaseProblem(std::string name_, CouplingBaseProblem(std::string name_,
BaseProblemType *prob0_, BaseProblemType *prob0_,
BaseProblemType *prob1_=NULL, BaseProblemType *prob1_=NULL,
BaseProblemType *prob2_=NULL, BaseProblemType *prob2_=NULL,
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
if (prob4_) baseProblems.push_back(prob4_); if (prob4_) baseProblems.push_back(prob4_);
} }
~CoupledBaseProblem() { } ~CouplingBaseProblem() { }
virtual void initialize(Flag initFlag, virtual void initialize(Flag initFlag,
ProblemStat *adoptProblem = NULL, ProblemStat *adoptProblem = NULL,
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
/// get the j-th solution-vector of the i-th problem /// get the j-th solution-vector of the i-th problem
DOFVector<double> *getSolution(int i, int j) DOFVector<double> *getSolution(int i, int j)
{ FUNCNAME("CoupledBaseProblem::getSolution(i,j)"); { FUNCNAME("CouplingBaseProblem::getSolution(i,j)");
TEST_EXIT(0<=i && 0<=j && i<baseProblems.size() && j<=baseProblems[i]->getNumComponents()) TEST_EXIT(0<=i && 0<=j && i<baseProblems.size() && j<=baseProblems[i]->getNumComponents())
("Indices out of range!\n"); ("Indices out of range!\n");
return baseProblems[i]->getSolution()->getDOFVector(j); return baseProblems[i]->getSolution()->getDOFVector(j);
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
/// pointer to the j-th feSpace of the i-th problem /// pointer to the j-th feSpace of the i-th problem
inline const FiniteElemSpace* getFeSpace(int i, int j=0) inline const FiniteElemSpace* getFeSpace(int i, int j=0)
{ FUNCNAME("CoupledBaseProblem::getFeSpace(i,j)"); { FUNCNAME("CouplingBaseProblem::getFeSpace(i,j)");
TEST_EXIT(0<=i && 0<=j && i<baseProblems.size() && j<=baseProblems[i]->getNumComponents()) TEST_EXIT(0<=i && 0<=j && i<baseProblems.size() && j<=baseProblems[i]->getNumComponents())
("Indices out of range!\n"); ("Indices out of range!\n");
return baseProblems[i]->getFeSpace(j); return baseProblems[i]->getFeSpace(j);
...@@ -112,4 +112,4 @@ protected: ...@@ -112,4 +112,4 @@ protected:
}; };
#endif // COUPLED_BASE_PROBLEM_H #endif // COUPLING_BASE_PROBLEM_H
/** \file CoupledBaseProblem.h */ /** \file CouplingBaseProblem.h */
#ifndef COUPLED_BASE_PROBLEM_H #ifndef COUPLING_BASE_PROBLEM_H
#define COUPLED_BASE_PROBLEM_H #define COUPLING_BASE_PROBLEM_H
#include "AMDiS.h" #include "AMDiS.h"
...@@ -72,7 +72,7 @@ namespace detail { ...@@ -72,7 +72,7 @@ namespace detail {
*/ */
template<class ProblemType=ProblemStat, template<class ProblemType=ProblemStat,
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(MAX_NUM_COUPLED_PROBLEMS, class BaseProblemType, void) > BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(MAX_NUM_COUPLED_PROBLEMS, class BaseProblemType, void) >
class CoupledBaseProblem : public CouplingIterationInterface, class CouplingBaseProblem : public CouplingIterationInterface,
public CouplingTimeInterface, public CouplingTimeInterface,
public CouplingProblemStatImpl<ProblemType> public CouplingProblemStatImpl<ProblemType>
{ {
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
#define COUPLED_BASEPROBLEM_CONSTRUCTOR(z, n, text) \ #define COUPLED_BASEPROBLEM_CONSTRUCTOR(z, n, text) \
template<BOOST_PP_ENUM(BOOST_PP_INC(n), BASEPROBLEM_TYPES, BaseProblemType)> \ template<BOOST_PP_ENUM(BOOST_PP_INC(n), BASEPROBLEM_TYPES, BaseProblemType)> \
CoupledBaseProblem(std::string name_, \ CouplingBaseProblem(std::string name_, \
BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(n), BASEPROBLEM_ARGS, nil) ) \ BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(n), BASEPROBLEM_ARGS, nil) ) \
: CProblemStat(name_),\ : CProblemStat(name_),\
baseProblems( BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), prob) ), name(name_) \ baseProblems( BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), prob) ), name(name_) \
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
#define COUPLED_BASEPROBLEM_CONSTRUCTOR2(z, n, text) \ #define COUPLED_BASEPROBLEM_CONSTRUCTOR2(z, n, text) \
template<BOOST_PP_ENUM(BOOST_PP_INC(n), BASEPROBLEM_TYPES, BaseProblemType)> \ template<BOOST_PP_ENUM(BOOST_PP_INC(n), BASEPROBLEM_TYPES, BaseProblemType)> \
CoupledBaseProblem(std::string name_, \ CouplingBaseProblem(std::string name_, \
BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(n), BASEPROBLEM_ARGS2, nil) ) \ BOOST_PP_REPEAT_ ## z(BOOST_PP_INC(n), BASEPROBLEM_ARGS2, nil) ) \
: CProblemStat(name_),\ : CProblemStat(name_),\
baseProblems( BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), *prob) ), name(name_) \ baseProblems( BOOST_PP_ENUM_PARAMS_Z(z, BOOST_PP_INC(n), *prob) ), name(name_) \
...@@ -107,7 +107,7 @@ public: ...@@ -107,7 +107,7 @@ public:
BOOST_PP_REPEAT(MAX_NUM_COUPLED_PROBLEMS, COUPLED_BASEPROBLEM_CONSTRUCTOR2, nil) BOOST_PP_REPEAT(MAX_NUM_COUPLED_PROBLEMS, COUPLED_BASEPROBLEM_CONSTRUCTOR2, nil)
~CoupledBaseProblem() { } ~CouplingBaseProblem() { }
void initialize(Flag initFlag, void initialize(Flag initFlag,
ProblemStat *adoptProblem = NULL, ProblemStat *adoptProblem = NULL,
...@@ -146,7 +146,7 @@ public: ...@@ -146,7 +146,7 @@ public:
/// get the j-th solution-vector of the i-th problem /// get the j-th solution-vector of the i-th problem
template<int i> template<int i>
DOFVector<double> *getSolution(int j) DOFVector<double> *getSolution(int j)
{ FUNCNAME("CoupledBaseProblem::getSolution<i>(j)"); { FUNCNAME("CouplingBaseProblem::getSolution<i>(j)");
BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem-index out of range"); BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem-index out of range");
TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n"); TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n");
...@@ -157,7 +157,7 @@ public: ...@@ -157,7 +157,7 @@ public:
/// pointer to the j-th feSpace of the i-th problem /// pointer to the j-th feSpace of the i-th problem
template<int i> template<int i>
inline const FiniteElemSpace* getFeSpace(int j=0) inline const FiniteElemSpace* getFeSpace(int j=0)
{ FUNCNAME("CoupledBaseProblem::getFeSpace<i>(j)"); { FUNCNAME("CouplingBaseProblem::getFeSpace<i>(j)");
BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem index out of range"); BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem index out of range");
TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n"); TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n");
...@@ -177,4 +177,4 @@ protected: ...@@ -177,4 +177,4 @@ protected:
} // end namespace AMDiS } // end namespace AMDiS
#endif // COUPLED_BASE_PROBLEM_H #endif // COUPLING_BASE_PROBLEM_H
/** \file CoupledBaseProblem.h */ /** \file CouplingBaseProblem.h */
#ifndef COUPLED_BASE_PROBLEM_H #ifndef COUPLING_BASE_PROBLEM_H
#define COUPLED_BASE_PROBLEM_H #define COUPLING_BASE_PROBLEM_H
#include "AMDiS.h" #include "AMDiS.h"
...@@ -70,7 +70,7 @@ namespace detail { ...@@ -70,7 +70,7 @@ namespace detail {
* \brief Structur to couple BaseProblems of variouse types * \brief Structur to couple BaseProblems of variouse types
*/ */
template<typename ProblemType=ProblemStat, typename... BaseProblemTypes > template<typename ProblemType=ProblemStat, typename... BaseProblemTypes >
class CoupledBaseProblem : public CouplingIterationInterface, class CouplingBaseProblem : public CouplingIterationInterface,
public CouplingTimeInterface, public CouplingTimeInterface,
public CouplingProblemStatImpl<ProblemType> public CouplingProblemStatImpl<ProblemType>
{ {
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
typedef std::tuple<BaseProblemTypes&...> BaseProblemsTupleType; typedef std::tuple<BaseProblemTypes&...> BaseProblemsTupleType;
template<typename... BaseProblemTypes_> template<typename... BaseProblemTypes_>
CoupledBaseProblem(std::string name_, BaseProblemTypes_&&... baseProblems_) CouplingBaseProblem(std::string name_, BaseProblemTypes_&&... baseProblems_)
: CProblemStat(name_), : CProblemStat(name_),
baseProblems(baseProblems_...), baseProblems(baseProblems_...),
name(name_) name(name_)
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
dow = Global::getGeo(WORLD); dow = Global::getGeo(WORLD);
} }
~CoupledBaseProblem() { } ~CouplingBaseProblem() { }
void initialize(Flag initFlag, void initialize(Flag initFlag,
ProblemStat *adoptProblem = NULL, ProblemStat *adoptProblem = NULL,
...@@ -126,7 +126,7 @@ public: ...@@ -126,7 +126,7 @@ public:
/// get the j-th solution-vector of the i-th problem /// get the j-th solution-vector of the i-th problem
template<int i> template<int i>
DOFVector<double> *getSolution(int j) DOFVector<double> *getSolution(int j)
{ FUNCNAME("CoupledBaseProblem::getSolution<i>(j)"); { FUNCNAME("CouplingBaseProblem::getSolution<i>(j)");
BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem-index out of range"); BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem-index out of range");
TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n"); TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n");
...@@ -137,7 +137,7 @@ public: ...@@ -137,7 +137,7 @@ public:
/// pointer to the j-th feSpace of the i-th problem /// pointer to the j-th feSpace of the i-th problem
template<int i> template<int i>
inline const FiniteElemSpace* getFeSpace(int j=0) inline const FiniteElemSpace* getFeSpace(int j=0)
{ FUNCNAME("CoupledBaseProblem::getFeSpace<i>(j)"); { FUNCNAME("CouplingBaseProblem::getFeSpace<i>(j)");
BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem index out of range"); BOOST_STATIC_ASSERT_MSG(0 <= i && i < _LENGTH_<BaseProblemsTupleType>::value , "BaseProblem index out of range");
TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n"); TEST_EXIT(0 <= j && j <= _GET_<i>(baseProblems).getNumComponents())("Indices out of range!\n");
...@@ -157,4 +157,4 @@ protected: ...@@ -157,4 +157,4 @@ protected:
} // end namespace AMDiS } // end namespace AMDiS
#endif // COUPLED_BASE_PROBLEM_H #endif // COUPLING_BASE_PROBLEM_H
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "CouplingTimeInterface.h" #include "CouplingTimeInterface.h"
#include "CouplingProblemStat.h" #include "CouplingProblemStat.h"
#include "BaseProblem_RB.h" #include "BaseProblem_RB.h"
#include "CoupledBaseProblem.h" #include "CouplingBaseProblem.h"
#include "time/ExtendedRosenbrockStationary.h" #include "time/ExtendedRosenbrockStationary.h"
using namespace AMDiS; using namespace AMDiS;
...@@ -21,10 +21,10 @@ using namespace AMDiS; ...@@ -21,10 +21,10 @@ using namespace AMDiS;
* *
* \brief * \brief
*/ */
class CoupledBaseProblem_RB : public CoupledBaseProblem<ExtendedRosenbrockStationary, BaseProblem_RB> class CouplingBaseProblem_RB : public CouplingBaseProblem<ExtendedRosenbrockStationary, BaseProblem_RB>
{ {
public: public:
typedef CoupledBaseProblem<ExtendedRosenbrockStationary, BaseProblem_RB> super; typedef CouplingBaseProblem<ExtendedRosenbrockStationary, BaseProblem_RB> super;
typedef BaseProblem_RB BaseProblemType; typedef BaseProblem_RB BaseProblemType;
typedef CouplingProblemStatImpl<ExtendedRosenbrockStationary> CProblemStat; typedef CouplingProblemStatImpl<ExtendedRosenbrockStationary> CProblemStat;
......
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