diff --git a/dune/gmsh4/gmsh4reader.hh b/dune/gmsh4/gmsh4reader.hh index 0e263958ac22e7c8bb2e776bae67df31f3d5ca40..7ff1bb4fbbcd543cb2516d2ec8d3fcadb97ad9a5 100644 --- a/dune/gmsh4/gmsh4reader.hh +++ b/dune/gmsh4/gmsh4reader.hh @@ -43,11 +43,13 @@ namespace Dune using size_type = SizeType; /// Constructor. Creates a new GridCreator with the passed factory - explicit Gmsh4Reader (GridFactory& factory) - : creator_(std::make_shared(factory)) + template ::value,int> = 0> + explicit Gmsh4Reader (Args&&... args) + : creator_(std::make_shared(std::forward(args)...)) {} - /// Constructor. Stores a references to the passed creator + /// Constructor. Stores the references in a non-destroying shared_ptr explicit Gmsh4Reader (GridCreator& creator) : creator_(stackobject_to_shared_ptr(creator)) {} @@ -65,13 +67,6 @@ namespace Dune **/ void read (std::string const& filename, bool fillCreator = true); - /// Implementation of \ref FileReader interface - static void fillFactoryImpl (GridFactory& factory, std::string const& filename) - { - Gmsh4Reader reader{factory}; - reader.read(filename); - } - /// Advanced read methods /// @{ @@ -103,6 +98,15 @@ namespace Dune return pieces_; } +#ifndef DOXYGEN + /// Implementation of \ref FileReader interface + static void fillFactoryImpl (GridFactory& factory, std::string const& filename) + { + Gmsh4Reader reader{factory}; + reader.read(filename); + } +#endif + private: template void readValueBinary(std::ifstream& input, T &v); diff --git a/dune/gmsh4/gridcreators/continuousgridcreator.hh b/dune/gmsh4/gridcreators/continuousgridcreator.hh index cc4883356c608769bfccfafb28a4cf6ba04643fa..ed7be39eb62f634a8ca1e6ed6861e894bf12c76f 100644 --- a/dune/gmsh4/gridcreators/continuousgridcreator.hh +++ b/dune/gmsh4/gridcreators/continuousgridcreator.hh @@ -27,10 +27,9 @@ namespace Dune using GlobalCoordinate = typename Super::GlobalCoordinate; using Nodes = std::vector; - ContinuousGridCreator (GridFactory& factory) - : Super(factory) - {} + public: + using Super::Super; using Super::factory; template @@ -102,5 +101,11 @@ namespace Dune std::size_t vertexShift_ = 0; }; + // deduction guides + template + ContinuousGridCreator(GridFactory&) + -> ContinuousGridCreator; + + } // end namespace Gmsh4 } // end namespace Dune diff --git a/dune/gmsh4/gridcreators/derivedgridcreator.hh b/dune/gmsh4/gridcreators/derivedgridcreator.hh index 37b0ca9067f419d9999c8efce57e7601e1682e61..77d551d9f57c14f302e30b6d2a6e4dc5cdeaa9e2 100644 --- a/dune/gmsh4/gridcreators/derivedgridcreator.hh +++ b/dune/gmsh4/gridcreators/derivedgridcreator.hh @@ -23,9 +23,11 @@ namespace Dune using Grid = typename GridCreator::Grid; using GlobalCoordinate = typename Super::GlobalCoordinate; - DerivedGridCreator (GridFactory& factory) - : Super(factory) - , gridCreator_(factory) + template = 0> + DerivedGridCreator (Args&&... args) + : Super(std::forward(args)...) + , gridCreator_(Super::factory()) {} template diff --git a/dune/gmsh4/gridcreators/discontinuousgridcreator.hh b/dune/gmsh4/gridcreators/discontinuousgridcreator.hh index 58ae02f2c7a8feae0b27227fb3a168a744fc12ae..0772068c57389952876b28147fbae1d4b42a97af 100644 --- a/dune/gmsh4/gridcreators/discontinuousgridcreator.hh +++ b/dune/gmsh4/gridcreators/discontinuousgridcreator.hh @@ -39,10 +39,9 @@ namespace Dune } }; - DiscontinuousGridCreator (GridFactory& factory) - : Super(factory) - {} + public: + using Super::Super; using Super::factory; template @@ -67,5 +66,10 @@ namespace Dune std::map uniquePoints_; }; + // deduction guides + template + DiscontinuousGridCreator(GridFactory&) + -> DiscontinuousGridCreator; + } // end namespace Gmsh4 } // end namespace Dune diff --git a/dune/gmsh4/gridcreators/lagrangegridcreator.hh b/dune/gmsh4/gridcreators/lagrangegridcreator.hh index 9c05cb66b52d49ca7e88014b50050738ac9b5787..4f82e935764fff951e51e7cd8e2e1a2d49338f1b 100644 --- a/dune/gmsh4/gridcreators/lagrangegridcreator.hh +++ b/dune/gmsh4/gridcreators/lagrangegridcreator.hh @@ -59,12 +59,9 @@ namespace Dune class LocalFunction; public: + using Super::Super; using Super::factory; - LagrangeGridCreator (GridFactory& factory) - : Super(factory) - {} - /// Implementation of the interface function `insertVertices()` template void insertVerticesImpl (std::size_t numNodes, @@ -283,6 +280,11 @@ namespace Dune std::size_t vertexShift_ = 0; }; + // deduction guides + template + LagrangeGridCreator(GridFactory&) + -> LagrangeGridCreator; + template class LagrangeGridCreator::LocalParametrization diff --git a/dune/gmsh4/gridcreators/parallelgridcreator.hh b/dune/gmsh4/gridcreators/parallelgridcreator.hh index 0f8942bcf48caef7fb8d16170f745f0f8a2486f8..22162fb6dfb7bef5492d906739b9e6065e685f30 100644 --- a/dune/gmsh4/gridcreators/parallelgridcreator.hh +++ b/dune/gmsh4/gridcreators/parallelgridcreator.hh @@ -32,9 +32,8 @@ namespace Dune // The GridFactory must support insertion of global vertex IDs static_assert(Std::is_detected, GlobalCoordinate, VertexId>{}, ""); - ParallelGridCreator (GridFactory& factory) - : Super(factory) - {} + public: + using Super::Super; template void insertVerticesImpl (std::size_t numNodes, @@ -79,5 +78,11 @@ namespace Dune std::size_t vertexShift_ = 0; }; + // deduction guides + template + ParallelGridCreator(GridFactory&) + -> ParallelGridCreator; + + } // end namespace Gmsh4 } // end namespace Dune diff --git a/dune/gmsh4/gridcreators/serialgridcreator.hh b/dune/gmsh4/gridcreators/serialgridcreator.hh index 82c713bf8add5b3a2cab2b18e022b3e3501bd6ea..c85f088bde31cc1a48729d36d0188b1d09a461dc 100644 --- a/dune/gmsh4/gridcreators/serialgridcreator.hh +++ b/dune/gmsh4/gridcreators/serialgridcreator.hh @@ -22,9 +22,8 @@ namespace Dune using Super = GridCreatorInterface; using GlobalCoordinate = typename Super::GlobalCoordinate; - SerialGridCreator (GridFactory& factory) - : Super(factory) - {} + public: + using Super::Super; template void insertVerticesImpl (std::size_t numNodes, @@ -56,5 +55,11 @@ namespace Dune std::vector shift_; }; + // deduction guides + template + SerialGridCreator(GridFactory&) + -> SerialGridCreator; + + } // end namespace Gmsh4 } // end namespace Dune