Skip to content
Snippets Groups Projects
Commit 3e421cc8 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Add DefaultBitVector_t

The type alias DefaultBitVector_t<T> provides a default choice
for a bit vector that fits the structure of the vector type T.
parent 74dcb0ce
Branches
No related tags found
No related merge requests found
Pipeline #
...@@ -3,6 +3,7 @@ install(FILES ...@@ -3,6 +3,7 @@ install(FILES
arithmetic.hh arithmetic.hh
boxconstraint.hh boxconstraint.hh
canignore.hh canignore.hh
defaultbitvector.hh
genericvectortools.hh genericvectortools.hh
interval.hh interval.hh
numproc.hh numproc.hh
......
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_SOLVERS_COMMON_DEFAULTBITVECTOR_HH
#define DUNE_SOLVERS_COMMON_DEFAULTBITVECTOR_HH
#include <dune/common/fvector.hh>
#include <dune/istl/bvector.hh>
namespace Dune {
namespace Solvers {
namespace Imp {
template<class Vector>
struct DefaultBitVector
{
using type = void;
};
template<class T, class A>
struct DefaultBitVector<BlockVector<T,A>>
{
using type = typename std::vector<typename DefaultBitVector<T>::type>;
};
template<class T, class A>
struct DefaultBitVector<std::vector<T,A>>
{
using type = typename std::vector<typename DefaultBitVector<T>::type>;
};
template<class T, int i, class A>
struct DefaultBitVector<BlockVector<FieldVector<T,i>, A>>
{
using type = BitSetVector<i>;
};
} // end namespace Imp
/**
* \brief Type alias for a bit vector that fits to T
*
* \tparam T A nested container type
*
* This alias provides a default choice of a bit vector
* that has the same nested structure as T.
*/
template<class T>
using DefaultBitVector_t = typename Imp::DefaultBitVector<T>::type;
} // end namespace Solvers
} // end namespace Solvers
#endif // DUNE_SOLVERS_COMMON_BITVECTOR_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment