Commit b842f5d8 authored by Praetorius, Simon's avatar Praetorius, Simon

localfunction of discsretefunction could not be stored without the discretefunction object

parent e034a097
Pipeline #1421 passed with stage
in 27 minutes and 37 seconds
......@@ -23,9 +23,9 @@ private:
public:
LocalFunction(DiscreteFunction const& globalFunction)
: globalFunction_(&globalFunction)
, localView_(globalFunction_->basis().localView())
, subTree_(&child(localView_.tree(), globalFunction_->treePath()))
: globalFunction_(globalFunction)
, localView_(globalFunction_.basis().localView())
, subTree_(&child(localView_.tree(), globalFunction_.treePath()))
{}
/// \brief Bind the LocalView to the element
......@@ -48,7 +48,7 @@ public:
/// \brief Create a LocalFunction representing the gradient. \relates GradientLocalFunction
friend GradientLocalFunction derivative(LocalFunction const& localFunction)
{
return GradientLocalFunction{*localFunction.globalFunction_};
return GradientLocalFunction{localFunction.globalFunction_};
}
/// \brief The \ref polynomialDegree() of the LocalFunctions
......@@ -66,7 +66,7 @@ public:
}
private:
DiscreteFunction const* globalFunction_;
DiscreteFunction globalFunction_;
LocalView localView_;
SubTree const* subTree_;
bool bound_ = false;
......@@ -94,9 +94,9 @@ private:
public:
GradientLocalFunction(DiscreteFunction const& globalFunction)
: globalFunction_(&globalFunction)
, localView_(globalFunction_->basis().localView())
, subTree_(&child(localView_.tree(), globalFunction_->treePath()))
: globalFunction_(globalFunction)
, localView_(globalFunction_.basis().localView())
, subTree_(&child(localView_.tree(), globalFunction_.treePath()))
{}
void bind(Element const& element)
......@@ -130,7 +130,7 @@ public:
}
private:
DiscreteFunction const* globalFunction_;
DiscreteFunction globalFunction_;
LocalView localView_;
SubTree const* subTree_;
Dune::Std::optional<Geometry> geometry_;
......@@ -145,8 +145,8 @@ LocalFunction::operator()(Domain const& x) const
assert( bound_ );
auto y = Range(0);
auto&& coefficients = *globalFunction_->dofVector_;
auto&& nodeToRangeEntry = globalFunction_->nodeToRangeEntry_;
auto&& coefficients = *globalFunction_.dofVector_;
auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_;
forEachLeafNode_(*subTree_, [&,this](auto const& node, auto const& tp)
{
auto&& fe = node.finiteElement();
......@@ -191,8 +191,8 @@ GradientLocalFunction::operator()(Domain const& x) const
for (std::size_t j = 0; j < dy.size(); ++j)
dy[j] = 0;
auto&& coefficients = *globalFunction_->dofVector_;
auto&& nodeToRangeEntry = globalFunction_->nodeToRangeEntry_;
auto&& coefficients = *globalFunction_.dofVector_;
auto&& nodeToRangeEntry = globalFunction_.nodeToRangeEntry_;
forEachLeafNode_(*subTree_, [&,this](auto const& node, auto const& tp)
{
// TODO: may DOFVectorView::Range to FieldVector type if necessary
......
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