version 3.8
nonconformingfecache.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
13#define DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
14
15#include <memory>
16
17#include <dune/common/exceptions.hh>
18#include <dune/geometry/type.hh>
19
20#include <dune/localfunctions/crouzeixraviart.hh>
21#include <dune/localfunctions/rannacherturek.hh>
22#include <dune/localfunctions/common/virtualinterface.hh>
23#include <dune/localfunctions/common/virtualwrappers.hh>
24
25namespace Dumux {
26
27template< class CoordScalar, class Scalar, unsigned int dim>
29{
30 static_assert(dim == 2 || dim == 3, "Non-conforming FE spaces only implemented for 2D and 3D grids");
31
32 // These are so-called non-conforming finite element spaces
33 // the local basis is only continuous at given points on the faces
34 using RT = Dune::RannacherTurekLocalFiniteElement<CoordScalar, Scalar, dim>;
35 using CR = Dune::CrouzeixRaviartLocalFiniteElement<CoordScalar, Scalar, dim>;
36
37public:
38 using FiniteElementType = Dune::LocalFiniteElementVirtualInterface<typename RT::Traits::LocalBasisType::Traits>;
39
41 : rtBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<RT>>(RT{}))
42 , crBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<CR>>(CR{}))
43 {}
44
46 const FiniteElementType& get(const Dune::GeometryType& gt) const
47 {
48 if (gt.isSimplex())
49 return *crBasis_;
50 else if (gt.isCube())
51 return *rtBasis_;
52 else
53 DUNE_THROW(Dune::NotImplemented,
54 "Non-conforming local finite element for geometry type " << gt
55 );
56 }
57
58private:
59 std::unique_ptr<FiniteElementType> rtBasis_;
60 std::unique_ptr<FiniteElementType> crBasis_;
61};
62
63} // end namespace Dumux
64
65#endif
Definition: nonconformingfecache.hh:29
Dune::LocalFiniteElementVirtualInterface< typename RT::Traits::LocalBasisType::Traits > FiniteElementType
Definition: nonconformingfecache.hh:38
NonconformingFECache()
Definition: nonconformingfecache.hh:40
const FiniteElementType & get(const Dune::GeometryType &gt) const
Get local finite element for given GeometryType.
Definition: nonconformingfecache.hh:46
Definition: adapt.hh:17
Definition: common/pdesolver.hh:24