#pragma once #include #include #include #include #include #include #include #include #include namespace AMDiS { namespace Impl { template struct LagrangePreBasisCreatorImpl; // specialization for single node basis template struct LagrangePreBasisCreatorImpl { static auto create() { using namespace Dune::Functions::BasisFactory; return lagrange(); } }; // specialization for composite basis template struct LagrangePreBasisCreatorImpl { static auto create() { using namespace Dune::Functions::BasisFactory; return composite(lagrange()..., flatLexicographic()); } }; // specialization for power basis template struct LagrangePreBasisCreatorImpl { static auto create() { using namespace Dune::Functions::BasisFactory; return power<1+sizeof...(degs)>(lagrange(), flatLexicographic()); } }; // factory to construct a global basis of several lagrange bases, with flat indexing. template struct LagrangePreBasisCreator : public LagrangePreBasisCreatorImpl, deg, degs...> {}; template struct TaylorHoodPreBasisCreator { static auto create() { using namespace Dune::Functions::BasisFactory; return composite(power(lagrange(), flatInterleaved()), lagrange(), flatLexicographic()); } }; } // end namespace Impl /// Wrapper around a global basis providing default traits template class TraitsImpl = BackendTraits> struct DefaultProblemTraits { using GlobalBasis = GB; using CoefficientType = T; using LinAlgTraits = TraitsImpl; }; /// Generator for a basis and default problem traits template class TraitsImpl = BackendTraits> struct DefaultBasisCreator { using Grid = AdaptiveGrid_t; using GridView = typename Grid::LeafGridView; static auto create(std::string const& name, GridView const& gridView) { return makeGlobalBasis(name, gridView, PreBasisCreator::create()); } static auto create(GridView const& gridView) { return makeGlobalBasis(gridView, PreBasisCreator::create()); } using GlobalBasis = decltype(create(std::declval())); using CoefficientType = T; using LinAlgTraits = TraitsImpl; }; /// \brief ProblemStatTraits for a (composite) basis composed of /// lagrange bases of different degree. template struct LagrangeBasis : public DefaultBasisCreator> {}; /// \brief Specialization of \ref LagrangeBasis for Grid type /// \ref Dune::YaspGrid for a given dimension. template struct YaspGridBasis : public LagrangeBasis, degrees...> {}; /// \brief ProblemStatTraits of Taylor-Hood basis of lagrange-type /// with pressure degree k template struct TaylorHoodBasis : public DefaultBasisCreator> {}; } // end namespace AMDiS