diff --git a/dune/istl/test/matrixtest.cc b/dune/istl/test/matrixtest.cc index 0abf2a55c424e74faefd291a7ca3d0b519193403..b8755d3feb092fb597dcf0f756a379e15082d850 100644 --- a/dune/istl/test/matrixtest.cc +++ b/dune/istl/test/matrixtest.cc @@ -298,8 +298,10 @@ void testTranspose(const MatrixType& matrix) int main() { - // feenableexcept does not exist on OS X or windows -#if not defined( __APPLE__ ) and not defined( __MINGW32__ ) + +#if defined( __APPLE__ ) or defined( __MINGW32__ ) or defined(_MSC_VER) + feraiseexcept(FE_INVALID); +#else feenableexcept(FE_INVALID); #endif diff --git a/dune/istl/test/multirhstest.cc b/dune/istl/test/multirhstest.cc index 127c7073eaf68de747628c5839ac2585b7aa0271..67c9c1f59bf261877f1ea9c8d0f18d5fd64fee8d 100644 --- a/dune/istl/test/multirhstest.cc +++ b/dune/istl/test/multirhstest.cc @@ -12,7 +12,6 @@ #include <complex> #include <cmath> // Yes, we do some math here -#include <sys/times.h> // for timing measurements #include <dune/common/alignedallocator.hh> #include <dune/common/classname.hh> diff --git a/dune/istl/test/multirhstest.hh b/dune/istl/test/multirhstest.hh index 54e454aa36c011ede0e7fb057d0f4c2ec4e76bc7..da8021206b8b1e36afccc5135bcf7fe58f527607 100644 --- a/dune/istl/test/multirhstest.hh +++ b/dune/istl/test/multirhstest.hh @@ -14,7 +14,6 @@ #include <complex> #include <cmath> // Yes, we do some math here -#include <sys/times.h> // for timing measurements #include <dune/common/alignedallocator.hh> #include <dune/common/classname.hh> @@ -41,7 +40,7 @@ template<typename T> struct Random { static T gen() { - return drand48(); + return T(std::rand())/RAND_MAX; } }; diff --git a/dune/istl/vbvector.hh b/dune/istl/vbvector.hh index 8ca5bcae75ffc17a6cace8a5695792d3b444fedb..33684eca724c53a342c51de84bf05182eda83e21 100644 --- a/dune/istl/vbvector.hh +++ b/dune/istl/vbvector.hh @@ -296,7 +296,7 @@ namespace Dune { //! constructor CreateIterator (VariableBlockVector& _v, int _i, bool _isEnd) : - v(_v), + v(&_v), i(_i), isEnd(_isEnd) {} @@ -308,8 +308,8 @@ namespace Dune { // 1. the current iterator was not created as enditerator // 2. we're at the last block // 3. the vector hasn't been initialized earlier - if (not isEnd && i==v.block.size() && not v.initialized) - v.allocate(); + if (not isEnd && i==v->block.size() && not v->initialized) + v->allocate(); } //! prefix increment @@ -332,13 +332,13 @@ namespace Dune { //! inequality bool operator!= (const CreateIterator& it) const { - return (i!=it.i) || (&v!=&it.v); + return not (*this == it); } //! equality bool operator== (const CreateIterator& it) const { - return (i==it.i) && (&v==&it.v); + return (i==it.i) && (v==it.v); } //! dereferencing @@ -350,7 +350,7 @@ namespace Dune { //! set size of current block void setblocksize (size_type _k) { - v.block[i].setsize(_k); + v->block[i].setsize(_k); } //! Access size of current block @@ -361,13 +361,13 @@ namespace Dune { #endif operator*() { - return {v.block[i]}; + return {v->block[i]}; } private: - VariableBlockVector& v; // my vector + VariableBlockVector* v; // my vector size_type i; // current block to be defined - const bool isEnd; // flag if this object was created as the end iterator. + bool isEnd; // flag if this object was created as the end iterator. }; // CreateIterator wants to set all the arrays ... diff --git a/src/istl-solver-playground.cc b/src/istl-solver-playground.cc index 7dd4250d3b74c1adececf80b6b033c212b91cef8..8f259a96ddaf275e24f05789fa410c2029409486 100644 --- a/src/istl-solver-playground.cc +++ b/src/istl-solver-playground.cc @@ -99,10 +99,10 @@ int main(int argc, char** argv){ } if(config.get("FP_EXCEPT", false)) - #if not defined( __APPLE__ ) and not defined( __MINGW32__ ) - feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);// | FE_UNDERFLOW); - #else + #if defined( __APPLE__ ) or defined( __MINGW32__ ) or defined(_MSC_VER) feraiseexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);// | FE_UNDERFLOW); + #else + feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);// | FE_UNDERFLOW); #endif int verbose = config.get("verbose", 1);