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

corrected visibility bug in lambda

parent 1ba68264
No related branches found
No related tags found
1 merge request!58Add generalized derivative and local-to-global adapter to handle the global derivatives uniformly
...@@ -220,6 +220,10 @@ public: ...@@ -220,6 +220,10 @@ public:
using Domain = typename Super::Domain; using Domain = typename Super::Domain;
using Super::DerivativeLocalFunctionBase; using Super::DerivativeLocalFunctionBase;
using Super::globalFunction_;
using Super::geometry_;
using Super::subTree_;
using Super::localView_;
/// Evaluate Gradient at bound element in local coordinates /// Evaluate Gradient at bound element in local coordinates
Range operator()(Domain const& x) const Range operator()(Domain const& x) const
...@@ -227,18 +231,18 @@ public: ...@@ -227,18 +231,18 @@ public:
assert( Super::bound_ ); assert( Super::bound_ );
Range dy(0); Range dy(0);
auto&& coefficients = *Super::globalFunction_.dofVector_; auto&& coefficients = *globalFunction_.dofVector_;
auto&& nodeToRangeEntry = Super::globalFunction_.nodeToRangeEntry_; auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_;
for_each_leaf_node(*Super::subTree_, [&,this](auto const& node, auto const& tp) 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); auto const& gradients = localBasis.gradientsAt(x);
// Get range entry associated to this node // Get range entry associated to this node
auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy)); auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy));
for (std::size_t i = 0; i < localBasis.size(); ++i) { 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 // Get coefficient associated to i-th shape function
auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]); auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]);
...@@ -273,6 +277,10 @@ public: ...@@ -273,6 +277,10 @@ public:
using Domain = typename Super::Domain; using Domain = typename Super::Domain;
using Super::DerivativeLocalFunctionBase; using Super::DerivativeLocalFunctionBase;
using Super::globalFunction_;
using Super::geometry_;
using Super::subTree_;
using Super::localView_;
/// Evaluate divergence at bound element in local coordinates /// Evaluate divergence at bound element in local coordinates
Range operator()(Domain const& x) const Range operator()(Domain const& x) const
...@@ -294,10 +302,10 @@ private: ...@@ -294,10 +302,10 @@ private:
assert( Super::bound_ ); assert( Super::bound_ );
Range dy(0); Range dy(0);
auto&& coefficients = *Super::globalFunction_.dofVector_; auto&& coefficients = *globalFunction_.dofVector_;
auto&& node = *Super::subTree_; 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 const& gradients = localBasis.gradientsAt(x);
auto re = Dune::Functions::flatVectorView(dy); auto re = Dune::Functions::flatVectorView(dy);
...@@ -307,7 +315,7 @@ private: ...@@ -307,7 +315,7 @@ private:
assert(int(grad.size()) == GridView::dimensionworld); assert(int(grad.size()) == GridView::dimensionworld);
for (std::size_t j = 0; j < GridView::dimensionworld; ++j) { 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]; re[0] += coefficients[multiIndex] * grad[j];
} }
} }
...@@ -328,6 +336,10 @@ public: ...@@ -328,6 +336,10 @@ public:
using Domain = typename Super::Domain; using Domain = typename Super::Domain;
using Super::DerivativeLocalFunctionBase; using Super::DerivativeLocalFunctionBase;
using Super::globalFunction_;
using Super::geometry_;
using Super::subTree_;
using Super::localView_;
/// Evaluate partial derivative at bound element in local coordinates /// Evaluate partial derivative at bound element in local coordinates
Range operator()(Domain const& x) const Range operator()(Domain const& x) const
...@@ -335,18 +347,20 @@ public: ...@@ -335,18 +347,20 @@ public:
assert( Super::bound_ ); assert( Super::bound_ );
Range dy(0); Range dy(0);
auto&& coefficients = *Super::globalFunction_.dofVector_; std::size_t comp = Super::type_.comp;
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& partial = localBasis.partialsAt(x, Super::type_.comp); auto const& partial = localBasis.partialsAt(x, comp);
// Get range entry associated to this node // Get range entry associated to this node
auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy)); auto re = Dune::Functions::flatVectorView(nodeToRangeEntry(node, tp, dy));
for (std::size_t i = 0; i < localBasis.size(); ++i) { 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 // Get coefficient associated to i-th shape function
auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]); auto c = Dune::Functions::flatVectorView(coefficients[multiIndex]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment