Liebe Gitlab-Nutzerin, lieber Gitlab-Nutzer,
es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Die Konten der externen Nutzer:innen sind über den Reiter "Standard" erreichbar.
Die Administratoren


Dear Gitlab user,
it is now possible to log in to our service using the ZIH login/LDAP. The accounts of external users can be accessed via the "Standard" tab.
The administrators

Commit 8d766ee3 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

change test for range category in operators to size

parent 0bf48824
......@@ -40,7 +40,7 @@ namespace AMDiS
constexpr Dune::VTK::FieldInfo::Type VTKFieldType = Impl::VTKFieldTypeImpl<ValueCategory_t<Range>>::value;
template <class Range>
constexpr std::size_t VTKFieldSize = Size<Range>;
constexpr std::size_t VTKFieldSize = Size_v<Range>;
template <class GB, class VT, class TP>
......
......@@ -6,7 +6,7 @@
#include <amdis/LocalOperator.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/Utility.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -23,17 +23,19 @@ namespace AMDiS
: public LocalOperator<ConvectionDiffusionOperator<LocalContext, GridFctA, GridFctB, GridFctC, GridFctF, conserving>,
LocalContext>
{
using A_range_type = typename GridFctA::Range;
static_assert( Category::Scalar<A_range_type> || Category::Matrix<A_range_type>,
static const int dow = ContextGeometry<LocalContext>::dow;
using A_range = typename GridFctA::Range;
static_assert( Size_v<A_range> == 1 || (Rows_v<A_range> == dow && Cols_v<A_range> == dow),
"Expression A(x) must be of scalar or matrix type." );
using b_range_type = typename GridFctB::Range;
static_assert( Category::Scalar<b_range_type> || Category::Vector<b_range_type>,
using b_range = typename GridFctB::Range;
static_assert( Size_v<b_range> == 1 || Size_v<b_range> == dow,
"Expression b(x) must be of scalar or vector type." );
using c_range_type = typename GridFctC::Range;
static_assert( Category::Scalar<c_range_type>,
using c_range = typename GridFctC::Range;
static_assert( Size_v<c_range> == 1,
"Expression c(x) must be of scalar type." );
using f_range_type = typename GridFctF::Range;
static_assert( Category::Scalar<f_range_type>,
using f_range = typename GridFctF::Range;
static_assert( Size_v<f_range> == 1,
"Expression f(x) must be of scalar type." );
public:
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -29,7 +29,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::test_divtrialvec, GridFct const& expr)
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -26,10 +26,11 @@ namespace AMDiS
: public GridFunctionOperatorBase<GridFunctionOperator<tag::test_gradtrial, LocalContext, GridFct>,
LocalContext, GridFct>
{
static const int dow = ContextGeometry<LocalContext>::dow;
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Vector<typename GridFct::Range>, "Expression must be of vector type." );
static_assert( Size_v<typename GridFct::Range> == dow, "Expression must be of vector type." );
public:
GridFunctionOperator(tag::test_gradtrial, GridFct const& expr)
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -32,7 +32,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::test_partialtrial tag, GridFct const& expr)
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -29,7 +29,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::testvec_gradtrial, GridFct const& expr)
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -29,7 +29,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::divtestvec_divtrialvec, GridFct const& expr)
......
......@@ -5,6 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/Size.hpp>
#include <amdis/common/ValueCategory.hpp>
namespace AMDiS
......@@ -26,11 +27,12 @@ namespace AMDiS
: public GridFunctionOperatorBase<GridFunctionOperator<tag::gradtest_gradtrial, LocalContext, GridFct>,
LocalContext, GridFct>
{
static const int dow = ContextGeometry<LocalContext>::dow;
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
using expr_value_type = typename GridFct::Range;
static_assert( Category::Scalar<expr_value_type> || Category::Matrix<expr_value_type>,
static_assert( Size_v<expr_value_type> == 1 || (Rows_v<expr_value_type> == dow && Cols_v<expr_value_type> == dow),
"Expression must be of scalar or matrix type." );
public:
......@@ -110,11 +112,11 @@ namespace AMDiS
}
}
template <class Context, class QuadratureRule, class Node, class ElementMatrix>
template <class Context, class QuadratureRule, class RowNode, class ColNode, class ElementMatrix>
void getElementMatrixOptimized(Context const& context,
QuadratureRule const& quad,
Node const& node,
Node const& /*colNode*/,
RowNode const& node,
ColNode const& /*colNode*/,
ElementMatrix& elementMatrix,
tag::scalar)
{
......@@ -163,11 +165,11 @@ namespace AMDiS
}
}
template <class Context, class QuadratureRule, class Node, class ElementMatrix>
template <class Context, class QuadratureRule, class RowNode, class ColNode, class ElementMatrix>
void getElementMatrixOptimized(Context const& context,
QuadratureRule const& quad,
Node const& node,
Node const& /*colNode*/,
RowNode const& node,
ColNode const& /*colNode*/,
ElementMatrix& elementMatrix,
tag::matrix)
{
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -33,7 +33,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::partialtest_partialtrial tag, GridFct const& expr)
......
......@@ -5,7 +5,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -29,7 +29,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, ViscosityExpr>;
static_assert( Category::Scalar<typename ViscosityExpr::Range>, "Viscosity must be of scalar type." );
static_assert( Size_v<typename ViscosityExpr::Range> == 1, "Viscosity must be of scalar type." );
public:
GridFunctionOperator(tag::stokes, ViscosityExpr const& expr)
......
......@@ -4,7 +4,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -28,7 +28,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::test, GridFct const& expr)
......
......@@ -4,7 +4,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -28,7 +28,7 @@ namespace AMDiS
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Scalar<typename GridFct::Range>, "Expression must be of scalar type." );
static_assert( Size_v<typename GridFct::Range> == 1, "Expression must be of scalar type." );
public:
GridFunctionOperator(tag::test_trial, GridFct const& expr)
......
......@@ -4,7 +4,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -25,10 +25,11 @@ namespace AMDiS
: public GridFunctionOperatorBase<GridFunctionOperator<tag::test_trialvec, LocalContext, GridFct>,
LocalContext, GridFct>
{
static const int dow = ContextGeometry<LocalContext>::dow;
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Vector<typename GridFct::Range>, "Expression must be of vector type." );
static_assert( Size_v<typename GridFct::Range> == dow, "Expression must be of vector type." );
public:
GridFunctionOperator(tag::test_trialvec, GridFct const& expr)
......@@ -79,7 +80,7 @@ namespace AMDiS
for (std::size_t k = 0; k < CHILDREN; ++k) {
const auto local_kj = colNode.child(k).localIndex(j);
elementMatrix[local_i][local_kj] += value[k];
elementMatrix[local_i][local_kj] += at(value,k);
}
}
}
......
......@@ -4,7 +4,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/common/Size.hpp>
namespace AMDiS
{
......@@ -25,10 +25,11 @@ namespace AMDiS
: public GridFunctionOperatorBase<GridFunctionOperator<tag::testvec, LocalContext, GridFct>,
LocalContext, GridFct>
{
static const int dow = ContextGeometry<LocalContext>::dow;
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
static_assert( Category::Vector<typename GridFct::Range>, "Expression must be of vector type." );
static_assert( Size_v<typename GridFct::Range> == dow, "Expression must be of vector type." );
public:
GridFunctionOperator(tag::testvec, GridFct const& expr)
......@@ -67,7 +68,7 @@ namespace AMDiS
const auto value = exprValue * (factor * shapeValues[i]);
for (std::size_t k = 0; k < CHILDREN; ++k) {
const auto local_ki = node.child(k).localIndex(i);
elementVector[local_ki] += value[k];
elementVector[local_ki] += at(value,k);
}
}
}
......
......@@ -4,6 +4,7 @@
#include <amdis/GridFunctionOperator.hpp>
#include <amdis/LocalBasisCache.hpp>
#include <amdis/common/Size.hpp>
#include <amdis/common/ValueCategory.hpp>
namespace AMDiS
......@@ -25,11 +26,12 @@ namespace AMDiS
: public GridFunctionOperatorBase<GridFunctionOperator<tag::testvec_trialvec, LocalContext, GridFct>,
LocalContext, GridFct>
{
static const int dow = ContextGeometry<LocalContext>::dow;
using Self = GridFunctionOperator;
using Super = GridFunctionOperatorBase<Self, LocalContext, GridFct>;
using expr_value_type = typename GridFct::Range;
static_assert( Category::Scalar<expr_value_type> || Category::Matrix<expr_value_type>,
static_assert( Size_v<expr_value_type> == 1 || (Rows_v<expr_value_type> == dow && Cols_v<expr_value_type> == dow),
"Expression must be of scalar or matrix type." );
public:
......
......@@ -6,17 +6,33 @@
namespace Dune
{
// forward declarations
template <class T, int N, int M>
class FieldMatrix;
template <class T, int N>
class FieldVector;
template <class T, int N, int M>
class FieldMatrix;
template <class... Ts>
class TupleVector;
template <class Row0, class... Rows>
class MultiTypeBlockMatrix;
template <class... Ts>
class MultiTypeBlockVector;
}
namespace AMDiS
{
// Get the number of elements in a tuple / pair / array / ...
//@{
// forward declarations
template <class... Rows>
class MultiTypeMatrix;
template <class... Ts>
class MultiTypeVector;
namespace Impl
{
template <class Tuple, class = void>
......@@ -42,16 +58,94 @@ namespace AMDiS
struct SizeImpl<Dune::FieldMatrix<T,N,M>>
: std::integral_constant<std::size_t, N*M> {};
template <class... Ts>
struct SizeImpl<MultiTypeVector<Ts...>>
: std::integral_constant<std::size_t, sizeof...(Ts) > {};
template <class... Ts>
struct SizeImpl<Dune::TupleVector<Ts...>>
: std::integral_constant<std::size_t, sizeof...(Ts)> {};
template <class... Ts>
struct SizeImpl<Dune::MultiTypeBlockVector<Ts...>>
: std::integral_constant<std::size_t, sizeof...(Ts)> {};
// Specialization for arithmetic types
template <class T>
struct SizeImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> >
: std::integral_constant<std::size_t, 1> {};
} // end namespace Impl
//@}
/// Get the number of elements in a tuple / pair / array / ...
template <class T>
constexpr std::size_t Size_v = Impl::SizeImpl<std::decay_t<T>>::value;
template <class T>
using Size_t = Impl::SizeImpl<std::decay_t<T>>;
namespace Impl
{
template <class Tuple, class = void>
struct RowsImpl : std::integral_constant<std::size_t, 0> {};
template <class T, int N, int M>
struct RowsImpl<Dune::FieldMatrix<T,N,M>>
: std::integral_constant<std::size_t, N> {};
template <class... Rows>
struct RowsImpl<MultiTypeMatrix<Rows...>>
: std::integral_constant<std::size_t, sizeof...(Rows) > {};
template <class... Rows>
struct RowsImpl<Dune::MultiTypeBlockMatrix<Rows...>>
: std::integral_constant<std::size_t, sizeof...(Rows)> {};
// Specialization for arithmetic types
template <class T>
struct RowsImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> >
: std::integral_constant<std::size_t, 1> {};
} // end namespace Impl
/// Get the number of rows in a fixed-size matrix
template <class T>
constexpr std::size_t Rows_v = Impl::RowsImpl<std::decay_t<T>>::value;
template <class T>
using Rows_t = Impl::RowsImpl<std::decay_t<T>>;
namespace Impl
{
template <class Tuple, class = void>
struct ColsImpl : std::integral_constant<std::size_t, 0> {};
template <class T, int N, int M>
struct ColsImpl<Dune::FieldMatrix<T,N,M>>
: std::integral_constant<std::size_t, M> {};
template <class Row0, class... Rows>
struct ColsImpl<MultiTypeMatrix<Row0, Rows...>>
: SizeImpl<Row0> {};
template <class Row0, class... Rows>
struct ColsImpl<Dune::MultiTypeBlockMatrix<Row0, Rows...>>
: SizeImpl<Row0> {};
// Specialization for arithmetic types
template <class T>
struct ColsImpl<T, std::enable_if_t<std::is_arithmetic<T>::value> >
: std::integral_constant<std::size_t, 1> {};
} // end namespace Impl
/// Get the number of columns in a fixed-size matrix
template <class T>
constexpr std::size_t Cols_v = Impl::ColsImpl<std::decay_t<T>>::value;
template <class T>
constexpr std::size_t Size = Impl::SizeImpl<std::decay_t<T>>::value;
using Cols_t = Impl::ColsImpl<std::decay_t<T>>;
} // end namespace AMDiS
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