Commit 84fb5d3c authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

several bugs in current branch resolved

parent b23d88cd
......@@ -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];
......
......@@ -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 {};
}
};
......
......@@ -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);
......
......@@ -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) + "]";
......
......@@ -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{});
});
......
......@@ -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
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