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

Merge branch 'issue/factory_parametrization' into 'master'

Make FactoryParametrization compatible to dune 2.7

See merge request !40
parents 2c7ee1ed ea26a4b9
No related branches found
No related tags found
1 merge request!40Make FactoryParametrization compatible to dune 2.7
...@@ -28,7 +28,6 @@ namespace AMDiS ...@@ -28,7 +28,6 @@ namespace AMDiS
namespace Dune namespace Dune
{ {
/// \brief A factory class for \ref SimpleGrid. /// \brief A factory class for \ref SimpleGrid.
template <class Grid, class Projection> template <class Grid, class Projection>
class GridFactory<AMDiS::Parametrization<Grid, Projection>> class GridFactory<AMDiS::Parametrization<Grid, Projection>>
...@@ -50,8 +49,7 @@ namespace Dune ...@@ -50,8 +49,7 @@ namespace Dune
public: public:
/// Default constructor /// Default constructor
GridFactory() GridFactory() = default;
{}
/// Insert a vertex into the coarse grid /// Insert a vertex into the coarse grid
virtual void insertVertex(GlobalCoordinate const& pos) override virtual void insertVertex(GlobalCoordinate const& pos) override
...@@ -73,7 +71,7 @@ namespace Dune ...@@ -73,7 +71,7 @@ namespace Dune
for (std::size_t i = 0; i < vertices.size(); ++i) for (std::size_t i = 0; i < vertices.size(); ++i)
corners[i] = coordinates[vertices[i]]; corners[i] = coordinates[vertices[i]];
factory.insertElement(type, vertices, std::shared_ptr<ProjectionBase>(new Projection(std::move(corners))) ); factory.insertElement(type, vertices, std::make_shared<Projection>(std::move(corners)) );
} }
virtual void insertBoundarySegment(std::vector<unsigned int> const& /*vertices*/) override virtual void insertBoundarySegment(std::vector<unsigned int> const& /*vertices*/) override
...@@ -82,22 +80,24 @@ namespace Dune ...@@ -82,22 +80,24 @@ namespace Dune
} }
/// Finalize grid creation and hand over the grid. /// Finalize grid creation and hand over the grid.
Grid* create() std::unique_ptr<Grid> create()
{ {
return factory.createGrid(); return std::unique_ptr<Grid>(factory.createGrid());
} }
#if DUNE_VERSION_GT(DUNE_GRID,2,6)
virtual ToUniquePtr<GridWrapper> createGrid() override
#else
virtual GridWrapper* createGrid() override virtual GridWrapper* createGrid() override
#endif
{ {
AMDiS::warning("Should not be created. Use non-virtual method `create()` instead, to create the underlying grid!"); AMDiS::warning("Should not be created. Use non-virtual method `create()` instead, to create the underlying grid!");
return nullptr; return nullptr;
} }
private: private:
// buffers for the mesh data // buffers for the mesh data
std::vector<GlobalCoordinate> coordinates; std::vector<GlobalCoordinate> coordinates;
GridFactory<Grid> factory; GridFactory<Grid> factory;
}; };
......
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