Commit 2c7791e6 authored by Ansgar Burchardt's avatar Ansgar Burchardt

TensorGridFactory: return `unique_ptr` instead of `shared_ptr`

StructuredGridFactory switched from returning a `shared_ptr` to
returing a `unique_ptr` in f96b091d.
This commit implements the same change for TensorGridFactory.
parent e50f64ae
Pipeline #5647 passed with stage
in 57 minutes and 25 seconds
...@@ -43,7 +43,7 @@ namespace Dune ...@@ -43,7 +43,7 @@ namespace Dune
typedef typename Grid::ctype ctype; typedef typename Grid::ctype ctype;
static const int dim = Grid::dimension; static const int dim = Grid::dimension;
std::shared_ptr<Grid> createGrid(Comm comm = Comm()) std::unique_ptr<Grid> createGrid(Comm comm = Comm())
{ {
TensorGridFactoryCreator<Grid> creator(*this); TensorGridFactoryCreator<Grid> creator(*this);
return creator.createGrid(comm); return creator.createGrid(comm);
...@@ -309,7 +309,7 @@ namespace Dune ...@@ -309,7 +309,7 @@ namespace Dune
TensorGridFactoryCreator(const TensorGridFactory<Grid>& factory) : _factory(factory) {} TensorGridFactoryCreator(const TensorGridFactory<Grid>& factory) : _factory(factory) {}
std::shared_ptr<Grid> createGrid(Comm comm) std::unique_ptr<Grid> createGrid(Comm comm)
{ {
// The grid factory // The grid factory
GridFactory<Grid> fac; GridFactory<Grid> fac;
...@@ -375,7 +375,7 @@ namespace Dune ...@@ -375,7 +375,7 @@ namespace Dune
} }
} }
return std::shared_ptr<Grid>(fac.createGrid()); return std::unique_ptr<Grid>(fac.createGrid());
} }
private: private:
...@@ -391,9 +391,9 @@ namespace Dune ...@@ -391,9 +391,9 @@ namespace Dune
TensorGridFactoryCreator(const TensorGridFactory<Grid>& factory) : _factory(factory) {} TensorGridFactoryCreator(const TensorGridFactory<Grid>& factory) : _factory(factory) {}
std::shared_ptr<Grid> createGrid(Comm comm) std::unique_ptr<Grid> createGrid(Comm comm)
{ {
return std::make_shared<Grid>(_factory.coords(), std::bitset<dim>(0ULL), 1, comm); return std::make_unique<Grid>(_factory.coords(), std::bitset<dim>(0ULL), 1, comm);
} }
private: private:
const TensorGridFactory<Grid>& _factory; const TensorGridFactory<Grid>& _factory;
......
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