diff --git a/examples/FactoryParametrization.hpp b/examples/FactoryParametrization.hpp index 41290b3a98c88ae4d74169b74351696b496303f6..61f81680d0701fa99601cf5164c080ff1b8d5a3c 100644 --- a/examples/FactoryParametrization.hpp +++ b/examples/FactoryParametrization.hpp @@ -28,7 +28,6 @@ namespace AMDiS namespace Dune { - /// \brief A factory class for \ref SimpleGrid. template <class Grid, class Projection> class GridFactory<AMDiS::Parametrization<Grid, Projection>> @@ -50,8 +49,7 @@ namespace Dune public: /// Default constructor - GridFactory() - {} + GridFactory() = default; /// Insert a vertex into the coarse grid virtual void insertVertex(GlobalCoordinate const& pos) override @@ -73,7 +71,7 @@ namespace Dune for (std::size_t i = 0; i < vertices.size(); ++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 @@ -82,22 +80,24 @@ namespace Dune } /// 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 +#endif { AMDiS::warning("Should not be created. Use non-virtual method `create()` instead, to create the underlying grid!"); return nullptr; } private: - // buffers for the mesh data std::vector<GlobalCoordinate> coordinates; - GridFactory<Grid> factory; };