diff --git a/dune/fufem/test/arithmetictest.cc b/dune/fufem/test/arithmetictest.cc index 9546119cba6a26f253eaf99212b39c164e05d30a..dff7195478a97304d631694319ca1e9182bf9ec3 100644 --- a/dune/fufem/test/arithmetictest.cc +++ b/dune/fufem/test/arithmetictest.cc @@ -2,7 +2,6 @@ #include "config.h" #endif -#include <cassert> #include <limits> #include <dune/common/parallel/mpihelper.hh> @@ -98,7 +97,7 @@ private: const VectorType fieldVector_x = {1,2,3}, fieldVector_y = {2,3,1}; - assert(isCloseDune(Arithmetic::crossProduct(fieldVector_x,fieldVector_y), VectorType{-7,5,-1})); + passed = passed and isCloseDune(Arithmetic::crossProduct(fieldVector_x,fieldVector_y), VectorType{-7,5,-1}); return passed; } @@ -118,9 +117,9 @@ private: const Dune::FieldVector<FT,2> fieldVector_x = {1,2}, fieldVector_y = {2,3}; - assert(isCloseAbs(Arithmetic::Axy(squareFieldMatrix_A,fieldVector_x,fieldVector_y),43)); - assert(isCloseAbs(Arithmetic::Axy(diagonalMatrix_A,fieldVector_x,fieldVector_y),18)); - assert(isCloseAbs(Arithmetic::Axy(scaledIdentityMatrix_A,fieldVector_x,fieldVector_y),16)); + passed = passed and isCloseAbs(Arithmetic::Axy(squareFieldMatrix_A,fieldVector_x,fieldVector_y),43); + passed = passed and isCloseAbs(Arithmetic::Axy(diagonalMatrix_A,fieldVector_x,fieldVector_y),18); + passed = passed and isCloseAbs(Arithmetic::Axy(scaledIdentityMatrix_A,fieldVector_x,fieldVector_y),16); return passed; } @@ -141,9 +140,9 @@ private: fieldVector_y = {2,3}, fieldVector_b = {10,13}; - assert(isCloseAbs(Arithmetic::bmAxy(squareFieldMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 16)); - assert(isCloseAbs(Arithmetic::bmAxy(diagonalMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 41)); - assert(isCloseAbs(Arithmetic::bmAxy(scaledIdentityMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 43)); + passed = passed and isCloseAbs(Arithmetic::bmAxy(squareFieldMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 16); + passed = passed and isCloseAbs(Arithmetic::bmAxy(diagonalMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 41); + passed = passed and isCloseAbs(Arithmetic::bmAxy(scaledIdentityMatrix_A, fieldVector_b, fieldVector_x, fieldVector_y), 43); return passed; } @@ -218,19 +217,19 @@ private: Arithmetic::Transposed<BCRSofRectFieldMatrix> bcrsRectFieldMatrix_At; Arithmetic::transpose(squareFieldMatrix_A,squareFieldMatrix_At); - assert(isCloseDune(squareFieldMatrix_At,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_At,squareFieldMatrix_check); Arithmetic::transpose(rectFieldMatrix_A,rectFieldMatrix_At); - assert(isCloseDune(rectFieldMatrix_At,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_At,rectFieldMatrix_check); Arithmetic::transpose(diagonalMatrix_A,diagonalMatrix_At); - assert(isCloseDune(diagonalMatrix_At,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_At,diagonalMatrix_check); Arithmetic::transpose(scaledIdentityMatrix_A,scaledIdentityMatrix_At); - assert(isCloseDune(scaledIdentityMatrix_At,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_At,scaledIdentityMatrix_check); Arithmetic::transpose(bcrsRectFieldMatrix_A,bcrsRectFieldMatrix_At); - assert(isCloseDune(bcrsRectFieldMatrix_At,bcrsRectFieldMatrix_check)); + passed = passed and isCloseDune(bcrsRectFieldMatrix_At,bcrsRectFieldMatrix_check); return passed; } @@ -259,10 +258,10 @@ private: {18, 32}}; Arithmetic::addProduct(squareFieldMatrix_a,squareFieldMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,squareFieldMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*FM { @@ -272,10 +271,10 @@ private: {6, 10}}; Arithmetic::addProduct(squareFieldMatrix_a,diagonalMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,diagonalMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += FM*DM { @@ -285,10 +284,10 @@ private: {6, 4}}; Arithmetic::addProduct(squareFieldMatrix_a,squareFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,squareFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*DM { @@ -298,10 +297,10 @@ private: {0, 2}}; Arithmetic::addProduct(squareFieldMatrix_a,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*FM { @@ -311,10 +310,10 @@ private: {6,10}}; Arithmetic::addProduct(squareFieldMatrix_a,scaledIdentityMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaledIdentityMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += FM*SM { @@ -324,10 +323,10 @@ private: {12,16}}; Arithmetic::addProduct(squareFieldMatrix_a,squareFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,squareFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*SM { @@ -337,10 +336,10 @@ private: { 0, 8}}; Arithmetic::addProduct(squareFieldMatrix_a,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*SM { @@ -350,10 +349,10 @@ private: { 0, 8}}; Arithmetic::addProduct(squareFieldMatrix_a,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*DM { @@ -363,10 +362,10 @@ private: { 0, 2}}; Arithmetic::addProduct(squareFieldMatrix_a,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += DM*DM { @@ -375,10 +374,10 @@ private: diagonalMatrix_check = {6, 2}; Arithmetic::addProduct(diagonalMatrix_a,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += DM*SM { @@ -387,10 +386,10 @@ private: diagonalMatrix_check = {12, 8}; Arithmetic::addProduct(diagonalMatrix_a,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += SM*DM { @@ -399,10 +398,10 @@ private: diagonalMatrix_check = {4, 2}; Arithmetic::addProduct(diagonalMatrix_a,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += SM*SM { @@ -411,10 +410,10 @@ private: diagonalMatrix_check = {8, 8}; Arithmetic::addProduct(diagonalMatrix_a,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += SM*SM @@ -424,10 +423,10 @@ private: scaledIdentityMatrix_check(8); Arithmetic::addProduct(scaledIdentityMatrix_a,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } // Extra test: SM += a*SM*SM @@ -438,11 +437,11 @@ private: Arithmetic::addProduct(scaledIdentityMatrix_a,2,scaledIdentityMatrix_b,scaledIdentityMatrix_c); Arithmetic::addProduct(scaledIdentityMatrix_a,-1,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,2,scaledIdentityMatrix_b,scaledIdentityMatrix_c); Arithmetic::addProduct(scaledIdentityMatrix_check,1,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } //RECTANGULAR MATRICES @@ -462,10 +461,10 @@ private: {16,39,28,50}}; Arithmetic::addProduct(rectFieldMatrix_a,rectFieldMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,rectFieldMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<2,4> += DM<2>*FM<2,4> { @@ -475,10 +474,10 @@ private: { 2, 8, 6,10}}; Arithmetic::addProduct(rectFieldMatrix_a,diagonalMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,diagonalMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<3,2> += FM<3,2>*DM<2> { @@ -489,10 +488,10 @@ private: {10, 6}}; Arithmetic::addProduct(rectFieldMatrix_a,rectFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,rectFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<2,4> += SM<2>*FM<2,4> { @@ -502,10 +501,10 @@ private: { 2, 8, 6,10}}; Arithmetic::addProduct(rectFieldMatrix_a,scaledIdentityMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaledIdentityMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<3,2> += FM<3,2>*SM<2> { @@ -516,10 +515,10 @@ private: {20,24}}; Arithmetic::addProduct(rectFieldMatrix_a,rectFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,rectFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } return passed; } @@ -547,10 +546,10 @@ private: {6,10}}; Arithmetic::addProduct(squareFieldMatrix_a,scalar_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scalar_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += scalar*DM { @@ -560,10 +559,10 @@ private: { 0, 2}}; Arithmetic::addProduct(squareFieldMatrix_a,scalar_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scalar_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += scalar*SM { @@ -573,10 +572,10 @@ private: { 0, 8}}; Arithmetic::addProduct(squareFieldMatrix_a,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += scalar*DM { @@ -585,10 +584,10 @@ private: diagonalMatrix_check = {4, 2}; Arithmetic::addProduct(diagonalMatrix_a,scalar_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scalar_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += scalar*SM { @@ -597,10 +596,10 @@ private: diagonalMatrix_check = {8, 8}; Arithmetic::addProduct(diagonalMatrix_a,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += scalar*SM { @@ -609,10 +608,10 @@ private: scaledIdentityMatrix_check(8); Arithmetic::addProduct(scaledIdentityMatrix_a,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } //RECTANGULAR MATRICES @@ -627,10 +626,10 @@ private: { 2, 8, 6,10}}; Arithmetic::addProduct(rectFieldMatrix_a,scalar_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scalar_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } // and again for fixed scalar type double @@ -643,10 +642,10 @@ private: {6,10}}; Arithmetic::addProduct(squareFieldMatrix_a,double_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,double_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += double*DM { @@ -656,10 +655,10 @@ private: { 0, 2}}; Arithmetic::addProduct(squareFieldMatrix_a,double_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,double_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += double*SM { @@ -669,10 +668,10 @@ private: { 0, 8}}; Arithmetic::addProduct(squareFieldMatrix_a,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += double*DM { @@ -681,10 +680,10 @@ private: diagonalMatrix_check = {4, 2}; Arithmetic::addProduct(diagonalMatrix_a,double_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,double_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += double*SM { @@ -693,10 +692,10 @@ private: diagonalMatrix_check = {8, 8}; Arithmetic::addProduct(diagonalMatrix_a,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += double*SM { @@ -705,10 +704,10 @@ private: scaledIdentityMatrix_check(8); Arithmetic::addProduct(scaledIdentityMatrix_a,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } //RECTANGULAR MATRICES @@ -720,10 +719,10 @@ private: { 2, 8, 6,10}}; Arithmetic::addProduct(rectFieldMatrix_a,double_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,double_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //BLOCKED MATRICES of RECTANGULAR MATRICES @@ -753,10 +752,10 @@ private: bcrsRectFieldMatrix_a = bcrsRectFieldMatrix_zero = 0; Arithmetic::addProduct(bcrsRectFieldMatrix_a,scalar_b,bcrsRectFieldMatrix_c); - assert(isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_a)); + passed = passed and isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_a); Arithmetic::subtractProduct(bcrsRectFieldMatrix_check,scalar_b,bcrsRectFieldMatrix_c); - assert(isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_zero)); + passed = passed and isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_zero); } //BLOCKED MATRICES of DIAGONAL MATRICES @@ -785,20 +784,20 @@ private: bcrsDiagonalMatrix_a = 0; Arithmetic::addProduct(bcrsDiagonalMatrix_a,scalar_b,bcrsDiagonalMatrix_c); - assert(isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a)); + passed = passed and isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a); Arithmetic::subtractProduct(bcrsDiagonalMatrix_a,scalar_b,bcrsDiagonalMatrix_c); Arithmetic::addProduct(bcrsDiagonalMatrix_a,scalar_b,bcrsDiagonalMatrix_c); - assert(isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a)); + passed = passed and isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a); Arithmetic::addProduct(bcrsDiagonalMatrix_a,2.0,scalar_b,bcrsDiagonalMatrix_c); Arithmetic::subtractProduct(bcrsDiagonalMatrix_a,scalar_b,bcrsDiagonalMatrix_c); Arithmetic::subtractProduct(bcrsDiagonalMatrix_a,scalar_b,bcrsDiagonalMatrix_c); - assert(isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a)); + passed = passed and isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a); Arithmetic::addProduct(bcrsDiagonalMatrix_a,2.0,scalar_b,bcrsDiagonalMatrix_c); Arithmetic::subtractProduct(bcrsDiagonalMatrix_a,2.0,scalar_b,bcrsDiagonalMatrix_c); - assert(isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a)); + passed = passed and isCloseDune(bcrsDiagonalMatrix_check,bcrsDiagonalMatrix_a); } // BLOCKED MATRICES of ARBITRARY MATRIX but with differing index sets - what do we expect?! @@ -828,10 +827,10 @@ private: fieldVector_check = { 8, 20}; Arithmetic::addProduct(fieldVector_a,squareFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,squareFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += DM*FV { @@ -839,10 +838,10 @@ private: fieldVector_check = {12, 4}; Arithmetic::addProduct(fieldVector_a,diagonalMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,diagonalMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += SM*FV { @@ -850,10 +849,10 @@ private: fieldVector_check = {8, 4}; Arithmetic::addProduct(fieldVector_a,scaledIdentityMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaledIdentityMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } } @@ -869,10 +868,10 @@ private: fieldVector_check = { 8,20,32}; Arithmetic::addProduct(fieldVector_a,rectFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,rectFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,Dune::FieldVector<FT,3>(0))); + passed = passed and isCloseDune(fieldVector_check,Dune::FieldVector<FT,3>(0)); } return passed; @@ -895,10 +894,10 @@ private: fieldVector_check = { 8, 4}; Arithmetic::addProduct(fieldVector_a,scalar_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scalar_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += double*FV { @@ -907,10 +906,10 @@ private: fieldVector_check = { 8, 4}; Arithmetic::addProduct(fieldVector_a,double_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,double_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } return passed; @@ -934,10 +933,10 @@ private: scalar_check = 6; Arithmetic::addProduct(scalar_a,scalar_b,scalar_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scalar_b,scalar_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += double*scalar { @@ -946,10 +945,10 @@ private: scalar_check = 6; Arithmetic::addProduct(scalar_a,double_b,scalar_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,double_b,scalar_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += scalar*double { @@ -958,10 +957,10 @@ private: scalar_check = 6; Arithmetic::addProduct(scalar_a,scalar_b,double_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scalar_b,double_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += double*double { @@ -970,10 +969,10 @@ private: scalar_check = 6; Arithmetic::addProduct(scalar_a,double_b,double_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,double_b,double_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case double += double*double { @@ -982,10 +981,10 @@ private: double_check = 6; Arithmetic::addProduct(double_a,double_b,double_c); - assert(isCloseAbs(double_a, double_check)); + passed = passed and isCloseAbs(double_a, double_check); Arithmetic::subtractProduct(double_check,double_b,double_c); - assert(isCloseAbs(double_check, ResultType(0))); + passed = passed and isCloseAbs(double_check, ResultType(0)); } return passed; @@ -1017,10 +1016,10 @@ private: {36, 64}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,squareFieldMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,squareFieldMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*FM { @@ -1030,10 +1029,10 @@ private: {12,20}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,diagonalMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,diagonalMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += FM*DM { @@ -1043,10 +1042,10 @@ private: {12, 8}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,squareFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,squareFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*DM { @@ -1056,10 +1055,10 @@ private: { 0, 4}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*FM { @@ -1069,10 +1068,10 @@ private: {12,20}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scaledIdentityMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scaledIdentityMatrix_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += FM*SM { @@ -1082,10 +1081,10 @@ private: {24,32}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,squareFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,squareFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*SM { @@ -1095,10 +1094,10 @@ private: { 0,16}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += DM*SM { @@ -1108,10 +1107,10 @@ private: { 0,16}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += SM*DM { @@ -1121,10 +1120,10 @@ private: { 0, 4}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += DM*DM { @@ -1133,10 +1132,10 @@ private: diagonalMatrix_check = {12, 4}; Arithmetic::addProduct(diagonalMatrix_a,scaling,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,diagonalMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += DM*SM { @@ -1145,10 +1144,10 @@ private: diagonalMatrix_check = {24,16}; Arithmetic::addProduct(diagonalMatrix_a,scaling,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,diagonalMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += SM*DM { @@ -1157,10 +1156,10 @@ private: diagonalMatrix_check = {8,4}; Arithmetic::addProduct(diagonalMatrix_a,scaling,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,scaledIdentityMatrix_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += SM*SM { @@ -1169,10 +1168,10 @@ private: diagonalMatrix_check = {16,16}; Arithmetic::addProduct(diagonalMatrix_a,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += SM*SM { @@ -1181,10 +1180,10 @@ private: scaledIdentityMatrix_check(16); Arithmetic::addProduct(scaledIdentityMatrix_a,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,scaling,scaledIdentityMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } @@ -1205,10 +1204,10 @@ private: {32,78,56,100}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,rectFieldMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,rectFieldMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<2,4> += DM<2>*FM<2,4> { @@ -1218,10 +1217,10 @@ private: { 4,16,12,20}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,diagonalMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,diagonalMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<3,2> += FM<3,2>*DM<2> { @@ -1232,10 +1231,10 @@ private: {20,12}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,rectFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,rectFieldMatrix_b,diagonalMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<2,4> += SM<2>*FM<2,4> { @@ -1245,10 +1244,10 @@ private: { 4,16,12,20}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,scaledIdentityMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,scaledIdentityMatrix_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //case FM<3,2> += FM<3,2>*SM<2> { @@ -1259,10 +1258,10 @@ private: {40,48}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,rectFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,rectFieldMatrix_b,scaledIdentityMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } return passed; } @@ -1291,10 +1290,10 @@ private: {12,20}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scalar_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scalar_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += scalar*DM { @@ -1304,10 +1303,10 @@ private: { 0, 4}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scalar_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scalar_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += scalar*SM { @@ -1317,10 +1316,10 @@ private: { 0,16}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += scalar*DM { @@ -1329,10 +1328,10 @@ private: diagonalMatrix_check = {8, 4}; Arithmetic::addProduct(diagonalMatrix_a,scaling,scalar_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,scalar_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += scalar*SM { @@ -1341,10 +1340,10 @@ private: diagonalMatrix_check = {16,16}; Arithmetic::addProduct(diagonalMatrix_a,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += scalar*SM { @@ -1353,10 +1352,10 @@ private: scaledIdentityMatrix_check(16); Arithmetic::addProduct(scaledIdentityMatrix_a,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,scaling,scalar_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } //RECTANGULAR MATRICES @@ -1371,10 +1370,10 @@ private: { 4,16,12,20}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,scalar_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,scalar_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } // and again for fixed scalar type double @@ -1387,10 +1386,10 @@ private: {12,20}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,double_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,double_b,squareFieldMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += double*DM { @@ -1400,10 +1399,10 @@ private: { 0, 4}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,double_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,double_b,diagonalMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case FM += double*SM { @@ -1413,10 +1412,10 @@ private: { 0,16}}; Arithmetic::addProduct(squareFieldMatrix_a,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check)); + passed = passed and isCloseDune(squareFieldMatrix_a,squareFieldMatrix_check); Arithmetic::subtractProduct(squareFieldMatrix_check,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(squareFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(squareFieldMatrix_check,ResultType(0)); } //case DM += double*DM { @@ -1425,10 +1424,10 @@ private: diagonalMatrix_check = {8,4}; Arithmetic::addProduct(diagonalMatrix_a,scaling,double_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,double_b,diagonalMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case DM += double*SM { @@ -1437,10 +1436,10 @@ private: diagonalMatrix_check = {16,16}; Arithmetic::addProduct(diagonalMatrix_a,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_a,diagonalMatrix_check)); + passed = passed and isCloseDune(diagonalMatrix_a,diagonalMatrix_check); Arithmetic::subtractProduct(diagonalMatrix_check,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(diagonalMatrix_check,ResultType(0))); + passed = passed and isCloseDune(diagonalMatrix_check,ResultType(0)); } //case SM += double*SM { @@ -1449,10 +1448,10 @@ private: scaledIdentityMatrix_check(16); Arithmetic::addProduct(scaledIdentityMatrix_a,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check)); + passed = passed and isCloseDune(scaledIdentityMatrix_a,scaledIdentityMatrix_check); Arithmetic::subtractProduct(scaledIdentityMatrix_check,scaling,double_b,scaledIdentityMatrix_c); - assert(isCloseDune(scaledIdentityMatrix_check,ResultType(0))); + passed = passed and isCloseDune(scaledIdentityMatrix_check,ResultType(0)); } //RECTANGULAR MATRICES @@ -1464,10 +1463,10 @@ private: { 4,16,12,20}}; Arithmetic::addProduct(rectFieldMatrix_a,scaling,double_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check)); + passed = passed and isCloseDune(rectFieldMatrix_a,rectFieldMatrix_check); Arithmetic::subtractProduct(rectFieldMatrix_check,scaling,double_b,rectFieldMatrix_c); - assert(isCloseDune(rectFieldMatrix_check,ResultType(0))); + passed = passed and isCloseDune(rectFieldMatrix_check,ResultType(0)); } //BLOCKED MATRICES @@ -1497,10 +1496,10 @@ private: bcrsRectFieldMatrix_a = bcrsRectFieldMatrix_zero = 0; Arithmetic::addProduct(bcrsRectFieldMatrix_a,scaling,scalar_b,bcrsRectFieldMatrix_c); - assert(isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_a)); + passed = passed and isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_a); Arithmetic::subtractProduct(bcrsRectFieldMatrix_check,scaling,scalar_b,bcrsRectFieldMatrix_c); - assert(isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_zero)); + passed = passed and isCloseDune(bcrsRectFieldMatrix_check,bcrsRectFieldMatrix_zero); } return passed; } @@ -1529,10 +1528,10 @@ private: fieldVector_check = {16,40}; Arithmetic::addProduct(fieldVector_a,scaling,squareFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,squareFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += DM*FV { @@ -1540,10 +1539,10 @@ private: fieldVector_check = {24, 8}; Arithmetic::addProduct(fieldVector_a,scaling,diagonalMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,diagonalMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += SM*FV { @@ -1551,10 +1550,10 @@ private: fieldVector_check = {16,8}; Arithmetic::addProduct(fieldVector_a,scaling,scaledIdentityMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,scaledIdentityMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } } @@ -1570,10 +1569,10 @@ private: fieldVector_check = {16,40,64}; Arithmetic::addProduct(fieldVector_a,scaling,rectFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,rectFieldMatrix_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,Dune::FieldVector<FT,3>(0))); + passed = passed and isCloseDune(fieldVector_check,Dune::FieldVector<FT,3>(0)); } return passed; @@ -1597,10 +1596,10 @@ private: fieldVector_check = {16, 8}; Arithmetic::addProduct(fieldVector_a,scaling,scalar_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,scalar_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } //case FV += double*FV { @@ -1609,10 +1608,10 @@ private: fieldVector_check = {16, 8}; Arithmetic::addProduct(fieldVector_a,scaling,double_b,fieldVector_c); - assert(isCloseDune(fieldVector_a,fieldVector_check)); + passed = passed and isCloseDune(fieldVector_a,fieldVector_check); Arithmetic::subtractProduct(fieldVector_check,scaling,double_b,fieldVector_c); - assert(isCloseDune(fieldVector_check,ResultType(0))); + passed = passed and isCloseDune(fieldVector_check,ResultType(0)); } return passed; @@ -1638,10 +1637,10 @@ private: scalar_check = 12; Arithmetic::addProduct(scalar_a,scaling,scalar_b,scalar_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scaling,scalar_b,scalar_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += double*scalar { @@ -1650,10 +1649,10 @@ private: scalar_check = 12; Arithmetic::addProduct(scalar_a,scaling,double_b,scalar_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scaling,double_b,scalar_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += scalar*double { @@ -1662,10 +1661,10 @@ private: scalar_check = 12; Arithmetic::addProduct(scalar_a,scaling,scalar_b,double_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scaling,scalar_b,double_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case scalar += double*double { @@ -1674,10 +1673,10 @@ private: scalar_check = 12; Arithmetic::addProduct(scalar_a,scaling,double_b,double_c); - assert(isCloseAbs(scalar_a, scalar_check)); + passed = passed and isCloseAbs(scalar_a, scalar_check); Arithmetic::subtractProduct(scalar_check,scaling,double_b,double_c); - assert(isCloseAbs(scalar_check, ResultType(0))); + passed = passed and isCloseAbs(scalar_check, ResultType(0)); } //case double += double*double { @@ -1686,10 +1685,10 @@ private: double_check = 12; Arithmetic::addProduct(double_a,scaling,double_b,double_c); - assert(isCloseAbs(double_a, double_check)); + passed = passed and isCloseAbs(double_a, double_check); Arithmetic::subtractProduct(double_check,scaling,double_b,double_c); - assert(isCloseAbs(double_check, ResultType(0))); + passed = passed and isCloseAbs(double_check, ResultType(0)); } return passed; @@ -1766,9 +1765,7 @@ private: Arithmetic::addProduct(B, b, A); - assert(isCloseDune(B,C)); - - return true; + return isCloseDune(B,C); } }; diff --git a/dune/fufem/test/common.hh b/dune/fufem/test/common.hh index d92b591ba03a7248d8bb07a9ecd09475c8cee6ae..79bb052d18518ebc39f7356435ff267d5e4f50b8 100644 --- a/dune/fufem/test/common.hh +++ b/dune/fufem/test/common.hh @@ -381,7 +381,7 @@ bool checkWithSubGrid(TestSuite& suite, int uniformRefinements, int localRefinem grid.createEnd(); /* make sure these requirements are met */ - assert(grid.size(0)!=hostgrid.size(0)); + passed = passed and grid.size(0)!=hostgrid.size(0); std::cout << "Running test on " << name << " with " << grid.size(0) << " elements." << std::endl; diff --git a/dune/fufem/test/functionspacebasistest.cc b/dune/fufem/test/functionspacebasistest.cc index 85dfa5d445825de29a4d31e25ee74986b34e2c90..f4e788afee8dea366c403f267d6e38292ffb9394 100644 --- a/dune/fufem/test/functionspacebasistest.cc +++ b/dune/fufem/test/functionspacebasistest.cc @@ -45,8 +45,9 @@ struct CoordinateFunction struct FunctionSpaceBasisTestSuite { template <class NodalBasisType> - void testNodalBasis(const NodalBasisType& nodalBasis) + bool testNodalBasis(const NodalBasisType& nodalBasis) { + bool passed = true; std::cout << "Testing " << className<NodalBasisType>() << std::endl; typedef typename NodalBasisType::LocalFiniteElement LocalFiniteElementType; @@ -93,54 +94,56 @@ struct FunctionSpaceBasisTestSuite indexMap.insert(std::make_pair(idx, worldPos)); } else { double dist = (brother->second - worldPos).two_norm(); - assert (dist < 1e-4); - + passed = passed and dist < 1e-4; } } } // At this point the index map must contain each Lagrange node exactly once. - assert(indexMap.size() == nodalBasis.size()); + passed = passed and indexMap.size() == nodalBasis.size(); + return passed; } template <class GridType> bool check(const GridType& grid) { + bool passed = true; typedef typename GridType::LeafGridView LeafView; const LeafView &leafView = grid.leafGridView(); // Test the first-order basis P1NodalBasis<LeafView> p1NodalBasis(leafView); - testNodalBasis(p1NodalBasis); + passed = passed and testNodalBasis(p1NodalBasis); // Test the second-order basis P2NodalBasis<LeafView> p2NodalBasis(leafView); - testNodalBasis(p2NodalBasis); + passed = passed and testNodalBasis(p2NodalBasis); DuneFunctionsBasis<typename Functions::PQ1NodalBasis<LeafView> > fufemFunctionsPQ1NodalBasis(leafView); - testNodalBasis(fufemFunctionsPQ1NodalBasis); + passed = passed and testNodalBasis(fufemFunctionsPQ1NodalBasis); DuneFunctionsBasis<typename Functions::PQkNodalBasis<LeafView,1> > fufemFunctionsPQk1NodalBasis(leafView); - testNodalBasis(fufemFunctionsPQk1NodalBasis); + passed = passed and testNodalBasis(fufemFunctionsPQk1NodalBasis); DuneFunctionsBasis<typename Functions::PQkNodalBasis<LeafView,2> > fufemFunctionsPQk2NodalBasis(leafView); - testNodalBasis(fufemFunctionsPQk2NodalBasis); + passed = passed and testNodalBasis(fufemFunctionsPQk2NodalBasis); try { DuneFunctionsBasis<typename Functions::PQkNodalBasis<LeafView,3> > fufemFunctionsPQk3NodalBasis(leafView); - testNodalBasis(fufemFunctionsPQk3NodalBasis); + passed = passed and testNodalBasis(fufemFunctionsPQk3NodalBasis); } catch (Dune::NotImplemented e) { std::cout << e << std::endl; } - return true; + return passed; } }; int main(int argc, char* argv[]) { + bool passed = true; Dune::MPIHelper::instance(argc, argv); FunctionSpaceBasisTestSuite testsuite; @@ -148,10 +151,10 @@ int main(int argc, char* argv[]) // Create a 1d test grid OneDGrid grid1d(5, 0.0, 1.0); - testsuite.check(grid1d); + passed = passed and testsuite.check(grid1d); - checkWithStandardAdaptiveGrids(testsuite); - checkWithStandardStructuredGrids(testsuite); + passed = passed and checkWithStandardAdaptiveGrids(testsuite); + passed = passed and checkWithStandardStructuredGrids(testsuite); #if 0 // Create a 2d test grid @@ -164,7 +167,7 @@ int main(int argc, char* argv[]) FieldVector<double,2>(1), elements2d); - testAllOrders(grid2d->leafGridView()); + passed = passed and testAllOrders(grid2d->leafGridView()); // Create a 3d test grid array<unsigned int,3> elements3d; @@ -173,7 +176,7 @@ int main(int argc, char* argv[]) FieldVector<double,3>(1), elements3d); - testAllOrders(grid3d->leafGridView()); + passed = passed and testAllOrders(grid3d->leafGridView()); #endif - + return passed ? 0 : 1; } diff --git a/dune/fufem/test/gridfunctiontest.cc b/dune/fufem/test/gridfunctiontest.cc index c2367fb125c66e4030514b6a1857123478e93d73..7d6dc31f93e625cfe40af6c64bb10e97c60391c9 100644 --- a/dune/fufem/test/gridfunctiontest.cc +++ b/dune/fufem/test/gridfunctiontest.cc @@ -32,7 +32,7 @@ class TestGridFunction: virtual void evaluateLocal(const Element& e, const DomainType& x, RangeType& y) const { - assert(isDefinedOn(e)); + passed = passed and isDefinedOn(e); y=0.0; DomainType xg = e.geometry().global(x); @@ -42,7 +42,7 @@ class TestGridFunction: virtual void evaluateDerivativeLocal(const Element& e, const DomainType& x, DerivativeType& d) const { - assert(isDefinedOn(e)); + passed = passed and isDefinedOn(e); d=0.0; DomainType xg = e.geometry().global(x); @@ -58,6 +58,7 @@ class TestGridFunction: return (xmax<=0.5 and e.isLeaf()); } + bool mutable passed = true; }; template <class GridViewType> @@ -78,7 +79,7 @@ class TestGridViewFunction: virtual void evaluateLocal(const Element& e, const DomainType& x, RangeType& y) const { - assert(this->isDefinedOn(e)); + passed = passed and this->isDefinedOn(e); y=0.0; DomainType xg = e.geometry().global(x); @@ -88,17 +89,19 @@ class TestGridViewFunction: virtual void evaluateDerivativeLocal(const Element& e, const DomainType& x, DerivativeType& d) const { - assert(this->isDefinedOn(e)); + passed = passed and this->isDefinedOn(e); d=0.0; DomainType xg = e.geometry().global(x); for (int i=0; i<GridViewType::dimension; ++i) d[0][i] = cos(xg[i]); } + bool mutable passed = true; }; int main(int argc, char** argv) { + bool passed = true; Dune::MPIHelper::instance(argc, argv); std::cout << "This is GridFunctionTest v0.01" << std::endl; @@ -185,7 +188,7 @@ int main(int argc, char** argv) } } } - + passed = passed and testgridfunction.passed; } /* Tests for VirtualGridViewFunction */ @@ -221,7 +224,7 @@ int main(int argc, char** argv) if (testleafgridviewfunction.isDefinedOn(*elt)) { // test isDefinedOn default implementation - assert(elt->isLeaf()); + passed = passed and elt->isLeaf(); // test evaluate evaluateDerivative default implementations testleafgridviewfunction.evaluateLocal(*elt,xlocal,flocal); @@ -245,12 +248,12 @@ int main(int argc, char** argv) } else // test isDefinedOn default implementation - assert(not(elt->isLeaf())); + passed = passed and not(elt->isLeaf()); if (testlevelgridviewfunction.isDefinedOn(*elt)) { // test isDefinedOn default implementation - assert(elt->level()==LEVEL); + passed = passed and elt->level()==LEVEL; // test evaluate evaluateDerivative default implementations testlevelgridviewfunction.evaluateLocal(*elt,xlocal,fflocal); @@ -274,13 +277,14 @@ int main(int argc, char** argv) } else // test isDefinedOn default implementation - assert(elt->level()!=LEVEL); + passed = passed and elt->level()!=LEVEL; } } - + passed = passed and testlevelgridviewfunction.passed; } /* Tests for VirtualGridViewFunction */ + return passed ? 0 : 1; } diff --git a/dune/fufem/test/laplaceassemblertest.cc b/dune/fufem/test/laplaceassemblertest.cc index 78beab2b7c5fa2631eb8c4b1ea314ce8d3c38d6f..a372367b3ed28aeb2f76ac993f236fc1b4cfe181 100644 --- a/dune/fufem/test/laplaceassemblertest.cc +++ b/dune/fufem/test/laplaceassemblertest.cc @@ -19,6 +19,7 @@ using namespace Dune; int main (int argc, char *argv[]) { + bool passed = true; Dune::MPIHelper::instance(argc, argv); // Build a test grid @@ -52,7 +53,7 @@ int main (int argc, char *argv[]) // All rows belonging to non-boundary vertices should be zero for (size_t i=0; i<h1Matrix.N(); i++) if (not (*boundary.getVertices())[i][0]) - assert( h1Matrix[i].infinity_norm() < 1e-6 ); + passed = passed and h1Matrix[i].infinity_norm() < 1e-6; // Constant vectors are in the kernel typedef BlockVector<FieldVector<double,1> > VectorType; @@ -61,6 +62,6 @@ int main (int argc, char *argv[]) VectorType zero(h1Matrix.N()); h1Matrix.mv(constantVector,zero); - assert(zero.infinity_norm() < 1e-6); - + passed = passed and zero.infinity_norm() < 1e-6; + return passed ? 0 : 1; } diff --git a/dune/fufem/test/makerefinedsimplexgeometrytest.cc b/dune/fufem/test/makerefinedsimplexgeometrytest.cc index b8dd0d8b8e12e8fcda93c33dd45c893da0acaa81..56dac39610ba87769d4ad559ad24c6ac6fe1942d 100644 --- a/dune/fufem/test/makerefinedsimplexgeometrytest.cc +++ b/dune/fufem/test/makerefinedsimplexgeometrytest.cc @@ -2,7 +2,6 @@ #include "config.h" #endif -#include <cassert> #include <limits> #include <dune/common/exceptions.hh> @@ -35,6 +34,7 @@ class MakeRefinedSimplexGeometryTestSuite bool check_makeRefinedSimplexGeometry() { + bool passed = true; #if HAVE_DUNE_ALUGRID typedef Dune::ALUGrid<2,3,Dune::simplex, Dune::conforming> GridType; @@ -71,24 +71,32 @@ class MakeRefinedSimplexGeometryTestSuite { WorldCoords testPoint{-sqrt_two/4, 0 , sqrt_two/2}, sollResult(testPoint); sollResult /= testPoint.two_norm(); - assert(isCloseDune(sollResult, refinedGeometry.global(LocalCoords{0,0.5}))); + passed = passed and + isCloseDune(sollResult, + refinedGeometry.global(LocalCoords{0, 0.5})); } { WorldCoords testPoint{sqrt_two/8, sqrt_six/8 , sqrt_two/2}, sollResult(testPoint); sollResult /= testPoint.two_norm(); - assert(isCloseDune(sollResult, refinedGeometry.global(LocalCoords{0.5,0.5}))); + passed = passed and + isCloseDune(sollResult, + refinedGeometry.global(LocalCoords{0.5, 0.5})); } { WorldCoords testPoint{sqrt_two/8, -sqrt_six/8 , sqrt_two/2}, sollResult(testPoint); sollResult /= testPoint.two_norm(); - assert(isCloseDune(sollResult, refinedGeometry.global(LocalCoords{0.5,0}))); + passed = passed and + isCloseDune(sollResult, + refinedGeometry.global(LocalCoords{0.5, 0})); WorldCoords testPoint2{0, 0 , sqrt_two/2}, sollResult2(sollResult); sollResult2[0] = sollResult2[1] = 0; - assert(isCloseDune(sollResult2, refinedGeometry.global(LocalCoords{1.0/3.0,1.0/3.0}))); + passed = passed and isCloseDune(sollResult2, + refinedGeometry.global(LocalCoords{ + 1.0 / 3.0, 1.0 / 3.0})); } #endif - return true; + return passed; } diff --git a/dune/fufem/test/refinedsimplexgeometrytest.cc b/dune/fufem/test/refinedsimplexgeometrytest.cc index d4432285755ac9e60d3fc4b225d69b40cf77594c..9c62797c21435c261451200ca9571214a55e4e76 100644 --- a/dune/fufem/test/refinedsimplexgeometrytest.cc +++ b/dune/fufem/test/refinedsimplexgeometrytest.cc @@ -2,7 +2,6 @@ #include "config.h" #endif -#include <cassert> #include <limits> #include <dune/common/exceptions.hh> @@ -61,8 +60,7 @@ class RefinedSimplexGeometryTestSuite bool check_affine() { - assert(not testGeometry.affine()); - return true; + return not testGeometry.affine(); } bool check_type() @@ -78,23 +76,21 @@ class RefinedSimplexGeometryTestSuite type_throws_NotImplemented= true; } - assert(type_throws_NotImplemented); - return type_throws_NotImplemented; } bool check_corners() { - assert(testGeometry.corners() == 6); - return true; + return testGeometry.corners() == 6; } bool check_corner() { + bool passed = true; for (int i=0; i<6; ++i) - assert(isCloseDune(testGeometry.corner(i),vertices[i])); + passed = passed and isCloseDune(testGeometry.corner(i),vertices[i]); - return true; + return passed; } bool check_center() @@ -108,28 +104,25 @@ class RefinedSimplexGeometryTestSuite { center_throws_NotImplemented= true; } - - assert(center_throws_NotImplemented); - return center_throws_NotImplemented; } bool check_global() { - assert(isCloseDune(testGeometry.global(LocalCoords{0.0, 0.0}),vertices[0])); - assert(isCloseDune(testGeometry.global(LocalCoords{1.0, 0.0}),vertices[1])); - assert(isCloseDune(testGeometry.global(LocalCoords{0.0, 1.0}),vertices[2])); - assert(isCloseDune(testGeometry.global(LocalCoords{0.5, 0.0}),vertices[3])); - assert(isCloseDune(testGeometry.global(LocalCoords{0.5, 0.5}),vertices[5])); - assert(isCloseDune(testGeometry.global(LocalCoords{0.0, 0.5}),vertices[4])); - - assert(isCloseDune(testGeometry.global(LocalCoords{1.0/6.0, 1.0/6.0}),WorldCoords{2.0, 5.0/3.0, 1.0/3.0})); - assert(isCloseDune(testGeometry.global(LocalCoords{4.0/6.0, 1.0/6.0}),WorldCoords{11.0/3.0, 4.0/3.0, 1.0/3.0})); - assert(isCloseDune(testGeometry.global(LocalCoords{2.0/6.0, 2.0/6.0}),WorldCoords{8.0/3.0, 2.0, -1.0/3.0})); - assert(isCloseDune(testGeometry.global(LocalCoords{1.0/6.0, 4.0/6.0}),WorldCoords{2.5, 7.0/3.0, -1.0})); - - - return true; + bool passed = true; + passed = passed and isCloseDune(testGeometry.global(LocalCoords{0.0, 0.0}),vertices[0]); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{1.0, 0.0}),vertices[1]); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{0.0, 1.0}),vertices[2]); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{0.5, 0.0}),vertices[3]); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{0.5, 0.5}),vertices[5]); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{0.0, 0.5}),vertices[4]); + + passed = passed and isCloseDune(testGeometry.global(LocalCoords{1.0/6.0, 1.0/6.0}),WorldCoords{2.0, 5.0/3.0, 1.0/3.0}); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{4.0/6.0, 1.0/6.0}),WorldCoords{11.0/3.0, 4.0/3.0, 1.0/3.0}); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{2.0/6.0, 2.0/6.0}),WorldCoords{8.0/3.0, 2.0, -1.0/3.0}); + passed = passed and isCloseDune(testGeometry.global(LocalCoords{1.0/6.0, 4.0/6.0}),WorldCoords{2.5, 7.0/3.0, -1.0}); + + return passed; } bool check_local() @@ -144,9 +137,6 @@ class RefinedSimplexGeometryTestSuite { local_throws_NotImplemented= true; } - - assert(local_throws_NotImplemented); - return local_throws_NotImplemented; } @@ -162,37 +152,36 @@ class RefinedSimplexGeometryTestSuite { volume_throws_NotImplemented= true; } - - assert(volume_throws_NotImplemented); - return volume_throws_NotImplemented; } bool check_integrationElement() { + bool passed = true; for (std::size_t i=0; i<4; ++i) - assert(isCloseAbs(testGeometry.integrationElement(testCoords[i]),integrationElement[i])); + passed = passed and isCloseAbs(testGeometry.integrationElement(testCoords[i]),integrationElement[i]); - return true; + return passed; } bool check_jacobianTransposed() { + bool passed = true; for (std::size_t i=0; i<4; ++i) - assert(isCloseDune(testGeometry.jacobianTransposed(testCoords[i]),jacobianTransposed[i])); + passed = passed and isCloseDune(testGeometry.jacobianTransposed(testCoords[i]),jacobianTransposed[i]); - return true; + return passed; } bool check_jacobianInverseTransposed() { + bool passed = true; for (std::size_t i=0; i<4; ++i) { auto jit = testGeometry.jacobianInverseTransposed(testCoords[i]); - assert(isCloseDune(static_cast<JacobianInverseTransposedBase&>(jit),jacobianInverseTransposed[i])); + passed = passed and isCloseDune(static_cast<JacobianInverseTransposedBase&>(jit),jacobianInverseTransposed[i]); } - - return true; + return passed; } diff --git a/dune/fufem/test/staticmatrixtoolstest.cc b/dune/fufem/test/staticmatrixtoolstest.cc index 1b06d502032a0b16113a44bedb301be94d74533a..4966daa673adeeae1aae0a94948fddfcd3a45fc6 100644 --- a/dune/fufem/test/staticmatrixtoolstest.cc +++ b/dune/fufem/test/staticmatrixtoolstest.cc @@ -2,8 +2,6 @@ #include "config.h" #endif -#include <cassert> - #include <dune/common/parallel/mpihelper.hh> #include <dune/common/exceptions.hh> #include <dune/common/fmatrix.hh> @@ -52,7 +50,7 @@ private: StaticMatrix::addToDiagonal(squareFieldMatrix_x, scalar_a); - assert(myDiff(squareFieldMatrix_x, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_x, squareFieldMatrix_check)<1e-12; } //case DM { @@ -61,7 +59,7 @@ private: StaticMatrix::addToDiagonal(diagonalMatrix_x, scalar_a); - assert(myDiff(diagonalMatrix_x, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_x, diagonalMatrix_check)<1e-12; } //case SM { @@ -70,7 +68,7 @@ private: StaticMatrix::addToDiagonal(scaledIdentityMatrix_x, scalar_a); - assert(myDiff(scaledIdentityMatrix_x, scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_x, scaledIdentityMatrix_check)<1e-12; } //case with hardwired scalar type as double (as occurring in localssemblers, see also the commment in staticmatrixtools.hh) //why does this even compile? @@ -80,7 +78,7 @@ private: StaticMatrix::addToDiagonal(scaledIdentityMatrix_x, double_a); - assert(myDiff(scaledIdentityMatrix_x, scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_x, scaledIdentityMatrix_check)<1e-12; } //RECTANGULAR MATRICES @@ -93,7 +91,7 @@ private: StaticMatrix::addToDiagonal(rectFieldMatrix_x, scalar_a); - assert(myDiff(rectFieldMatrix_x, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_x, rectFieldMatrix_check)<1e-12; } return passed; @@ -146,7 +144,7 @@ private: StaticMatrix::addTransformedMatrix(squareMatrix_A, squareFieldMatrix_T1, squareMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareMatrix_A, squareMatrix_check)<1e-12); + passed = passed and myDiff(squareMatrix_A, squareMatrix_check)<1e-12; } //case FM += FM^t*FM*FM { @@ -156,7 +154,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, squareFieldMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*DM*FM { @@ -166,7 +164,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, diagonalMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; // Dune::Timer timer(false), timerAlt(false); // Dune::DiagonalMatrix<FieldType,2> diagonalMatrix_C = {1, 2}; @@ -198,7 +196,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, diagonalMatrix_T1, squareFieldMatrix_B, diagonalMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += DM^t*DM*DM { @@ -208,7 +206,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, diagonalMatrix_T1, diagonalMatrix_B, diagonalMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*SM*FM { @@ -218,7 +216,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, scaledIdentityMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; // Dune::Timer timer(false), timerAlt(false); // Dune::DiagonalMatrix<FieldType,2> diagonalMatrix_C = {1, 2}; @@ -250,7 +248,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, scaledIdentityMatrix_T1, squareFieldMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*field_type*FM { @@ -260,7 +258,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, scalar_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += field_type*FM*field_type { @@ -270,7 +268,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, scalar_T1, squareFieldMatrix_B, scalar_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += FM^t*double*FM { @@ -280,7 +278,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, double_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += double*FM*double { @@ -290,7 +288,7 @@ private: StaticMatrix::addTransformedMatrix(squareFieldMatrix_A, double_T1, squareFieldMatrix_B, double_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case DM += DM^t*DM*DM { @@ -299,7 +297,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, diagonalMatrix_T1, diagonalMatrix_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += DM^t*SM*DM { @@ -308,7 +306,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, diagonalMatrix_T1, scaledIdentityMatrix_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += SM^t*DM*SM { @@ -317,7 +315,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, scaledIdentityMatrix_T1, diagonalMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += DM^t*field_type*DM { @@ -326,7 +324,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, diagonalMatrix_T1, scalar_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += field_type*DM*field_type { @@ -335,7 +333,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, scalar_T1, diagonalMatrix_B, scalar_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += DM^t*double*DM { @@ -344,7 +342,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, diagonalMatrix_T1, double_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += double*DM*double { @@ -353,7 +351,7 @@ private: StaticMatrix::addTransformedMatrix(diagonalMatrix_A, double_T1, diagonalMatrix_B, double_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case SM += SM^t*SM*SM { @@ -362,7 +360,7 @@ private: StaticMatrix::addTransformedMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, scaledIdentityMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A, scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A, scaledIdentityMatrix_check)<1e-12; } //case SM += SM^t*field_type*SM { @@ -371,7 +369,7 @@ private: StaticMatrix::addTransformedMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, scalar_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += field_type*SM*field_type { @@ -380,7 +378,7 @@ private: StaticMatrix::addTransformedMatrix(scaledIdentityMatrix_A, scalar_T1, scaledIdentityMatrix_B, scalar_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += SM^t*double*SM { @@ -389,7 +387,7 @@ private: StaticMatrix::addTransformedMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, double_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += double*SM*double { @@ -398,7 +396,7 @@ private: StaticMatrix::addTransformedMatrix(scaledIdentityMatrix_A, double_T1, scaledIdentityMatrix_B, double_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case field_type += field_type*field_type*field_type { @@ -407,7 +405,7 @@ private: StaticMatrix::addTransformedMatrix(scalar_A, scalar_T1, scalar_B, scalar_T2); - assert(myDiff(scalar_A,scalar_check)<1e-12); + passed = passed and myDiff(scalar_A,scalar_check)<1e-12; } //RECTANGULAR MATRICES @@ -426,7 +424,7 @@ private: StaticMatrix::addTransformedMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, squareFieldMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*DM*FM { @@ -438,7 +436,7 @@ private: StaticMatrix::addTransformedMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, diagonalMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*SM*FM { @@ -450,7 +448,7 @@ private: StaticMatrix::addTransformedMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, scaledIdentityMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*field_type*FM { @@ -462,7 +460,7 @@ private: StaticMatrix::addTransformedMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, scalar_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*double*FM { @@ -474,7 +472,7 @@ private: StaticMatrix::addTransformedMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, double_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } return passed; @@ -502,7 +500,7 @@ private: StaticMatrix::axpy(squareFieldMatrix_y, scalar_a, squareFieldMatrix_x); - assert(myDiff(squareFieldMatrix_y, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_y, squareFieldMatrix_check)<1e-12; } //case FM += scalar*DM { @@ -512,7 +510,7 @@ private: StaticMatrix::axpy(squareFieldMatrix_y, scalar_a, diagonalMatrix_x); - assert(myDiff(squareFieldMatrix_y, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_y, squareFieldMatrix_check)<1e-12; } //case FM += scalar*SM { @@ -522,7 +520,7 @@ private: StaticMatrix::axpy(squareFieldMatrix_y, scalar_a, scaledIdentityMatrix_x); - assert(myDiff(squareFieldMatrix_y,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_y,squareFieldMatrix_check)<1e-12; } //case DM += scalar*DM { @@ -531,7 +529,7 @@ private: StaticMatrix::axpy(diagonalMatrix_y, scalar_a, diagonalMatrix_x); - assert(myDiff(diagonalMatrix_y, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_y, diagonalMatrix_check)<1e-12; } //case DM += scalar*SM { @@ -540,7 +538,7 @@ private: StaticMatrix::axpy(diagonalMatrix_y, scalar_a, scaledIdentityMatrix_x); - assert(myDiff(diagonalMatrix_y, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_y, diagonalMatrix_check)<1e-12; } //case SM += scalar*SM { @@ -549,7 +547,7 @@ private: StaticMatrix::axpy(scaledIdentityMatrix_y, scalar_a, scaledIdentityMatrix_x); - assert(myDiff(scaledIdentityMatrix_y, scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_y, scaledIdentityMatrix_check)<1e-12; } //RECTANGULAR MATRICES @@ -562,7 +560,7 @@ private: StaticMatrix::axpy(rectFieldMatrix_y, scalar_a, rectFieldMatrix_x); - assert(myDiff(rectFieldMatrix_y, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_y, rectFieldMatrix_check)<1e-12; } return passed; @@ -615,7 +613,7 @@ private: StaticMatrix::transformMatrix(squareMatrix_A, squareFieldMatrix_T1, squareMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareMatrix_A, squareMatrix_check)<1e-12); + passed = passed and myDiff(squareMatrix_A, squareMatrix_check)<1e-12; } //case FM += FM^t*FM*FM { @@ -625,7 +623,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, squareFieldMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*DM*FM { @@ -635,7 +633,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, diagonalMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; // Dune::Timer timer(false), timerAlt(false); // Dune::DiagonalMatrix<FieldType,2> diagonalMatrix_C = {1, 2}; @@ -667,7 +665,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, diagonalMatrix_T1, squareFieldMatrix_B, diagonalMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += DM^t*DM*DM { @@ -677,7 +675,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, diagonalMatrix_T1, diagonalMatrix_B, diagonalMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*SM*FM { @@ -687,7 +685,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, scaledIdentityMatrix_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; // Dune::Timer timer(false), timerAlt(false); // Dune::DiagonalMatrix<FieldType,2> diagonalMatrix_C = {1, 2}; @@ -719,7 +717,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, scaledIdentityMatrix_T1, squareFieldMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A, squareFieldMatrix_check)<1e-12; } //case FM += FM^t*field_type*FM { @@ -729,7 +727,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, scalar_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += field_type*FM*field_type { @@ -739,7 +737,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, scalar_T1, squareFieldMatrix_B, scalar_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += FM^t*double*FM { @@ -749,7 +747,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, squareFieldMatrix_T1, double_B, squareFieldMatrix_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case FM += double*FM*double { @@ -759,7 +757,7 @@ private: StaticMatrix::transformMatrix(squareFieldMatrix_A, double_T1, squareFieldMatrix_B, double_T2); - assert(myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12); + passed = passed and myDiff(squareFieldMatrix_A,squareFieldMatrix_check)<1e-12; } //case DM += DM^t*DM*DM { @@ -768,7 +766,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, diagonalMatrix_T1, diagonalMatrix_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += DM^t*SM*DM { @@ -777,7 +775,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, diagonalMatrix_T1, scaledIdentityMatrix_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += SM^t*DM*SM { @@ -786,7 +784,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, scaledIdentityMatrix_T1, diagonalMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A, diagonalMatrix_check)<1e-12; } //case DM += DM^t*field_type*DM { @@ -795,7 +793,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, diagonalMatrix_T1, scalar_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += field_type*DM*field_type { @@ -804,7 +802,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, scalar_T1, diagonalMatrix_B, scalar_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += DM^t*double*DM { @@ -813,7 +811,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, diagonalMatrix_T1, double_B, diagonalMatrix_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case DM += double*DM*double { @@ -822,7 +820,7 @@ private: StaticMatrix::transformMatrix(diagonalMatrix_A, double_T1, diagonalMatrix_B, double_T2); - assert(myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12); + passed = passed and myDiff(diagonalMatrix_A,diagonalMatrix_check)<1e-12; } //case SM += SM^t*SM*SM { @@ -831,7 +829,7 @@ private: StaticMatrix::transformMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, scaledIdentityMatrix_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A, scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A, scaledIdentityMatrix_check)<1e-12; } //case SM += SM^t*field_type*SM { @@ -840,7 +838,7 @@ private: StaticMatrix::transformMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, scalar_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += field_type*SM*field_type { @@ -849,7 +847,7 @@ private: StaticMatrix::transformMatrix(scaledIdentityMatrix_A, scalar_T1, scaledIdentityMatrix_B, scalar_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += SM^t*double*SM { @@ -858,7 +856,7 @@ private: StaticMatrix::transformMatrix(scaledIdentityMatrix_A, scaledIdentityMatrix_T1, double_B, scaledIdentityMatrix_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case SM += double*SM*double { @@ -867,7 +865,7 @@ private: StaticMatrix::transformMatrix(scaledIdentityMatrix_A, double_T1, scaledIdentityMatrix_B, double_T2); - assert(myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12); + passed = passed and myDiff(scaledIdentityMatrix_A,scaledIdentityMatrix_check)<1e-12; } //case field_type += field_type*field_type*field_type { @@ -876,7 +874,7 @@ private: StaticMatrix::transformMatrix(scalar_A, scalar_T1, scalar_B, scalar_T2); - assert(myDiff(scalar_A,scalar_check)<1e-12); + passed = passed and myDiff(scalar_A,scalar_check)<1e-12; } //RECTANGULAR MATRICES @@ -895,7 +893,7 @@ private: StaticMatrix::transformMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, squareFieldMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*DM*FM { @@ -907,7 +905,7 @@ private: StaticMatrix::transformMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, diagonalMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*SM*FM { @@ -919,7 +917,7 @@ private: StaticMatrix::transformMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, scaledIdentityMatrix_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*field_type*FM { @@ -931,7 +929,7 @@ private: StaticMatrix::transformMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, scalar_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } // case FM += FM^t*double*FM { @@ -943,7 +941,7 @@ private: StaticMatrix::transformMatrix(rectFieldMatrix_A, rectFieldMatrix_T1, double_B, rectFieldMatrix_T2); - assert(myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12); + passed = passed and myDiff(rectFieldMatrix_A, rectFieldMatrix_check)<1e-12; } return passed; diff --git a/dune/fufem/test/tensortest.cc b/dune/fufem/test/tensortest.cc index e56d4f2ba2e70c50237588e80e025ae83992841f..a3ec3d9f6b882f1c9679861e926f7d470da83cfb 100644 --- a/dune/fufem/test/tensortest.cc +++ b/dune/fufem/test/tensortest.cc @@ -11,10 +11,10 @@ #include <cmath> #include <iostream> -#include <cassert> int main (int argc, char *argv[]) { + bool passed = true; Dune::MPIHelper::instance(argc, argv); SymmetricTensor<3> e1; @@ -24,28 +24,28 @@ int main (int argc, char *argv[]) e1(1,0) = 4; e1(2,0) = 5; e1(2,1) = 6; - assert(std::abs(e1.trace() - 6.0) < 1e-10); + passed = passed and std::abs(e1.trace() - 6.0) < 1e-10; SymmetricTensor<3> e2; e2 = e1; - assert( e1 == e2); - assert(!(e1 != e2)); + passed = passed and e1 == e2; + passed = passed and !(e1 != e2); - assert(std::abs(e2(0,0) - 1) < 1e-10); - assert(std::abs(e2(1,1) - 2) < 1e-10); - assert(std::abs(e2(2,2) - 3) < 1e-10); - assert(std::abs(e2(0,1) - 4) < 1e-10); - assert(std::abs(e2(0,2) - 5) < 1e-10); - assert(std::abs(e2(1,2) - 6) < 1e-10); + passed = passed and std::abs(e2(0,0) - 1) < 1e-10; + passed = passed and std::abs(e2(1,1) - 2) < 1e-10; + passed = passed and std::abs(e2(2,2) - 3) < 1e-10; + passed = passed and std::abs(e2(0,1) - 4) < 1e-10; + passed = passed and std::abs(e2(0,2) - 5) < 1e-10; + passed = passed and std::abs(e2(1,2) - 6) < 1e-10; e2.addToDiag(1); - assert(std::abs(e2(0,0) - 2) < 1e-10); - assert(std::abs(e2(1,1) - 3) < 1e-10); - assert(std::abs(e2(2,2) - 4) < 1e-10); - assert(std::abs(e2(0,1) - 4) < 1e-10); - assert(std::abs(e2(0,2) - 5) < 1e-10); - assert(std::abs(e2(1,2) - 6) < 1e-10); + passed = passed and std::abs(e2(0,0) - 2) < 1e-10; + passed = passed and std::abs(e2(1,1) - 3) < 1e-10; + passed = passed and std::abs(e2(2,2) - 4) < 1e-10; + passed = passed and std::abs(e2(0,1) - 4) < 1e-10; + passed = passed and std::abs(e2(0,2) - 5) < 1e-10; + passed = passed and std::abs(e2(1,2) - 6) < 1e-10; e2.setDiag(1); e2(1,1) += 1.0; @@ -57,13 +57,13 @@ int main (int argc, char *argv[]) e2 -= e1; e2 *= 2; - assert(std::abs(e1 * e2 - 2 * (e1 * e1)) < 1e-10); + passed = passed and std::abs(e1 * e2 - 2 * (e1 * e1)) < 1e-10; - assert(!(e1 == e2)); - assert( e1 != e2); + passed = passed and !(e1 == e2); + passed = passed and e1 != e2; e2 /= 2; - assert(std::abs(e1 * e1 - e1 * e2) < 1e-10); + passed = passed and std::abs(e1 * e1 - e1 * e2) < 1e-10; IsotropicTensor<3> const C(.5,.25); SymmetricTensor<3> h; @@ -72,7 +72,7 @@ int main (int argc, char *argv[]) std::cout << e1 << std::endl; std::cout << h << std::endl; std::cout << e1 * h << std::endl; - assert(std::abs(e1 * h - 74.4) < 1e-10); // e : C : e + passed = passed and std::abs(e1 * h - 74.4) < 1e-10; // e : C : e SymmetricTensor<3> const e3(e2); std::cout << e3 << std::endl; @@ -83,5 +83,5 @@ int main (int argc, char *argv[]) CubicTensor<2> const ct2(1,2,3); CubicTensor<3> const ct3(1,2,3); - return 0; + return passed ? 0 : 1; } diff --git a/dune/fufem/test/test-hdf5.cc b/dune/fufem/test/test-hdf5.cc index 81e7e9b3f8d06a291139b6534b0b52f71e6a3b11..001b8bfd591a0077262d9d36c056de513c44fd16 100644 --- a/dune/fufem/test/test-hdf5.cc +++ b/dune/fufem/test/test-hdf5.cc @@ -22,7 +22,8 @@ void deleteIfNecessary(std::string filename) { } template <class Vector> -void checkAddSequence(Vector const &written0, Vector const &written1) { +bool checkAddSequence(Vector const &written0, Vector const &written1) { + bool passed = true; using ft = typename Vector::block_type::field_type; std::string const filename("out-sequence.h5"); { @@ -50,13 +51,15 @@ void checkAddSequence(Vector const &written0, Vector const &written1) { for (size_t i = 0; i < 2; ++i) for (size_t j = 0; j < 3; ++j) { - assert(written0[i][j] == read0[i][j]); - assert(written1[i][j] == read1[i][j]); + passed = passed and written0[i][j] == read0[i][j]; + passed = passed and written1[i][j] == read1[i][j]; } + return passed; } template <class Vector> -void checkAppendSequence(Vector const &written0, Vector const &written1) { +bool checkAppendSequence(Vector const &written0, Vector const &written1) { + bool passed = true; using ft = typename Vector::block_type::field_type; std::string const filename("out-sequence.h5"); { @@ -84,13 +87,14 @@ void checkAppendSequence(Vector const &written0, Vector const &written1) { for (size_t i = 0; i < 2; ++i) for (size_t j = 0; j < 3; ++j) { - assert(written0[i][j] == read0[i][j]); - assert(written1[i][j] == read1[i][j]); + passed = passed and written0[i][j] == read0[i][j]; + passed = passed and written1[i][j] == read1[i][j]; } + return passed; } template <class Vector> -void checkSetSingleton(Vector const &written0) { +bool checkSetSingleton(Vector const &written0) { using ft = typename Vector::block_type::field_type; std::string const filename = "out-singleton.h5"; { @@ -99,6 +103,7 @@ void checkSetSingleton(Vector const &written0) { HDF5::SingletonWriter<2, ft> h5writer(file, "data", 2, 3); setEntry(h5writer, written0); } + return true; } int main(int argc, char *argv[]) { @@ -109,9 +114,11 @@ int main(int argc, char *argv[]) { }; Vector b1 = {{0, 10, 20}, {30, 40, 50}}; - checkAddSequence(b0, b1); + bool passed = true; + passed = passed and checkAddSequence(b0, b1); #if H5_VERSION_GE(1, 10, 0) - checkAppendSequence(b0, b1); + passed = passed and checkAppendSequence(b0, b1); #endif - checkSetSingleton(b0); + passed = passed and checkSetSingleton(b0); + return passed ? 0 : 1; } diff --git a/dune/fufem/test/test-polyhedral-minimisation.cc b/dune/fufem/test/test-polyhedral-minimisation.cc index 960cdb2d61db41a7f7eeff1863123d489cec5eae..d6eba8f6c46b703d95719f71ce53a48c53a42a4b 100644 --- a/dune/fufem/test/test-polyhedral-minimisation.cc +++ b/dune/fufem/test/test-polyhedral-minimisation.cc @@ -7,6 +7,7 @@ #include <dune/fufem/geometry/polyhedrondistance.hh> int main() { + bool passed = true; using LocalVector = Dune::FieldVector<double, 2>; auto const test = @@ -17,7 +18,7 @@ int main() { double const error = std::abs(analyticalDistance - distance(p1, p2, 1e-12)); std::cout << "error: " << error << std::endl; - assert(error < 1e-12); + passed = passed and error < 1e-12; } }; { @@ -88,4 +89,5 @@ int main() { }; test(bs1, bs2, analyticalDistance); } + return passed ? 0 : 1; }