Skip to content
Snippets Groups Projects
Commit 5cd6e870 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

add test for static-size

parent 35255bb2
No related branches found
No related tags found
1 merge request!50add static size information for Eigen matrix type
......@@ -67,12 +67,15 @@ dune_add_test(SOURCES RangeTypeTest.cpp
dune_add_test(SOURCES ResizeTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES SwitchCasesTest.cpp
dune_add_test(SOURCES StaticSizeTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES StringTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES SwitchCasesTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES TreeDataTest.cpp
LINK_LIBRARIES amdis)
......
#include <amdis/AMDiS.hpp>
#include <amdis/common/StaticSize.hpp>
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <dune/istl/multitypeblockvector.hh>
#include <dune/istl/multitypeblockmatrix.hh>
#if HAVE_EIGEN
#include <Eigen/Dense>
#endif
#include "Tests.hpp"
using namespace AMDiS;
struct Null {};
int main(int argc, char** argv)
{
Environment env(argc, argv);
static_assert(Size_v<double> == 1, "");
static_assert(Rows_v<double> == 1, "");
static_assert(Cols_v<double> == 1, "");
static_assert(Size_v<Null> == 0, "");
static_assert(Rows_v<Null> == 0, "");
static_assert(Cols_v<Null> == 0, "");
using Vec1 = Dune::FieldVector<double,2>;
using Vec2 = Dune::MultiTypeBlockVector<double,double>;
using Vec3 = std::array<double,2>;
using Vec4 = std::tuple<double,double>;
using Vec5 = Dune::TupleVector<double,double>;
static_assert(Size_v<Vec1> == 2, "");
static_assert(Size_v<Vec2> == 2, "");
static_assert(Size_v<Vec3> == 2, "");
static_assert(Size_v<Vec4> == 2, "");
static_assert(Size_v<Vec5> == 2, "");
using Mat1 = Dune::FieldMatrix<double,2,2>;
using Mat2 = Dune::MultiTypeBlockMatrix<Vec2,Vec2>;
static_assert(Rows_v<Mat1> == 2, "");
static_assert(Cols_v<Mat1> == 2, "");
static_assert(Rows_v<Mat2> == 2, "");
static_assert(Cols_v<Mat2> == 2, "");
#if HAVE_EIGEN
using Vec6 = Eigen::Vector2d;
using Vec7 = Eigen::Matrix<double,2,1>;
using Vec8 = Eigen::Matrix<double,1,2>;
static_assert(Size_v<Vec6> == 2, "");
static_assert(Size_v<Vec7> == 2, "");
static_assert(Size_v<Vec8> == 2, "");
using Mat3 = Eigen::Matrix2d;
using Mat4 = Eigen::Matrix<double,2,2>;
static_assert(Rows_v<Mat3> == 2, "");
static_assert(Cols_v<Mat3> == 2, "");
static_assert(Rows_v<Mat4> == 2, "");
static_assert(Cols_v<Mat4> == 2, "");
#endif
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment