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

Make DiscreteGridViewFunction a reference type, storing container and basis as shared_ptr

parent afcb3282
No related branches found
No related tags found
1 merge request!9Make DiscreteGridViewFunction a reference type, storing container and basis as shared_ptr
Pipeline #5876 passed
......@@ -235,7 +235,8 @@ public:
/// \brief Constructor.
DiscreteGridViewFunction (const GridView& gridView, int order = (ORDER > 0 ? ORDER : 1))
: entitySet_(gridView)
, basis_(makeBasis(gridView, order))
, basis_(std::make_shared<Basis>(makeBasis(gridView, order)))
, coords_(std::make_shared<VectorType>())
{
update(gridView);
}
......@@ -243,9 +244,9 @@ public:
void update (const GridView& gridView)
{
entitySet_ = EntitySet{gridView};
basis_.update(gridView);
basis_->update(gridView);
coords_.resize(basis_.size());
coords_->resize(basis_->size());
}
/// \brief evaluate in global coordinates
......@@ -267,7 +268,7 @@ public:
/// \brief Create a local function of this grifunction
friend LocalFunction<0> localFunction (const DiscreteGridViewFunction& gf)
{
return LocalFunction<0>{gf.basis_.localView(), gf.coords_};
return LocalFunction<0>{gf.basis_->localView(), *gf.coords_};
}
/// \brief obtain the stored \ref GridViewEntitySet
......@@ -278,23 +279,23 @@ public:
const Basis& basis () const
{
return basis_;
return *basis_;
}
const VectorType& coefficients () const
{
return coords_;
return *coords_;
}
VectorType& coefficients ()
{
return coords_;
return *coords_;
}
private:
EntitySet entitySet_;
Basis basis_;
VectorType coords_;
std::shared_ptr<Basis> basis_;
std::shared_ptr<VectorType> coords_;
};
} // end namespace Dune
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment