Commit 1f56dabe authored by Fabian's avatar Fabian
Browse files

Bug fix for constant Lagrangian in febasis_wrapper (BETL2 defines...

Bug fix for constant Lagrangian in febasis_wrapper (BETL2 defines multiplicities weird for constants, this is explicitely dealed differently)
parent 0c7829da
......@@ -201,6 +201,173 @@ namespace betl2 {
}
}; // end class FEBasisWrapper
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
/*------------------------ BEGIN DOXYGEN HIDING ------------------------*/
//! @cond
//! @brief Specialization for the case of constant Lagrangian finite elements
template< class GRID_VIEW_FACTORY_T >
class FEBasisWrapper<0, FEBasisType::Lagrange, GRID_VIEW_FACTORY_T> : public betl2::fe::FEBasis<0, FEBasisType::Lagrange>
{
private:
//! Type of grid view factory
typedef GRID_VIEW_FACTORY_T gridViewFactory_t;
//! Traits
typedef detail::FEBasisWrapperTraits<0, FEBasisType::Lagrange,
gridViewFactory_t> traits_t;
//! Type of eth::grid::ViewTraits
typedef typename traits_t::viewTraits_t viewTraits_t;
//! Type of eth::grid::GridView
typedef eth::grid::GridView<viewTraits_t> gridView_t;
//! Type of eth::grid::GridTraits
typedef typename gridView_t::gridTraits_t gridTraits_t;
//! Type of entity
template< int CODIM >
using entity_t = eth::grid::Entity<gridTraits_t, CODIM>;
public:
//! Type of febasis
typedef betl2::fe::FEBasis<0, FEBasisType::Lagrange> febasis_t;
//! Standard type for indexing
typedef typename febasis_t::size_type size_type;
//! Constructor
FEBasisWrapper() {}
//! Type giving access to basis functions.
template< enum eth::base::RefElType RET >
using basisFunction_t = typename febasis_t::template basisFunction_t<RET>;
//! Type for functions with differential operator (Gradient for H^s,
//! Curl for H^s(curl)) applied to the basis
template< enum eth::base::RefElType RET, enum fe::FEDiff D = fe::FEDiff::Grad >
using diffBasisFunction_t = typename febasis_t::template
diffBasisFunction_t<RET,D>;
//! @return approximation order of the space (polynomial order)
constexpr static int approxOrder( ) { return febasis_t::approxOrder(); }
//! @return the class the space belongs to (Lagrangian/H(div)/H(curl),
//! see \ref FEBasisType)
constexpr static FEBasisType feBasisType( ) { return FEBasisType::Lagrange; }
//! @return the number of dofs for a given reference type.
template< eth::base::RefElType RET >
static constexpr size_type multiplicity( )
{
return gridTraits_t::dimMesh-eth::base::ReferenceElement<RET>::dimension == 0
? 1 : 0;
}
//! @returnsthe overall number of dofs up to a given reference element type.
template< eth::base::RefElType RET >
static constexpr size_type numDofs( )
{
return gridTraits_t::dimMesh-eth::base::ReferenceElement<RET>::dimension == 0
? 1 : 0;
}
/*! @return the number of dofs for a given reference element type
* (runtime version)
*
* @param ref_element Reference element type.
*/
static size_type multiplicity( const eth::base::RefElType ref_element )
{
return eth::base::ReferenceElements::applyUniversal<Multiplicity_,
eth::base::AllRefElTypesList_t >( ref_element );
}
/*! @return the overall number of dofs up to a given reference element type
* (runtime version)
*
* @param ref_element Reference element type.
*/
static size_type numDofs( const eth::base::RefElType ref_element )
{
return eth::base::ReferenceElements::applyUniversal<NumDofs_,
eth::base::AllRefElTypesList_t >( ref_element );
}
/*! @return the number of degrees of freedom solely associated with an
* entity and not any sub-entities.
*
* @param entity Entity.
*/
template< int CODIM >
size_type multiplicity(const entity_t<CODIM>& entity)
{
return multiplicity(entity.refElType());
}
/*! @return the number of degrees of freedom solely associated with an
* entity and not any sub-entities. (constant version)
*
* @param entity Entity.
*/
template< int CODIM >
const size_type multiplicity(const entity_t<CODIM>& entity) const
{
return multiplicity(entity.refElType());
}
/*! @return overall number of degrees of freedom for an entity.
*
* @param entity Entity.
*/
template< int CODIM >
size_type numDofs(const entity_t<CODIM>& entity)
{
return numDofs(entity.refElType());
}
/*! @return overall number of degrees of freedom for an entity. (constant version)
*
* @param entity Entity.
*/
template< int CODIM >
const size_type numDofs(const entity_t<CODIM>& e) const
{
return numDofs(e.refElType());
}
private:
template< eth::base::RefElType RET >
struct Multiplicity_
{
typedef size_type returnType_t;
static returnType_t invoke( )
{
return multiplicity<RET>( );
}
};
template< eth::base::RefElType RET >
struct NumDofs_
{
typedef size_type returnType_t;
static returnType_t invoke( )
{
return numDofs<RET>( );
}
};
}; // end class FEBasisWrapper< 0 >
//! @endcond
/*------------------------- END DOXYGEN HIDING -------------------------*/
/*! @} */
} // end namespace ex
......
Supports Markdown
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