Skip to content
Snippets Groups Projects
Commit 9614867c authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

several bugs in current branch resolved

parent 5b43eb35
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,7 @@ void Assembler<Traits>::assemble( ...@@ -38,7 +38,7 @@ void Assembler<Traits>::assemble(
auto geometry = element.geometry(); auto geometry = element.geometry();
// traverse type-tree of global-basis // traverse type-tree of global-basis
forEachNode(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath)
{ {
auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath); auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath);
auto rowLocalView = rowBasis.localView(); auto rowLocalView = rowBasis.localView();
...@@ -56,7 +56,7 @@ void Assembler<Traits>::assemble( ...@@ -56,7 +56,7 @@ void Assembler<Traits>::assemble(
this->assembleElementOperators(element, rhsOp, vecAssembler); this->assembleElementOperators(element, rhsOp, vecAssembler);
} }
forEachNode(localView.tree(), [&,this](auto const& colNode, auto colTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& colNode, auto colTreePath)
{ {
auto& matOp = matrixOperators_[rowNode][colNode]; auto& matOp = matrixOperators_[rowNode][colNode];
if (matOp.assemble(asmMatrix) && !matOp.empty()) { if (matOp.assemble(asmMatrix) && !matOp.empty()) {
...@@ -98,9 +98,9 @@ void Assembler<Traits>::assemble( ...@@ -98,9 +98,9 @@ void Assembler<Traits>::assemble(
} }
// unbind all operators // unbind all operators
forEachNode(localView.tree(), [&,this](auto const& rowNode, auto&&) { AMDiS::forEachNode_(localView.tree(), [&,this](auto const& rowNode, auto&&) {
rhsOperators_[rowNode].unbind(); rhsOperators_[rowNode].unbind();
forEachNode(localView.tree(), [&,this](auto const& colNode, auto&&) { AMDiS::forEachNode_(localView.tree(), [&,this](auto const& colNode, auto&&) {
matrixOperators_[rowNode][colNode].unbind(); matrixOperators_[rowNode][colNode].unbind();
}); });
}); });
...@@ -155,7 +155,7 @@ void Assembler<Traits>::initMatrixVector( ...@@ -155,7 +155,7 @@ void Assembler<Traits>::initMatrixVector(
rhs = 0; rhs = 0;
auto localView = globalBasis_.localView(); auto localView = globalBasis_.localView();
forEachNode(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath)
{ {
#ifdef HAVE_EXTENDED_DUNE_FUNCTIONS #ifdef HAVE_EXTENDED_DUNE_FUNCTIONS
if (rowNode.isLeaf) if (rowNode.isLeaf)
...@@ -164,7 +164,7 @@ void Assembler<Traits>::initMatrixVector( ...@@ -164,7 +164,7 @@ void Assembler<Traits>::initMatrixVector(
auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath); auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath);
forEachNode(localView.tree(), [&,this](auto const& colNode, auto colTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& colNode, auto colTreePath)
{ {
auto colBasis = Dune::Functions::subspaceBasis(globalBasis_, colTreePath); auto colBasis = Dune::Functions::subspaceBasis(globalBasis_, colTreePath);
...@@ -187,14 +187,14 @@ std::size_t Assembler<Traits>::finishMatrixVector( ...@@ -187,14 +187,14 @@ std::size_t Assembler<Traits>::finishMatrixVector(
matrix.finish(); matrix.finish();
auto localView = globalBasis_.localView(); auto localView = globalBasis_.localView();
forEachNode(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& rowNode, auto rowTreePath)
{ {
auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath); auto rowBasis = Dune::Functions::subspaceBasis(globalBasis_, rowTreePath);
auto& rhsOp = rhsOperators_[rowNode]; auto& rhsOp = rhsOperators_[rowNode];
if (rhsOp.assemble(asmVector)) if (rhsOp.assemble(asmVector))
rhsOp.assembled = true; rhsOp.assembled = true;
forEachNode(localView.tree(), [&,this](auto const& colNode, auto colTreePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& colNode, auto colTreePath)
{ {
auto colBasis = Dune::Functions::subspaceBasis(globalBasis_, colTreePath); auto colBasis = Dune::Functions::subspaceBasis(globalBasis_, colTreePath);
auto& matOp = matrixOperators_[rowNode][colNode]; auto& matOp = matrixOperators_[rowNode][colNode];
......
...@@ -68,11 +68,12 @@ namespace AMDiS ...@@ -68,11 +68,12 @@ namespace AMDiS
/// A creator class for meshes. Each mesh needs different way of initialization /// A creator class for meshes. Each mesh needs different way of initialization
template <class Grid> template <class Grid>
class MeshCreator struct MeshCreator
{ {
static std::unique_ptr<Grid> create(std::string meshName) static std::unique_ptr<Grid> create(std::string meshName)
{ {
error_exit("Creator not yet implemented for this mesh type."); error_exit("Creator not yet implemented for this mesh type.");
return {};
} }
}; };
......
...@@ -80,7 +80,7 @@ namespace AMDiS ...@@ -80,7 +80,7 @@ namespace AMDiS
ProblemStat(std::string name, Grid& grid) ProblemStat(std::string name, Grid& grid)
: ProblemStat(name) : ProblemStat(name)
{ {
gridName = ""; this->grid = Dune::stackobject_to_shared_ptr(grid);
Parameters::get(name + "->mesh", gridName); Parameters::get(name + "->mesh", gridName);
} }
...@@ -277,7 +277,12 @@ namespace AMDiS ...@@ -277,7 +277,12 @@ namespace AMDiS
void createGlobalBasis() void createGlobalBasis()
{ {
globalBasis = std::make_shared<GlobalBasis>(makeGlobalBasis<GlobalBasis>(grid->leafGridView())); globalBasis = std::make_shared<GlobalBasis>(makeGlobalBasis<GlobalBasis>(grid->leafGridView()));
globalTree = std::make_shared<typename GlobalBasis::LocalView::Tree>(globalBasis->localView().tree()); initGlobalBasis(*globalBasis);
}
void initGlobalBasis(GlobalBasis const& globalBasis)
{
globalTree = std::make_shared<typename GlobalBasis::LocalView::Tree>(globalBasis.localView().tree());
matrixOperators.init(*globalTree); matrixOperators.init(*globalTree);
rhsOperators.init(*globalTree); rhsOperators.init(*globalTree);
constraints.init(*globalTree); constraints.init(*globalTree);
......
...@@ -113,7 +113,7 @@ template <class Traits> ...@@ -113,7 +113,7 @@ template <class Traits>
void ProblemStat<Traits>::createFileWriter() void ProblemStat<Traits>::createFileWriter()
{ {
auto localView = globalBasis->localView(); auto localView = globalBasis->localView();
forEachNode(localView.tree(), [&,this](auto const& node, auto treePath) AMDiS::forEachNode_(localView.tree(), [&,this](auto const& node, auto treePath)
{ {
std::string componentName = name + "->output[" + to_string(treePath) + "]"; std::string componentName = name + "->output[" + to_string(treePath) + "]";
......
...@@ -207,10 +207,10 @@ namespace AMDiS ...@@ -207,10 +207,10 @@ namespace AMDiS
} }
template <class Func> template <class Func>
void applyImpl(Func&& func, std::true_type) { forEachLeafNode(*tree_, func); } void applyImpl(Func&& func, std::true_type) { AMDiS::forEachLeafNode_(*tree_, func); }
template <class Func> template <class Func>
void applyImpl(Func&& func, std::false_type) { forEachNode(*tree_, func); } void applyImpl(Func&& func, std::false_type) { AMDiS::forEachNode_(*tree_, func); }
protected: protected:
const Tree* tree_ = nullptr; const Tree* tree_ = nullptr;
...@@ -251,7 +251,7 @@ namespace AMDiS ...@@ -251,7 +251,7 @@ namespace AMDiS
void init(Tree const& tree, tag::store) void init(Tree const& tree, tag::store)
{ {
Super::init(tree, tag::store{}); Super::init(tree, tag::store{});
forEachNode(tree, [&,this](auto const& node, auto&&) AMDiS::forEachNode_(tree, [&,this](auto const& node, auto&&)
{ {
(*this)[node].init(tree, tag::store{}); (*this)[node].init(tree, tag::store{});
}); });
......
...@@ -65,7 +65,7 @@ namespace AMDiS ...@@ -65,7 +65,7 @@ namespace AMDiS
* \param postFunc This function is called for each inner node after visiting its children * \param postFunc This function is called for each inner node after visiting its children
*/ */
template <class Tree, class PreFunc, class LeafFunc, class PostFunc> template <class Tree, class PreFunc, class LeafFunc, class PostFunc>
void forEachNode(Tree&& tree, PreFunc&& preFunc, LeafFunc&& leafFunc, PostFunc&& postFunc) void forEachNode_(Tree&& tree, PreFunc&& preFunc, LeafFunc&& leafFunc, PostFunc&& postFunc)
{ {
traverseTree(tree, Impl::callbackVisitor(preFunc, leafFunc, postFunc)); traverseTree(tree, Impl::callbackVisitor(preFunc, leafFunc, postFunc));
} }
...@@ -81,10 +81,10 @@ namespace AMDiS ...@@ -81,10 +81,10 @@ namespace AMDiS
* \param leafFunc This function is called for each leaf node * \param leafFunc This function is called for each leaf node
*/ */
template <class Tree, class InnerFunc, class LeafFunc> template <class Tree, class InnerFunc, class LeafFunc>
void forEachNode(Tree&& tree, InnerFunc&& innerFunc, LeafFunc&& leafFunc) void forEachNode_(Tree&& tree, InnerFunc&& innerFunc, LeafFunc&& leafFunc)
{ {
auto nop = [](auto&&... args) {}; auto nop = [](auto&&... args) {};
forEachNode(tree, innerFunc, leafFunc, nop); forEachNode_(tree, innerFunc, leafFunc, nop);
} }
/** /**
...@@ -97,9 +97,9 @@ namespace AMDiS ...@@ -97,9 +97,9 @@ namespace AMDiS
* \param nodeFunc This function is called for each node * \param nodeFunc This function is called for each node
*/ */
template <class Tree, class NodeFunc> template <class Tree, class NodeFunc>
void forEachNode(Tree&& tree, NodeFunc&& nodeFunc) void forEachNode_(Tree&& tree, NodeFunc&& nodeFunc)
{ {
forEachNode(tree, nodeFunc, nodeFunc); forEachNode_(tree, nodeFunc, nodeFunc);
} }
/** /**
...@@ -112,10 +112,10 @@ namespace AMDiS ...@@ -112,10 +112,10 @@ namespace AMDiS
* \param leafFunc This function is called for each leaf node * \param leafFunc This function is called for each leaf node
*/ */
template <class Tree, class LeafFunc> template <class Tree, class LeafFunc>
void forEachLeafNode(Tree&& tree, LeafFunc&& leafFunc) void forEachLeafNode_(Tree&& tree, LeafFunc&& leafFunc)
{ {
auto nop = [](auto&&... args) {}; auto nop = [](auto&&... args) {};
forEachNode(tree, nop, leafFunc, nop); forEachNode_(tree, nop, leafFunc, nop);
} }
} // end namespace AMDiS } // end namespace AMDiS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment