Commit 760b05b8 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/store_localfunction' into 'develop'

localfunction of discsretefunction could not be stored without the discretefunction object

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