Skip to content
Snippets Groups Projects
Commit d8427045 authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Improve support with MSVC

* Handle float exception handling for MSVC
* Remove system specific includes
* Make iterator in block vector be copyable to fulfill output iterator interface
parent d59be62f
No related branches found
No related tags found
1 merge request!577Improve support with MSVC
......@@ -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
......
......@@ -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>
......
......@@ -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;
}
};
......
......@@ -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 ...
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment