Commit 72a3ee30 authored by Santiago Ospina's avatar Santiago Ospina
Browse files

Allow construction of raviart thomas for simplices in any dimension and order


Signed-off-by: Santiago Ospina De Los Ríos's avatarSantiago Ospina <santiago.ospina@iup.uni-heidelberg.de>
parent 2d2c6b91
......@@ -21,8 +21,8 @@ private:
static_assert(dim==2||dim==3);
static_assert(gt==GeometryType::simplex||gt==GeometryType::cube);
// hardcoded bool helpers
static constexpr bool value_2d_simplex = (order <= 1);
static constexpr bool value_3d_simplex = false;
static constexpr bool value_2d_simplex = true;
static constexpr bool value_3d_simplex = true;
static constexpr bool value_2d_cube = (order <= 2);
static constexpr bool value_3d_cube = (order <= 1);
static constexpr bool value_simplex = (dim==2) ? value_2d_simplex : value_3d_simplex;
......
......@@ -38,7 +38,10 @@ class RaviartThomasSimplexLocalFiniteElementMap
RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>;
using Base = Dune::PDELab::SimpleLocalFiniteElementMap<FE,GV::dimension>;
public:
RaviartThomasSimplexLocalFiniteElementMap(const GV& gv) : Base(_fe) {}
RaviartThomasSimplexLocalFiniteElementMap(const GV& gv)
: Base(FE(Dune::GeometryTypes::simplex(GV::dimension),k))
, _fe(Dune::GeometryTypes::simplex(GV::dimension),k)
{}
static constexpr bool fixedSize()
......@@ -71,30 +74,33 @@ public:
}
private:
static const FE _fe;
const FE _fe;
};
// initialization of the static finite element.
template<class GV, class DF, class RF, std::size_t k>
const Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>
RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,k>::_fe
= Dune::Dorie::RaviartThomasSimplexLocalFiniteElement<GV::dimension,DF,RF>
(Dune::GeometryTypes::simplex(GV::dimension),k);
template<typename GV, int dim, typename DF, typename RF,
std::size_t k, GeometryType::BasicType gt>
template<class GV, class DF, class RF, std::size_t k,
GeometryType::BasicType gt, class = void>
struct RaviartThomasLocalFiniteElementMapBaseSelector
{
using type = Dune::PDELab::RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,gt>;
};
template<typename GV, typename DF, typename RF>
template<class GV, class DF, class RF, std::size_t k>
struct RaviartThomasLocalFiniteElementMapBaseSelector<
GV,3,DF,RF,0,GeometryType::simplex>
GV,DF,RF,k,GeometryType::simplex,
std::enable_if_t<(GV::dimension>2)>
>
{
using type = RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,0>;
using type = RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,k>;
};
template<class GV, class DF, class RF, std::size_t k>
struct RaviartThomasLocalFiniteElementMapBaseSelector<
GV,DF,RF,k,GeometryType::simplex,
std::enable_if_t<(GV::dimension==2 && k>1)>
>
{
using type = RaviartThomasSimplexLocalFiniteElementMap<GV,DF,RF,k>;
};
/*-------------------------------------------------------------------------*//**
* @brief Finite element map for raviart thomas elements
......@@ -139,11 +145,11 @@ public:
template<class GV, class DF, class RF, int k>
class RaviartThomasLocalFiniteElementMap<GV,DF,RF,k,Dune::GeometryType::simplex>
: public Dune::Dorie::RaviartThomasLocalFiniteElementMapBaseSelector<
GV,GV::dimension,DF,RF,k,Dune::GeometryType::simplex>::type
GV,DF,RF,k,Dune::GeometryType::simplex>::type
{
using Base = typename Dune::Dorie::
RaviartThomasLocalFiniteElementMapBaseSelector<
GV,GV::dimension,DF,RF,k,Dune::GeometryType::simplex
GV,DF,RF,k,Dune::GeometryType::simplex
>::type;
public:
RaviartThomasLocalFiniteElementMap(const GV& gv) : Base(gv) {}
......
......@@ -48,4 +48,4 @@ dune_add_test(
MPI_RANKS 2
TIMEOUT 30
CMD_ARGS ${CMAKE_CURRENT_BINARY_DIR}/gc_files_0003.ini
)
)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment