dealii::ExcCudaError(cudaGetErrorString(error_code)))
#endif
-// A static assert which checks a compile-time condition. This is nothing more
-// than a wrapper around the C++11 <code>static_assert</code> declaration, which
-// we need to disable for non-C++11.
-
-// Just like <code>static_assert</code>, it takes two arguments, a
-// <code>constexpr</code> condition and an error message.
-#if defined(DEAL_II_WITH_CXX11)
-#define DEAL_II_STATIC_ASSERT(...) static_assert(__VA_ARGS__)
-#else
-#define DEAL_II_STATIC_ASSERT(...) /* do nothing */
-#endif
-
using namespace StandardExceptions;
DEAL_II_NAMESPACE_CLOSE
#ifdef DEAL_II_WITH_CXX11
-#include <deal.II/base/exceptions.h>
#include <deal.II/base/quadrature.h>
#include <deal.II/base/subscriptor.h>
#include <deal.II/grid/tria.h>
class ContinuousQuadratureDataTransfer
{
public:
- DEAL_II_STATIC_ASSERT(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
- "User's DataType class should be derived from QPData");
+ static_assert(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
+ "User's DataType class should be derived from QPData");
/**
* A typedef for a cell.
void CellDataStorage<CellIteratorType,DataType>::initialize(const CellIteratorType &cell,
const unsigned int n_q_points)
{
- DEAL_II_STATIC_ASSERT(std::is_base_of<DataType, T>::value,
- "User's T class should be derived from user's DataType class");
+ static_assert(std::is_base_of<DataType, T>::value,
+ "User's T class should be derived from user's DataType class");
if (map.find(cell) == map.end())
{
std::vector<std::shared_ptr<T> >
CellDataStorage<CellIteratorType,DataType>::get_data(const CellIteratorType &cell)
{
- DEAL_II_STATIC_ASSERT(std::is_base_of<DataType, T>::value,
- "User's T class should be derived from user's DataType class");
+ static_assert(std::is_base_of<DataType, T>::value,
+ "User's T class should be derived from user's DataType class");
auto it = map.find(cell);
Assert(it != map.end(), ExcMessage("Could not find data for the cell"));
std::vector<std::shared_ptr<const T> >
CellDataStorage<CellIteratorType,DataType>::get_data(const CellIteratorType &cell) const
{
- DEAL_II_STATIC_ASSERT(std::is_base_of<DataType, T>::value,
- "User's T class should be derived from user's DataType class");
+ static_assert(std::is_base_of<DataType, T>::value,
+ "User's T class should be derived from user's DataType class");
auto it = map.find(cell);
Assert(it != map.end(), ExcMessage("Could not find QP data for the cell"));
const CellDataStorage<CellIteratorType,DataType> *data_storage,
FullMatrix<double> &matrix_data)
{
- DEAL_II_STATIC_ASSERT(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
- "User's DataType class should be derived from QPData");
+ static_assert(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
+ "User's DataType class should be derived from QPData");
const std::vector<std::shared_ptr<const DataType> > qpd = data_storage->get_data(cell);
const FullMatrix<double> &values_at_qp,
CellDataStorage<CellIteratorType,DataType> *data_storage)
{
- DEAL_II_STATIC_ASSERT(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
- "User's DataType class should be derived from QPData");
+ static_assert(std::is_base_of<TransferableQuadraturePointData, DataType>::value,
+ "User's DataType class should be derived from QPData");
std::vector<std::shared_ptr<DataType> > qpd = data_storage->get_data(cell);
#define dealii__tensor_accessors_h
#include <deal.II/base/config.h>
-#include <deal.II/base/exceptions.h>
#include <deal.II/base/template_constraints.h>
#include <deal.II/base/table_indices.h>
internal::ReorderedIndexView<index, rank, T>
reordered_index_view(T &t)
{
- DEAL_II_STATIC_ASSERT(0 <= index && index < rank,
- "The specified index must lie within the range [0,rank)");
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(0 <= index && index < rank,
+ "The specified index must lie within the range [0,rank)");
+#endif
return internal::ReorderedIndexView<index, rank, T>(t);
}
inline DEAL_II_ALWAYS_INLINE
void contract(T1 &result, const T2 &left, const T3 &right)
{
- DEAL_II_STATIC_ASSERT(rank_1 >= no_contr, "The rank of the left tensor must be "
- "equal or greater than the number of "
- "contractions");
- DEAL_II_STATIC_ASSERT(rank_2 >= no_contr, "The rank of the right tensor must be "
- "equal or greater than the number of "
- "contractions");
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(rank_1 >= no_contr, "The rank of the left tensor must be "
+ "equal or greater than the number of "
+ "contractions");
+ static_assert(rank_2 >= no_contr, "The rank of the right tensor must be "
+ "equal or greater than the number of "
+ "contractions");
+#endif
internal::Contract<no_contr, rank_1, rank_2, dim>::template contract<T1, T2, T3>
(result, left, right);
// explicitly check for sensible template arguments, but not on windows
// because MSVC creates bogus warnings during normal compilation
+#ifdef DEAL_II_WITH_CXX11
#ifndef DEAL_II_MSVC
- DEAL_II_STATIC_ASSERT (dim<=spacedim,
- "The dimension <dim> of a DoFHandler must be less than or "
- "equal to the space dimension <spacedim> in which it lives.");
+ static_assert (dim<=spacedim,
+ "The dimension <dim> of a DoFHandler must be less than or "
+ "equal to the space dimension <spacedim> in which it lives.");
+#endif
#endif
};
// explicitly check for sensible template arguments, but not on windows
// because MSVC creates bogus warnings during normal compilation
+#ifdef DEAL_II_WITH_CXX11
#ifndef DEAL_II_MSVC
- DEAL_II_STATIC_ASSERT (dim<=spacedim,
- "The dimension <dim> of a FiniteElement must be less than or "
- "equal to the space dimension <spacedim> in which it lives.");
+ static_assert (dim<=spacedim,
+ "The dimension <dim> of a FiniteElement must be less than or "
+ "equal to the space dimension <spacedim> in which it lives.");
+#endif
#endif
};
public:
// explicitly check for sensible template arguments
- DEAL_II_STATIC_ASSERT (dim<=spacedim,
- "The dimension <dim> of a Manifold must be less than or "
- "equal to the space dimension <spacedim> in which it lives.");
+#ifdef DEAL_II_WITH_CXX11
+ static_assert (dim<=spacedim,
+ "The dimension <dim> of a Manifold must be less than or "
+ "equal to the space dimension <spacedim> in which it lives.");
+#endif
/**
{
public:
// explicitly check for sensible template arguments
- DEAL_II_STATIC_ASSERT (dim<=spacedim,
- "The dimension <dim> of a ChartManifold must be less than or "
- "equal to the space dimension <spacedim> in which it lives.");
+#ifdef DEAL_II_WITH_CXX11
+ static_assert (dim<=spacedim,
+ "The dimension <dim> of a ChartManifold must be less than or "
+ "equal to the space dimension <spacedim> in which it lives.");
+#endif
/**
* Constructor. The optional argument can be used to specify the periodicity
// explicitly check for sensible template arguments, but not on windows
// because MSVC creates bogus warnings during normal compilation
+#ifdef DEAL_II_WITH_CXX11
#ifndef DEAL_II_MSVC
- DEAL_II_STATIC_ASSERT (dim<=spacedim,
- "The dimension <dim> of a Triangulation must be less than or "
- "equal to the space dimension <spacedim> in which it lives.");
+ static_assert (dim<=spacedim,
+ "The dimension <dim> of a Triangulation must be less than or "
+ "equal to the space dimension <spacedim> in which it lives.");
+#endif
#endif
};
BlockLinearOperator<Range, Domain, BlockPayload>
block_operator(const std::array<std::array<LinearOperator<typename Range::BlockType, typename Domain::BlockType, typename BlockPayload::BlockType>, n>, m> &ops)
{
- DEAL_II_STATIC_ASSERT(m > 0 && n > 0,
- "a blocked LinearOperator must consist of at least one block");
+ static_assert(m > 0 && n > 0,
+ "a blocked LinearOperator must consist of at least one block");
typedef typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType BlockType;
BlockLinearOperator<Range, Domain, BlockPayload>
block_diagonal_operator(const std::array<LinearOperator<typename Range::BlockType, typename Domain::BlockType, typename BlockPayload::BlockType>, m> &ops)
{
- DEAL_II_STATIC_ASSERT(m > 0,
- "a blockdiagonal LinearOperator must consist of at least one block");
+ static_assert(m > 0,
+ "a blockdiagonal LinearOperator must consist of at least one block");
typedef typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType BlockType;
BlockLinearOperator<Range, Domain, BlockPayload>
block_diagonal_operator(const LinearOperator<typename Range::BlockType, typename Domain::BlockType, typename BlockPayload::BlockType> &op)
{
- DEAL_II_STATIC_ASSERT(m > 0,
- "a blockdiagonal LinearOperator must consist of at least "
- "one block");
+ static_assert(m > 0,
+ "a blockdiagonal LinearOperator must consist of at least "
+ "one block");
typedef typename BlockLinearOperator<Range, Domain, BlockPayload>::BlockType BlockType;
std::array<BlockType, m> new_ops;
// true). As mentioned above, try to check this at compile time if C++11
// support is available.
#ifdef DEAL_II_WITH_CXX11
- DEAL_II_STATIC_ASSERT(Constness == true,
- "Constructing a non-const iterator from a const iterator "
- "does not make sense.");
+ static_assert(Constness == true,
+ "Constructing a non-const iterator from a const iterator "
+ "does not make sense.");
#else
Assert(Constness == true, ExcCastingAwayConstness());
#endif
operator*(typename Range::value_type number,
const LinearOperator<Range, Domain, Payload> &op)
{
- DEAL_II_STATIC_ASSERT(
+ static_assert(
std::is_convertible<typename Range::value_type, typename Domain::value_type>::value,
"Range and Domain must have implicitly convertible 'value_type's");
operator*(const LinearOperator<Range, Domain, Payload> &op,
typename Domain::value_type number)
{
- DEAL_II_STATIC_ASSERT(
+ static_assert(
std::is_convertible<typename Range::value_type, typename Domain::value_type>::value,
"Range and Domain must have implicitly convertible 'value_type's");
// This file contains simple preconditioners.
#include <deal.II/base/config.h>
-#include <deal.II/base/exceptions.h>
#include <deal.II/base/smartpointer.h>
#include <deal.II/base/utilities.h>
#include <deal.II/base/parallel.h>
inline void
PreconditionRichardson::vmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
"PreconditionRichardson and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
dst.equ(relaxation,src);
}
inline void
PreconditionRichardson::Tvmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
"PreconditionRichardson and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
dst.equ(relaxation,src);
}
inline void
PreconditionRichardson::vmult_add (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
"PreconditionRichardson and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
dst.add(relaxation,src);
}
inline void
PreconditionRichardson::Tvmult_add (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
"PreconditionRichardson and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
dst.add(relaxation,src);
}
inline void
PreconditionJacobi<MatrixType>::vmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionJacobi<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionJacobi and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_Jacobi (dst, src, this->relaxation);
inline void
PreconditionJacobi<MatrixType>::Tvmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionJacobi<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionJacobi and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_Jacobi (dst, src, this->relaxation);
inline void
PreconditionJacobi<MatrixType>::step (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionJacobi<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionJacobi and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->Jacobi_step (dst, src, this->relaxation);
inline void
PreconditionJacobi<MatrixType>::Tstep (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionJacobi<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionJacobi and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
step (dst, src);
}
inline void
PreconditionSOR<MatrixType>::vmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_SOR (dst, src, this->relaxation);
inline void
PreconditionSOR<MatrixType>::Tvmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_TSOR (dst, src, this->relaxation);
inline void
PreconditionSOR<MatrixType>::step (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->SOR_step (dst, src, this->relaxation);
inline void
PreconditionSOR<MatrixType>::Tstep (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->TSOR_step (dst, src, this->relaxation);
inline void
PreconditionSSOR<MatrixType>::vmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_SSOR (dst, src, this->relaxation, pos_right_of_diagonal);
inline void
PreconditionSSOR<MatrixType>::Tvmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->precondition_SSOR (dst, src, this->relaxation, pos_right_of_diagonal);
inline void
PreconditionSSOR<MatrixType>::step (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
this->A->SSOR_step (dst, src, this->relaxation);
inline void
PreconditionSSOR<MatrixType>::Tstep (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionSSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionSSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
step (dst, src);
}
inline void
PreconditionPSOR<MatrixType>::vmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionPSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionPSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
dst = src;
inline void
PreconditionPSOR<MatrixType>::Tvmult (VectorType &dst, const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<typename PreconditionPSOR<MatrixType>::size_type, typename VectorType::size_type>::value,
"PreconditionPSOR and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
Assert (this->A!=0, ExcNotInitialized());
dst = src;
delta (1.),
is_initialized (false)
{
- DEAL_II_STATIC_ASSERT(
+#ifdef DEAL_II_WITH_CXX11
+ static_assert(
std::is_same<size_type, typename VectorType::size_type>::value,
"PreconditionChebyshev and VectorType must have the same size_type.");
+#endif // DEAL_II_WITH_CXX11
}
template <typename... Args>
TrilinosBlockPayload (const Args &...)
{
- DEAL_II_STATIC_ASSERT(typeid(PayloadBlockType)==typeid(internal::LinearOperator::TrilinosPayload),
- "TrilinosBlockPayload can only accept a payload of type TrilinosPayload.");
+ static_assert(typeid(PayloadBlockType)==typeid(internal::LinearOperator::TrilinosPayload),
+ "TrilinosBlockPayload can only accept a payload of type TrilinosPayload.");
}
};
MGInterfaceOperator<OperatorType>::vmult (VectorType &dst,
const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT (std::is_same<typename VectorType::value_type,value_type>::value,
- "The vector type must be based on the same value type as this"
- "operator");
+#ifdef DEAL_II_WITH_CXX11
+#ifndef DEAL_II_MSVC
+ static_assert (std::is_same<typename VectorType::value_type,value_type>::value,
+ "The vector type must be based on the same value type as this"
+ "operator");
+#endif
+#endif
Assert(mf_base_operator != NULL,
ExcNotInitialized());
MGInterfaceOperator<OperatorType>::Tvmult (VectorType &dst,
const VectorType &src) const
{
- DEAL_II_STATIC_ASSERT (std::is_same<typename VectorType::value_type,value_type>::value,
- "The vector type must be based on the same value type as this"
- "operator");
+#ifdef DEAL_II_WITH_CXX11
+#ifndef DEAL_II_MSVC
+ static_assert (std::is_same<typename VectorType::value_type,value_type>::value,
+ "The vector type must be based on the same value type as this"
+ "operator");
+#endif
+#endif
Assert(mf_base_operator != NULL,
ExcNotInitialized());