Commit ab268c22 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

bugs due to missing problemStat.getNumComponents() corrected

parent ae5eafb9
...@@ -38,7 +38,7 @@ int main(int argc, char** argv) ...@@ -38,7 +38,7 @@ int main(int argc, char** argv)
Parameters::get("stokes->density", density); Parameters::get("stokes->density", density);
Parameters::get("stokes->boundary velocity", vel); Parameters::get("stokes->boundary velocity", vel);
AdaptInfo adaptInfo("adapt", prob.getNumComponents()); AdaptInfo adaptInfo("adapt");
// tree-paths for components // tree-paths for components
auto _v = 0_c; auto _v = 0_c;
......
...@@ -71,7 +71,7 @@ int main(int argc, char** argv) ...@@ -71,7 +71,7 @@ int main(int argc, char** argv)
prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0); prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0);
AdaptInfo adaptInfo("adapt", prob.getNumComponents()); AdaptInfo adaptInfo("adapt");
// assemble and solve system // assemble and solve system
prob.buildAfterCoarsen(adaptInfo, Flag(0)); prob.buildAfterCoarsen(adaptInfo, Flag(0));
......
...@@ -72,7 +72,7 @@ int main(int argc, char** argv) ...@@ -72,7 +72,7 @@ int main(int argc, char** argv)
prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0); prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0);
AdaptInfo adaptInfo("adapt", prob.getNumComponents()); AdaptInfo adaptInfo("adapt");
// assemble and solve system // assemble and solve system
prob.buildAfterCoarsen(adaptInfo, Flag(0)); prob.buildAfterCoarsen(adaptInfo, Flag(0));
......
...@@ -55,7 +55,7 @@ int main(int argc, char** argv) ...@@ -55,7 +55,7 @@ int main(int argc, char** argv)
// set point constraint for pressure // set point constraint for pressure
prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0); prob.addDirichletBC([](auto const& x) { return x[0] < 1.e-8 && x[1] < 1.e-8; }, _p, _p, 0.0);
AdaptInfo adaptInfo("adapt", prob.getNumComponents()); AdaptInfo adaptInfo("adapt");
// assemble and solve system // assemble and solve system
prob.buildAfterCoarsen(adaptInfo, Flag(0)); prob.buildAfterCoarsen(adaptInfo, Flag(0));
......
...@@ -58,15 +58,26 @@ namespace AMDiS ...@@ -58,15 +58,26 @@ namespace AMDiS
} }
/// Returns \ref oldSolution. /// Returns \ref oldSolution.
decltype(auto) getOldSolution() { return *oldSolution; } std::unique_ptr<SystemVector> getOldSolutionVector() const
decltype(auto) getOldSolution() const { return *oldSolution; } {
return *oldSolution;
}
/// Return a mutable view to a oldSolution component
template <class TreePath = RootTreePath>
auto getOldSolution(TreePath const& path = {})
{
auto&& tp = makeTreePath(path);
return makeDOFVectorView(*oldSolution, tp);
}
/// Returns the I'th component of \ref oldSolution. /// Return a const view to a oldSolution component
// template <std::size_t I = 0> template <class TreePath = RootTreePath>
// decltype(auto) getOldSolution(const index_t<I> _i = {}) auto getOldSolution(TreePath const& path = {}) const
// { {
// return (*oldSolution)[_i]; auto&& tp = makeTreePath(path);
// } return makeDOFVectorView(*oldSolution, tp);
}
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution(). /// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
virtual void transferInitialSolution(AdaptInfo& adaptInfo) override; virtual void transferInitialSolution(AdaptInfo& adaptInfo) override;
...@@ -80,7 +91,6 @@ namespace AMDiS ...@@ -80,7 +91,6 @@ namespace AMDiS
}; };
#if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION #if DUNE_HAVE_CXX_CLASS_TEMPLATE_ARGUMENT_DEDUCTION
// Deduction rule // Deduction rule
template <class Traits> template <class Traits>
...@@ -90,8 +100,7 @@ namespace AMDiS ...@@ -90,8 +100,7 @@ namespace AMDiS
// Generator for ProblemInstat with given ProblemStat // Generator for ProblemInstat with given ProblemStat
template <class Traits> template <class Traits>
ProblemInstat<Traits> ProblemInstat<Traits> makeProblemInstat(std::string name, ProblemStat<Traits>& prob)
makeProblemInstat(std::string name, ProblemStat<Traits>& prob)
{ {
return {std::move(name), prob}; return {std::move(name), prob};
} }
......
...@@ -42,16 +42,10 @@ void ProblemInstat<Traits>::createUhOld() ...@@ -42,16 +42,10 @@ void ProblemInstat<Traits>::createUhOld()
{ {
AMDIS_FUNCNAME("ProblemInstat::createUhOld()"); AMDIS_FUNCNAME("ProblemInstat::createUhOld()");
if (oldSolution) { if (oldSolution)
warning("oldSolution already created\n"); warning("oldSolution already created\n");
} else // create oldSolution
else {
const int size = problemStat.getNumComponents();
// create oldSolution
std::vector<std::string> componentNames(size, name + "_uOld");
oldSolution.reset(new SystemVector(*problemStat.getGlobalBasis(), name + "_uOld")); oldSolution.reset(new SystemVector(*problemStat.getGlobalBasis(), name + "_uOld"));
}
} }
......
Supports Markdown
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