Commit e93e57d6 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

Merge branch 'replace-enum-with-constexpr-static' into 'master'

replace `enum` with `constexpr static` where appropriate

See merge request !219
parents 962337dc 54da07fe
Pipeline #45471 passed with stage
in 10 minutes and 35 seconds
......@@ -173,7 +173,7 @@ namespace Dune {
class BasisInterface
{
struct ImplementationDefined;
enum { implementationDefined };
constexpr static int implementationDefined = 42;
public:
//! types of domain and range
......@@ -189,11 +189,10 @@ namespace Dune {
//! Field type of the domain
typedef ImplementationDefined DomainFieldType;
//! \brief Enum for domain dimension
enum {
//! \brief dimension of the domain
dimDomain = implementationDefined
};
//! \brief dimension of the domain
constexpr static int dimDomain = implementationDefined;
//! Type used for coordinate vectors in the domain
typedef ImplementationDefined DomainType;
......@@ -204,11 +203,10 @@ namespace Dune {
//! Field type of the range
typedef ImplementationDefined RangeFieldType;
//! \brief Enum for range dimension
enum {
//! \brief dimension of the range
dimRange = implementationDefined
};
//! \brief dimension of the range
constexpr static int dimRange = implementationDefined;
//! Type used for range values
typedef ImplementationDefined RangeType;
......
......@@ -33,11 +33,8 @@ namespace Dune
//! \brief Export type for domain field
typedef DF DomainFieldType;
//! \brief Enum for domain dimension
enum {
//! \brief dimension of the domain
dimDomain = n
};
//! \brief dimension of the domain
constexpr static int dimDomain = n;
//! \brief domain type
typedef D DomainType;
......@@ -45,11 +42,8 @@ namespace Dune
//! \brief Export type for range field
typedef RF RangeFieldType;
//! \brief Enum for range dimension
enum {
//! \brief dimension of the range
dimRange = m
};
//! \brief dimension of the range
constexpr static int dimRange = m;
//! \brief range type
typedef R RangeType;
......
......@@ -37,7 +37,7 @@ namespace Dune
template<class D, class R, int d, int p>
class MonomialLocalFiniteElement
{
enum { static_size = MonomialLocalBasis<D,R,d,p>::size() };
constexpr static int static_size = MonomialLocalBasis<D,R,d,p>::size();
public:
/** Traits class
......
......@@ -95,10 +95,9 @@ namespace Dune
template <typename Traits, int c>
struct Evaluate
{
enum {
//! The next dimension to try for factors
d = Traits::dimDomain - c
};
//! The next dimension to try for factors
constexpr static int d = Traits::dimDomain - c;
/** \todo
*
* \tparam Access Wrapper around the result vector, so we don't have to
......@@ -159,7 +158,7 @@ namespace Dune
template <typename Traits>
struct Evaluate<Traits, 1>
{
enum { d = Traits::dimDomain-1 };
constexpr static int d = Traits::dimDomain-1;
//! \copydoc Evaluate::eval
template <typename Access>
static void eval (const typename Traits::DomainType &in,
......
......@@ -37,7 +37,7 @@ namespace Dune
: public RefinedSimplexLocalBasis<D,dim>
{
// 2 to the k-th power
enum {N = 1<<dim};
constexpr static int N = 1<<dim;
public:
//! \brief export type traits for function signature
typedef LocalBasisTraits<D,dim,Dune::FieldVector<D,dim>,R,1,Dune::FieldVector<R,1>, Dune::FieldMatrix<R,1,dim> > Traits;
......
......@@ -22,7 +22,7 @@ namespace Dune
class RefinedP0LocalCoefficients
{
// 2 to the k-th power
enum {N = 1<<k};
constexpr static int N = 1<<k;
public:
RefinedP0LocalCoefficients () :
......
......@@ -184,8 +184,7 @@ namespace Dune
static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
static const unsigned int dimDomain = dimD;
static const unsigned int dimRange = dimR;
// size needs to be an anonymous enum value for gcc 3.4 compatibility
enum { size = Base::size+ThisLFETensor::size*dimR };
constexpr static int size = Base::size+ThisLFETensor::size*dimR;
typedef Dune::FieldVector<F,size> Block;
This &operator=(const F& f)
......@@ -354,8 +353,7 @@ namespace Dune
static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
static const unsigned int dimDomain = dimD;
static const unsigned int dimRange = dimR;
// size needs to be an anonymous enum value for gcc 3.4 compatibility
enum { size = ThisLFETensor::size*dimR };
constexpr static int size = ThisLFETensor::size*dimR;
typedef Dune::FieldVector<F,size> Block;
template <class FF>
......@@ -496,8 +494,7 @@ namespace Dune
static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
static const unsigned int dimDomain = dimD;
static const unsigned int dimRange = dimR;
// size needs to be an anonymous enum value for gcc 3.4 compatibility
enum { size = ScalarDeriv::size*dimR };
constexpr static int size = ScalarDeriv::size*dimR;
typedef Dune::FieldVector<F,size> Block;
template <class FF>
......
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