diff --git a/src/amdis/Assembler.inc.hpp b/src/amdis/Assembler.inc.hpp index f71a98280fd148feeaac5b8d921ab05130210866..1cf4a4eaf39f721d145601816fee68c248095c87 100644 --- a/src/amdis/Assembler.inc.hpp +++ b/src/amdis/Assembler.inc.hpp @@ -38,7 +38,7 @@ void Assembler<Traits>::assemble( auto geometry = element.geometry(); // 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 rowLocalView = rowBasis.localView(); @@ -56,7 +56,7 @@ void Assembler<Traits>::assemble( 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]; if (matOp.assemble(asmMatrix) && !matOp.empty()) { @@ -98,9 +98,9 @@ void Assembler<Traits>::assemble( } // unbind all operators - forEachNode(localView.tree(), [&,this](auto const& rowNode, auto&&) { + AMDiS::forEachNode_(localView.tree(), [&,this](auto const& rowNode, auto&&) { rhsOperators_[rowNode].unbind(); - forEachNode(localView.tree(), [&,this](auto const& colNode, auto&&) { + AMDiS::forEachNode_(localView.tree(), [&,this](auto const& colNode, auto&&) { matrixOperators_[rowNode][colNode].unbind(); }); }); @@ -155,7 +155,7 @@ void Assembler<Traits>::initMatrixVector( rhs = 0; 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 if (rowNode.isLeaf) @@ -164,7 +164,7 @@ void Assembler<Traits>::initMatrixVector( 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); @@ -187,14 +187,14 @@ std::size_t Assembler<Traits>::finishMatrixVector( matrix.finish(); 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& rhsOp = rhsOperators_[rowNode]; if (rhsOp.assemble(asmVector)) 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& matOp = matrixOperators_[rowNode][colNode]; diff --git a/src/amdis/Mesh.hpp b/src/amdis/Mesh.hpp index 99909ed799762ef82099948919b88d314b269600..f45190373c1b454f7d08adc2c64b461e153423a5 100644 --- a/src/amdis/Mesh.hpp +++ b/src/amdis/Mesh.hpp @@ -68,11 +68,12 @@ namespace AMDiS /// A creator class for meshes. Each mesh needs different way of initialization template <class Grid> - class MeshCreator + struct MeshCreator { static std::unique_ptr<Grid> create(std::string meshName) { error_exit("Creator not yet implemented for this mesh type."); + return {}; } }; diff --git a/src/amdis/ProblemStat.hpp b/src/amdis/ProblemStat.hpp index 27b711246367e68043b9811ea576ebb6b1c48de6..cf34880f4b0543cc2181929221f43d54ef3bc284 100644 --- a/src/amdis/ProblemStat.hpp +++ b/src/amdis/ProblemStat.hpp @@ -80,7 +80,7 @@ namespace AMDiS ProblemStat(std::string name, Grid& grid) : ProblemStat(name) { - gridName = ""; + this->grid = Dune::stackobject_to_shared_ptr(grid); Parameters::get(name + "->mesh", gridName); } @@ -277,7 +277,12 @@ namespace AMDiS void createGlobalBasis() { 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); rhsOperators.init(*globalTree); constraints.init(*globalTree); diff --git a/src/amdis/ProblemStat.inc.hpp b/src/amdis/ProblemStat.inc.hpp index e2b871eb1850378178beef562e7cbf6dfca533c9..f96cf0db46afbf99af919b5ec66c2cf98a6bdc86 100644 --- a/src/amdis/ProblemStat.inc.hpp +++ b/src/amdis/ProblemStat.inc.hpp @@ -113,7 +113,7 @@ template <class Traits> void ProblemStat<Traits>::createFileWriter() { 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) + "]"; diff --git a/src/amdis/utility/TreeData.hpp b/src/amdis/utility/TreeData.hpp index b181a9e7ec7d37835d28ee60a2f03c62dad1cec3..183f53396d50af6fc25faf5a0efc263ee11eb465 100644 --- a/src/amdis/utility/TreeData.hpp +++ b/src/amdis/utility/TreeData.hpp @@ -207,10 +207,10 @@ namespace AMDiS } 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> - void applyImpl(Func&& func, std::false_type) { forEachNode(*tree_, func); } + void applyImpl(Func&& func, std::false_type) { AMDiS::forEachNode_(*tree_, func); } protected: const Tree* tree_ = nullptr; @@ -251,7 +251,7 @@ namespace AMDiS void init(Tree const& 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{}); }); diff --git a/src/amdis/utility/Visitor.hpp b/src/amdis/utility/Visitor.hpp index 9b991dad607a3405223b3b4071b8f9e358d0baca..0df1a74a9dfef2357aa4a2767f321aded82cd4b0 100644 --- a/src/amdis/utility/Visitor.hpp +++ b/src/amdis/utility/Visitor.hpp @@ -65,7 +65,7 @@ namespace AMDiS * \param postFunc This function is called for each inner node after visiting its children */ 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)); } @@ -81,10 +81,10 @@ namespace AMDiS * \param leafFunc This function is called for each leaf node */ 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) {}; - forEachNode(tree, innerFunc, leafFunc, nop); + forEachNode_(tree, innerFunc, leafFunc, nop); } /** @@ -97,9 +97,9 @@ namespace AMDiS * \param nodeFunc This function is called for each node */ 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 * \param leafFunc This function is called for each leaf node */ template <class Tree, class LeafFunc> - void forEachLeafNode(Tree&& tree, LeafFunc&& leafFunc) + void forEachLeafNode_(Tree&& tree, LeafFunc&& leafFunc) { auto nop = [](auto&&... args) {}; - forEachNode(tree, nop, leafFunc, nop); + forEachNode_(tree, nop, leafFunc, nop); } } // end namespace AMDiS