From efb2ca41b817c53c30b8033311dae5e796432601 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Sun, 12 May 2019 09:43:36 +0200 Subject: [PATCH] corrected visibility bug in lambda --- .../gridfunctions/DiscreteFunction.inc.hpp | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/amdis/gridfunctions/DiscreteFunction.inc.hpp b/src/amdis/gridfunctions/DiscreteFunction.inc.hpp index 7ae9396d..3a852c02 100644 --- a/src/amdis/gridfunctions/DiscreteFunction.inc.hpp +++ b/src/amdis/gridfunctions/DiscreteFunction.inc.hpp @@ -220,6 +220,10 @@ public: using Domain = typename Super::Domain; using Super::DerivativeLocalFunctionBase; + using Super::globalFunction_; + using Super::geometry_; + using Super::subTree_; + using Super::localView_; /// Evaluate Gradient at bound element in local coordinates Range operator()(Domain const& x) const @@ -227,18 +231,18 @@ public: assert( Super::bound_ ); Range dy(0); - auto&& coefficients = *Super::globalFunction_.dofVector_; - auto&& nodeToRangeEntry = Super::globalFunction_.nodeToRangeEntry_; - for_each_leaf_node(*Super::subTree_, [&,this](auto const& node, auto const& tp) + auto&& coefficients = *globalFunction_.dofVector_; + auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_; + for_each_leaf_node(*subTree_, [&,this](auto const& node, auto const& tp) { - auto localBasis = makeLocalToGlobalBasisAdapter(node, Super::geometry_.value()); + auto localBasis = makeLocalToGlobalBasisAdapter(node, geometry_.value()); auto const& gradients = localBasis.gradientsAt(x); // Get range entry associated to this node auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy)); for (std::size_t i = 0; i < localBasis.size(); ++i) { - auto&& multiIndex = Super::localView_.index(node.localIndex(i)); + auto&& multiIndex = localView_.index(node.localIndex(i)); // Get coefficient associated to i-th shape function auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]); @@ -273,6 +277,10 @@ public: using Domain = typename Super::Domain; using Super::DerivativeLocalFunctionBase; + using Super::globalFunction_; + using Super::geometry_; + using Super::subTree_; + using Super::localView_; /// Evaluate divergence at bound element in local coordinates Range operator()(Domain const& x) const @@ -294,10 +302,10 @@ private: assert( Super::bound_ ); Range dy(0); - auto&& coefficients = *Super::globalFunction_.dofVector_; - auto&& node = *Super::subTree_; + auto&& coefficients = *globalFunction_.dofVector_; + auto&& node = *subTree_; - auto localBasis = makeLocalToGlobalBasisAdapter(node.child(0), Super::geometry_.value()); + auto localBasis = makeLocalToGlobalBasisAdapter(node.child(0), geometry_.value()); auto const& gradients = localBasis.gradientsAt(x); auto re = Dune::Functions::flatVectorView(dy); @@ -307,7 +315,7 @@ private: assert(int(grad.size()) == GridView::dimensionworld); for (std::size_t j = 0; j < GridView::dimensionworld; ++j) { - auto&& multiIndex = Super::localView_.index(node.child(j).localIndex(i)); + auto&& multiIndex = localView_.index(node.child(j).localIndex(i)); re[0] += coefficients[multiIndex] * grad[j]; } } @@ -328,6 +336,10 @@ public: using Domain = typename Super::Domain; using Super::DerivativeLocalFunctionBase; + using Super::globalFunction_; + using Super::geometry_; + using Super::subTree_; + using Super::localView_; /// Evaluate partial derivative at bound element in local coordinates Range operator()(Domain const& x) const @@ -335,18 +347,20 @@ public: assert( Super::bound_ ); Range dy(0); - auto&& coefficients = *Super::globalFunction_.dofVector_; - auto&& nodeToRangeEntry = Super::globalFunction_.nodeToRangeEntry_; - for_each_leaf_node(*Super::subTree_, [&,this](auto const& node, auto const& tp) + std::size_t comp = Super::type_.comp; + + auto&& coefficients = *globalFunction_.dofVector_; + auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_; + for_each_leaf_node(*subTree_, [&,this](auto const& node, auto const& tp) { - auto localBasis = makeLocalToGlobalBasisAdapter(node, Super::geometry_.value()); - auto const& partial = localBasis.partialsAt(x, Super::type_.comp); + auto localBasis = makeLocalToGlobalBasisAdapter(node, geometry_.value()); + auto const& partial = localBasis.partialsAt(x, comp); // Get range entry associated to this node auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy)); for (std::size_t i = 0; i < localBasis.size(); ++i) { - auto&& multiIndex = Super::localView_.index(node.localIndex(i)); + auto&& multiIndex = localView_.index(node.localIndex(i)); // Get coefficient associated to i-th shape function auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]); -- GitLab