Commit 63917c5d authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

CouplingProblems extended

parent f2548627
...@@ -63,10 +63,10 @@ public: ...@@ -63,10 +63,10 @@ public:
/// Initialisation of DOFVectors and AbstractFunctions, /// Initialisation of DOFVectors and AbstractFunctions,
/// is called in \ref initTimeInteface after feSpace and mesh are initialized /// is called in \ref initTimeInteface after feSpace and mesh are initialized
virtual void initData() {}; virtual void initData() {}
/// Method is called at the end of \ref initTimeInteface /// Method is called at the end of \ref initTimeInteface
virtual void finalizeData() {}; virtual void finalizeData() {}
/// calls \ref initData, \ref fillOperators and \ref fillBoundaryConditions in this ordering /// calls \ref initData, \ref fillOperators and \ref fillBoundaryConditions in this ordering
virtual void initTimeInterface() virtual void initTimeInterface()
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
BaseProblemType *prob2_=NULL, BaseProblemType *prob2_=NULL,
BaseProblemType *prob3_=NULL, BaseProblemType *prob3_=NULL,
BaseProblemType *prob4_=NULL) BaseProblemType *prob4_=NULL)
: CProblemStat(name_) : CProblemStat(name_), name(name_)
{ {
dow = Global::getGeo(WORLD); dow = Global::getGeo(WORLD);
baseProblems.push_back(prob0_); baseProblems.push_back(prob0_);
...@@ -66,6 +66,7 @@ public: ...@@ -66,6 +66,7 @@ public:
} }
virtual void initData() {} virtual void initData() {}
virtual void finalizeData() {}
virtual void initTimeInterface() virtual void initTimeInterface()
{ {
...@@ -80,6 +81,10 @@ public: ...@@ -80,6 +81,10 @@ public:
for (size_t i = 0; i < baseProblems.size(); i++) for (size_t i = 0; i < baseProblems.size(); i++)
baseProblems[i]->fillBoundaryConditions(); baseProblems[i]->fillBoundaryConditions();
fillCouplingBoundaryConditions(); fillCouplingBoundaryConditions();
for (size_t i = 0; i < baseProblems.size(); i++)
baseProblems[i]->initData();
finalizeData();
} }
...@@ -103,12 +108,16 @@ public: ...@@ -103,12 +108,16 @@ public:
("Indices out of range!\n"); ("Indices out of range!\n");
return baseProblems[i]->getFeSpace(j); return baseProblems[i]->getFeSpace(j);
} }
std::string getName() { return name; }
protected: protected:
std::vector<BaseProblemType*> baseProblems; std::vector<BaseProblemType*> baseProblems;
unsigned dim; // dimension of the meshes unsigned dim; // dimension of the meshes
unsigned dow; // dimension of the world unsigned dow; // dimension of the world
std::string name;
}; };
......
...@@ -57,6 +57,9 @@ namespace detail { ...@@ -57,6 +57,9 @@ namespace detail {
/// Functor for generic loops. Method initData() is called for each element in a sequence. /// Functor for generic loops. Method initData() is called for each element in a sequence.
struct InitData { template<typename B> static void call(B& b) { b.initData(); } }; struct InitData { template<typename B> static void call(B& b) { b.initData(); } };
/// Functor for generic loops. Method initData() is called for each element in a sequence.
struct FinalizeData { template<typename B> static void call(B& b) { b.finalizeData(); } };
/// Functor for generic loops. Method fillOperators() is called for each element in a sequence. /// Functor for generic loops. Method fillOperators() is called for each element in a sequence.
struct FillOperators { template<typename B> static void call(B& b) { b.fillOperators(); } }; struct FillOperators { template<typename B> static void call(B& b) { b.fillOperators(); } };
...@@ -126,7 +129,8 @@ public: ...@@ -126,7 +129,8 @@ public:
dim = CProblemStat::getMesh(0)->getDim(); dim = CProblemStat::getMesh(0)->getDim();
} }
virtual void initData() {} virtual void initData() {}
virtual void finalizeData() {}
virtual void initTimeInterface() virtual void initTimeInterface()
{ {
...@@ -138,6 +142,9 @@ public: ...@@ -138,6 +142,9 @@ public:
tools::FOR_EACH< detail::FillBoundaryConditions >::loop(baseProblems); tools::FOR_EACH< detail::FillBoundaryConditions >::loop(baseProblems);
fillCouplingBoundaryConditions(); fillCouplingBoundaryConditions();
tools::FOR_EACH< detail::FinalizeData >::loop(baseProblems);
finalizeData();
} }
......
...@@ -50,6 +50,12 @@ namespace detail { ...@@ -50,6 +50,12 @@ namespace detail {
static void call(BaseProblemType& baseProblem) { baseProblem.initData(); } static void call(BaseProblemType& baseProblem) { baseProblem.initData(); }
}; };
/// Functor for generic loops. Method initData() is called for each element in a sequence.
struct FinalizeData {
template<typename BaseProblemType>
static void call(BaseProblemType& baseProblem) { baseProblem.finalizeData(); }
};
/// Functor for generic loops. Method fillOperators() is called for each element in a sequence. /// Functor for generic loops. Method fillOperators() is called for each element in a sequence.
struct FillOperators { struct FillOperators {
template<typename BaseProblemType> template<typename BaseProblemType>
...@@ -114,7 +120,7 @@ public: ...@@ -114,7 +120,7 @@ public:
} }
virtual void initData() {} virtual void initData() {}
virtual void finalizeData() {}
/** /**
* At first the initData method is called for all baseProblems, then * At first the initData method is called for all baseProblems, then
...@@ -131,6 +137,9 @@ public: ...@@ -131,6 +137,9 @@ public:
tools::FOR_EACH< detail::FillBoundaryConditions >::loop(baseProblems); tools::FOR_EACH< detail::FillBoundaryConditions >::loop(baseProblems);
fillCouplingBoundaryConditions(); fillCouplingBoundaryConditions();
tools::FOR_EACH< detail::FinalizeData >::loop(baseProblems);
finalizeData();
} }
......
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