Skip to content
Snippets Groups Projects
Select Git revision
  • 7fd013dfd1ed1fa934e3e791f3d35d5b3f15970c
  • master default
  • feature/update-ci
  • bugfix/test-memory-leak
  • releases/2.9
  • feature/thread-parallel-assembler
  • feature/exploit-tensor-quadrature
  • releases/2.8
  • work-matrixindexset
  • tobias-patches-membrane
  • releases/2.7
  • bugfix/any_hh-use_std_remove_const
  • tobias-patches
  • feature/handout-wrapped-functionsbasis
  • introduce-periodic-basis
  • test/use-default-ci-setup
  • feature/powerBasis
  • move-makefunction-to-namespace-dune-fufem
  • missing-include
  • releases/2.6-1
  • bugfix/matrix-size-in-dune-functions-assembler
  • subversion->git
22 results

p2hierarchicalbasis.hh

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    p2hierarchicalbasis.hh 2.92 KiB
    #ifndef P2_HIERARCHICAL_BASIS_HH
    #define P2_HIERARCHICAL_BASIS_HH
    
    /**
       @file
       @brief
    
       @author
     */
    
    #include <dune/common/version.hh>
    
    #include <dune/localfunctions/hierarchical/hierarchicalp2.hh>
    #include <dune/localfunctions/hierarchical/hierarchicalprismp2.hh>
    
    #include <dune/fufem/functionspacebases/functionspacebasis.hh>
    #include <dune/fufem/functionspacebases/p2nodalbasis.hh>
    
    
    template <class GV, class RT=double>
    class P2HierarchicalBasis :
        public FunctionSpaceBasis<GV, RT,
            Dune::LocalFiniteElementVirtualInterface<
    #if DUNE_VERSION_GTE(DUNE_LOCALFUNCTIONS, 2, 7)
                typename Dune::Impl::LagrangeSimplexLocalBasis<typename GV::Grid::ctype, RT, GV::dimension, 1>::Traits
    #else
                typename Dune::P1LocalBasis<typename GV::Grid::ctype, RT, GV::dimension>::Traits
    #endif
              >
    >
    {
        protected:
            typedef typename GV::Grid::ctype ctype;
    
    #if DUNE_VERSION_GTE(DUNE_LOCALFUNCTIONS, 2, 7)
            using P1Traits = typename Dune::Impl::LagrangeSimplexLocalBasis<typename GV::Grid::ctype, RT, GV::dimension, 1>::Traits;
    #else
            using P1Traits = typename Dune::P1LocalBasis<typename GV::Grid::ctype, RT, GV::dimension>::Traits;
    #endif
    
            typedef Dune::LocalFiniteElementVirtualInterface<P1Traits> LFE;
    
            typedef FunctionSpaceBasis<GV, RT, LFE> Base;
            typedef typename Base::Element Element;
    
            using Base::dim;
            using Base::gridview_;
    
    
        public:
            typedef typename Base::GridView GridView;
            typedef typename Base::ReturnType ReturnType;
            typedef typename Base::LocalFiniteElement LocalFiniteElement;
            typedef typename Base::LinearCombination LinearCombination;
    
            P2HierarchicalBasis(const GridView& gridview) :
                Base(gridview),
                mapper_(gridview)
            {}
    
            size_t size() const
            {
                return mapper_.size();
            }
    
            void update(const GridView& gridview)
            {
                Base::update(gridview);
                mapper_.update();
            }
    
            const LocalFiniteElement& getLocalFiniteElement(const Element& e) const
            {
                if (e.type().isSimplex())
                    return localSimplexFE_;
                else if (e.type().isPrism())
                    // without the cast this doesn't compile for dim!=3
                    return dynamic_cast<const LocalFiniteElement&>(localPrismFE_);
                else
                    DUNE_THROW(Dune::NotImplemented, "There is no shape function set for a " << e.type());
            }
    
            int index(const Element& e, const int i) const
            {
                return mapper_.index(e, getLocalFiniteElement(e).localCoefficients().localKey(i));
            }
    
        protected:
            const Dune::LocalFiniteElementVirtualImp<Dune::HierarchicalPrismP2LocalFiniteElement<ctype, RT> > localPrismFE_;
            const Dune::LocalFiniteElementVirtualImp<Dune::HierarchicalP2LocalFiniteElement<ctype, RT, dim> > localSimplexFE_;
            P2BasisMapper<GV> mapper_;
    };
    
    #endif