3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 22:03:43 +01:00

remove workaround for icc 13.0

- deprecated....
- remove the TRIQS_WORKAROUND_INTEL_COMPILER_BUGS macro
This commit is contained in:
Olivier Parcollet 2013-10-02 21:25:32 +02:00 committed by Michel Ferrero
parent 4d0bb56790
commit 800aea4c5e
18 changed files with 3 additions and 248 deletions

View File

@ -89,7 +89,7 @@ ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# for icc, add the very infamous flags or calculation of boost::math bessel function are wrong !! # for icc, add the very infamous flags or calculation of boost::math bessel function are wrong !!
# tested on boost 1.53 # tested on boost 1.53
IF(CMAKE_COMPILER_IS_ICC) IF(CMAKE_COMPILER_IS_ICC)
set(TRIQS_WORKAROUND_INTEL_COMPILER_BUGS 1) set(TRIQS_WORKAROUND_INTEL_COMPILER_14_BUGS 1)
set(BOOST_MATH_DISABLE_STD_FPCLASSIFY 1) set(BOOST_MATH_DISABLE_STD_FPCLASSIFY 1)
#set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY) #set(TRIQS_CXX_DEFINITIONS ${TRIQS_CXX_DEFINITIONS} -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY)
#add_definitions( -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY) #add_definitions( -DTRIQS_WORKAROUND_INTEL_COMPILER_BUGS -DBOOST_MATH_DISABLE_STD_FPCLASSIFY)

View File

@ -8,7 +8,7 @@
#cmakedefine TRIQS_BIND_FORTRAN_LOWERCASE #cmakedefine TRIQS_BIND_FORTRAN_LOWERCASE
#cmakedefine TRIQS_WORKAROUND_INTEL_COMPILER_BUGS #cmakedefine TRIQS_WORKAROUND_INTEL_COMPILER_14_BUGS
#cmakedefine BOOST_MATH_DISABLE_STD_FPCLASSIFY #cmakedefine BOOST_MATH_DISABLE_STD_FPCLASSIFY
#cmakedefine TRIQS_COMPILER_IS_C11_COMPLIANT #cmakedefine TRIQS_COMPILER_IS_C11_COMPLIANT

View File

@ -31,8 +31,6 @@ using namespace triqs::arrays;
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
{ {
vector<double> a = { 1,3,2}, b= {2,3,1}; vector<double> a = { 1,3,2}, b= {2,3,1};
assert_is_true (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end())); assert_is_true (std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()));
@ -51,10 +49,6 @@ int main(int argc, char **argv) {
vector<int> a = {1,3,2}, b=a; vector<int> a = {1,3,2}, b=a;
assert_is_false (a<b); assert_is_false (a<b);
} }
#endif
} }

View File

@ -33,8 +33,6 @@ using namespace triqs::arrays;
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
matrix<int> Ai= {{ 1,2}, {3,4}}; matrix<int> Ai= {{ 1,2}, {3,4}};
matrix<double> A= {{ 1,2}, {3,4}}; matrix<double> A= {{ 1,2}, {3,4}};
vector<int> Ci, B= {1,1}; vector<int> Ci, B= {1,1};
@ -50,8 +48,6 @@ int main(int argc, char **argv) {
return 0; return 0;
#endif
} }

View File

@ -25,8 +25,6 @@ using namespace triqs::arrays;
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
matrix<double> C, A= {{ 1.0,2.3}, {3.1,4.3}}; matrix<double> C, A= {{ 1.0,2.3}, {3.1,4.3}};
matrix<int> B= {{ 1,2}, {3,4}}; matrix<int> B= {{ 1,2}, {3,4}};
matrix<double> Bd= {{ 1,2}, {3,4}}; matrix<double> Bd= {{ 1,2}, {3,4}};
@ -42,8 +40,6 @@ int main(int argc, char **argv) {
assert_all_close(A*B, A*Bd, 1.e-13); assert_all_close(A*B, A*Bd, 1.e-13);
#endif
return 0; return 0;
} }

View File

@ -14,11 +14,7 @@ struct my_obj {
my_obj() { i=0;} my_obj() { i=0;}
my_obj(my_obj const & x) { i = x.i;} my_obj(my_obj const & x) { i = x.i;}
my_obj(my_obj && x) { std::swap(i,x.i);} my_obj(my_obj && x) { std::swap(i,x.i);}
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
my_obj & operator = (my_obj && x)= default; my_obj & operator = (my_obj && x)= default;
#else
my_obj & operator = (my_obj && x) { i = x.i; return *this;}
#endif
// h5 operation // h5 operation
friend std::string get_triqs_hdf5_data_scheme( my_obj const&) { return "myobject_is_nice";} friend std::string get_triqs_hdf5_data_scheme( my_obj const&) { return "myobject_is_nice";}

View File

@ -52,8 +52,6 @@ namespace triqs { namespace arrays {
namespace flags { namespace flags {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
constexpr ull_t get(ull_t f, ull_t a) { return ((f & (1ull<<a)) >> a);} constexpr ull_t get(ull_t f, ull_t a) { return ((f & (1ull<<a)) >> a);}
constexpr ull_t get2(ull_t f, ull_t a) { return ((f & ((1ull<<a) + (1ull<< (a+1ull)))) >> a);} constexpr ull_t get2(ull_t f, ull_t a) { return ((f & ((1ull<<a) + (1ull<< (a+1ull)))) >> a);}
@ -87,34 +85,6 @@ namespace triqs { namespace arrays {
static_assert ( (!( (is_c || is_f) && To )), "You asked C or Fortran traversal order and gave a traversal order ..."); static_assert ( (!( (is_c || is_f) && To )), "You asked C or Fortran traversal order and gave a traversal order ...");
}; };
#else
#define TRIQS_FLAGS_GET(f,a) ((f & (1ull<<a)) >> a)
#define TRIQS_FLAGS_GET2(f,a) ((f & ((1ull<<a) + (1ull<< (a+1ull)))) >> a)
constexpr bool is_const (ull_t f) { return false;} // non const view on icc
#ifdef TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
template< ull_t F> struct bound_check_trait { static constexpr bool value = true;};
#else
template< ull_t F> struct bound_check_trait { static constexpr bool value = TRIQS_FLAGS_GET (F, 5)!=0; };
#endif
template< ull_t F> struct traversal_order_c { static constexpr bool value = TRIQS_FLAGS_GET(F,1) !=0; };
template< ull_t F> struct traversal_order_fortran { static constexpr bool value = TRIQS_FLAGS_GET(F,2) !=0; };
template< ull_t F> struct init_mode_tr { static constexpr int value = TRIQS_FLAGS_GET(F,3); };
template<ull_t F> struct init_tag1;
template<> struct init_tag1<0> { typedef Tag::no_init type;};
template<> struct init_tag1<1> { typedef Tag::default_init type;};
template<ull_t F> struct init_tag : init_tag1 < init_mode_tr<F>::value > {};
template<ull_t F, ull_t To> struct assert_make_sense { };// no check on icc
#undef TRIQS_FLAGS_GET
#undef TRIQS_FLAGS_GET2
#endif
} }
}}//namespace triqs::arrays }}//namespace triqs::arrays
#endif #endif

View File

@ -43,11 +43,7 @@ namespace triqs { namespace arrays {
// given a m_index of indices, a metafunction to map to their position into memory // given a m_index of indices, a metafunction to map to their position into memory
template<ull_t ML, typename CTL> struct index_group_to_mem_pos_list; template<ull_t ML, typename CTL> struct index_group_to_mem_pos_list;
template<ull_t ML,int ... Is> struct index_group_to_mem_pos_list<ML,m_index<Is...>> { template<ull_t ML,int ... Is> struct index_group_to_mem_pos_list<ML,m_index<Is...>> {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
typedef m_index < indexmaps::mem_layout::index_to_memory_rank(ML,Is)...> type; typedef m_index < indexmaps::mem_layout::index_to_memory_rank(ML,Is)...> type;
#else
typedef m_index < indexmaps::mem_layout::index_to_memory_rank_tr<ML,Is>::value ... > type;
#endif
static_assert( get_min_max<type>::max - get_min_max<type>::min + 1 == sizeof...(Is), "Indices not contiguous in memory"); static_assert( get_min_max<type>::max - get_min_max<type>::min + 1 == sizeof...(Is), "Indices not contiguous in memory");
}; };

View File

@ -42,8 +42,6 @@ namespace triqs { namespace arrays {
* All these computations can be done *at compile time* (constexpr) * All these computations can be done *at compile time* (constexpr)
*/ */
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
constexpr int memory_rank_to_index(ull_t p, int r) { return permutations::apply(p, r);} constexpr int memory_rank_to_index(ull_t p, int r) { return permutations::apply(p, r);}
constexpr int index_to_memory_rank(ull_t p, int r) { return permutations::apply(permutations::inverse(p), r);} constexpr int index_to_memory_rank(ull_t p, int r) { return permutations::apply(permutations::inverse(p), r);}
@ -65,27 +63,6 @@ namespace triqs { namespace arrays {
(flags::traversal_order_fortran(fl) ? fortran_order(rank) : (to==0 ? c_order(rank) : to )));} (flags::traversal_order_fortran(fl) ? fortran_order(rank) : (to==0 ? c_order(rank) : to )));}
template< int rank, ull_t fl, ull_t to> struct get_traversal_order { static constexpr ull_t value = _get_traversal_order (rank,fl,to); }; template< int rank, ull_t fl, ull_t to> struct get_traversal_order { static constexpr ull_t value = _get_traversal_order (rank,fl,to); };
#else
constexpr int memory_rank_to_index(ull_t p, int r) { return permutations::apply(p, r);}
constexpr int index_to_memory_rank(ull_t p, int r) { return permutations::apply(permutations::inverse(p), r);}
template<ull_t p, int r> struct index_to_memory_rank_tr { static constexpr ull_t value = permutations::apply(permutations::inverse(p), r);};
constexpr bool is_fortran (ull_t p){ return p == permutations::identity(permutations::size(p));}
constexpr bool is_c (ull_t p){ return p == permutations::ridentity(permutations::size(p));}
constexpr ull_t fortran_order (int n){ return permutations::identity(n);}
constexpr ull_t c_order (int n){ return permutations::ridentity(n);}
template<int n> struct fortran_order_tr { static constexpr ull_t value = permutations::identity(n);};
template<int n> struct c_order_tr { static constexpr ull_t value = permutations::ridentity(n);};
template< int rank, ull_t fl, ull_t to> struct get_traversal_order {
static constexpr ull_t value = (flags::traversal_order_c<fl>::value ? c_order_tr<rank>::value :
(flags::traversal_order_fortran<fl>::value ? fortran_order_tr<rank>::value : (to==0 ? c_order_tr<rank>::value : to )));
};
#endif
}} }}

View File

@ -23,7 +23,6 @@
#include "./mem_layout.hpp" #include "./mem_layout.hpp"
namespace triqs { namespace arrays { namespace indexmaps { namespace cuboid { namespace slicing_TO_order { namespace triqs { namespace arrays { namespace indexmaps { namespace cuboid { namespace slicing_TO_order {
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
template <typename... SliceArgs> struct _impl{ template <typename... SliceArgs> struct _impl{
static constexpr int n_range_ellipsis=0; static constexpr int n_range_ellipsis=0;
static constexpr ull_t mask(ull_t mo, int P, int c) { return 0;} static constexpr ull_t mask(ull_t mo, int P, int c) { return 0;}
@ -45,31 +44,5 @@ namespace triqs { namespace arrays { namespace indexmaps { namespace cuboid { na
( mem_layout::is_fortran(mo) ? fortran_order(_impl<Args...>::n_range_ellipsis) : sliced_memory_order1<Args...>(mo) )); ( mem_layout::is_fortran(mo) ? fortran_order(_impl<Args...>::n_range_ellipsis) : sliced_memory_order1<Args...>(mo) ));
} }
template<ull_t mo, typename ... Args> struct sliced_memory_order { static constexpr ull_t value = sliced_memory_order1<Args...>(mo); }; template<ull_t mo, typename ... Args> struct sliced_memory_order { static constexpr ull_t value = sliced_memory_order1<Args...>(mo); };
#else
template <int P, int c, typename... SliceArgs> struct mask {
static constexpr ull_t value = 0;
static constexpr int n_range_ellipsis= 0;
};
template <int P, int c, typename A0, typename... SliceArgs> struct mask<P,c,A0,SliceArgs...> {
static constexpr bool is_range = std::is_base_of<range, A0>::value;
typedef mask<P + is_range, c+1,SliceArgs...> next_t;
static constexpr int n_range_ellipsis= next_t::n_range_ellipsis + is_range;
static constexpr ull_t value = ((is_range ? P+1 : 0) << (4*c)) + next_t::value;
};
template <ull_t mo, ull_t ma, int P, int c, typename ... A> struct _impl { static constexpr ull_t value = 0; };
template <ull_t mo, ull_t ma, int P, int c, typename A0, typename... SliceArgs> struct _impl<mo,ma,P,c, A0,SliceArgs...> {
static constexpr bool is_range = std::is_base_of<range, A0>::value;
struct r2 { // Intel ....
static constexpr ull_t pn = permutations::apply(mo,c);
static constexpr ull_t value = (ma >> (4*(pn))) & 0xFull;
};
static const bool r2_nozero = (r2::value!=0);
static constexpr ull_t value = (r2::value!=0 ? ( (r2::value-1) << (4*P) ) : 0)+ _impl<mo,ma,P+r2_nozero,c+1,SliceArgs...>::value;
};
template<ull_t mo, typename ... Args> struct sliced_memory_order {
typedef mask<0,0,Args...> mask_t;
static constexpr ull_t value = mask_t::n_range_ellipsis + 0x10* _impl<mo, mask_t::value,0,0,Args...>::value ;
};
#endif
}}}}}//namespace triqs::arrays }}}}}//namespace triqs::arrays
#endif #endif

View File

@ -34,9 +34,6 @@ namespace triqs { namespace arrays { namespace permutations {
return res; return res;
} }
// icc 13.0 has a big bug in constexpr.
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
// sum_{k=0}^{n-1} k a^k = ( (n-1) * a**(n+1) - n * a**n + a)/(a-1)**2 // sum_{k=0}^{n-1} k a^k = ( (n-1) * a**(n+1) - n * a**n + a)/(a-1)**2
// sum_{k=0}^{n-1} k a^(n-k-1) = ( (n-1) - n * a + a**n)/(a-1)**2 // sum_{k=0}^{n-1} k a^(n-k-1) = ( (n-1) - n * a + a**n)/(a-1)**2
// with a = 16, a**n = 1<<4n // with a = 16, a**n = 1<<4n
@ -56,37 +53,6 @@ namespace triqs { namespace arrays { namespace permutations {
constexpr ull inverse_impl(ull p, ull c) { return (c << (4*apply(p,c))) + (c>0 ? inverse_impl(p,c-1): 0 ); } constexpr ull inverse_impl(ull p, ull c) { return (c << (4*apply(p,c))) + (c>0 ? inverse_impl(p,c-1): 0 ); }
constexpr ull inverse(ull p) { return size(p) + 0x10ull*inverse_impl(p,size(p)-1);} constexpr ull inverse(ull p) { return size(p) + 0x10ull*inverse_impl(p,size(p)-1);}
#else
constexpr ull _identity(ull n) { return ( (n-1ull)*(1ull<<(4*(n+1))) +(1ull<<4)- n *(1ull<<(4*n))) /( (1ull<<4) -1ull) /((1ull<<4) -1ull); }
constexpr ull identity(ull n) { return n + 0x10 * _identity(n);}
constexpr ull _ridentity(ull n) { return ( (n-1ull) - n* (1ull<<4) + (1ull<<(4*n))) /( (1ull<<4) -1ull) /((1ull<<4) -1ull); }
constexpr ull ridentity(ull n) { return n + 0x10 *_ridentity(n); }
// todo generalize with preproc...
constexpr ull make_perm_impl(ull i0) { return i0;}
constexpr ull make_perm_impl(ull i0, ull i1) { return i0 + 0x10ull * i1;}
constexpr ull make_perm_impl(ull i0, ull i1, ull i2) { return i0 + 0x10ull *make_perm_impl(i1,i2);}
constexpr ull make_perm_impl(ull i0, ull i1, ull i2, ull i3) { return i0 + 0x10ull *make_perm_impl(i1,i2,i3);}
constexpr ull make_perm_impl(ull i0, ull i1, ull i2, ull i3, ull i4) { return i0 + 0x10ull * make_perm_impl(i1,i2,i3,i4); }
constexpr ull permutation(ull i0) { return 1ull + 0x10ull *make_perm_impl(i0);}
constexpr ull permutation(ull i0, ull i1) { return 2ull + 0x10ull *make_perm_impl(i0,i1);}
constexpr ull permutation(ull i0, ull i1, ull i2) { return 3ull + 0x10ull *make_perm_impl(i0,i1,i2);}
constexpr ull permutation(ull i0, ull i1, ull i2, ull i3) { return 4ull + 0x10ull *make_perm_impl(i0,i1,i2,i3);}
constexpr ull permutation(ull i0, ull i1, ull i2, ull i3, ull i4) { return 5ull + 0x10ull *make_perm_impl(i0,i1,i2,i3,i4);}
template<int c> struct _compose { static constexpr ull invoke(ull p1, ull p2) { return apply(p2, apply(p1,c)) + 16ull * _compose<c+1>::invoke(p1,p2); } };
template<> struct _compose<15> { static constexpr ull invoke(ull p1, ull p2) { return 0ull; } };
constexpr ull compose(ull p1, ull p2) { return size(p1) + 0x10ull* (_compose<0>::invoke(p1,p2) & ((1ull<<4*size(p1)) -1ull));}
template<int c> struct _inverse { static constexpr ull invoke(ull p) { return (ull(c) << (4*apply(p,c))) + _inverse<c+1>::invoke(p);} };
template<> struct _inverse<15> { static constexpr ull invoke(ull p) { return 0ull; } };
constexpr ull inverse(ull p) { return size(p) + 0x10ull*( _inverse<0>::invoke(p) - 7ull*15ull + size(p)*(size(p)-1ull)/2ull);}
#endif
inline void print( std::ostream & out, ull perm) { inline void print( std::ostream & out, ull perm) {
out << "("; out << "(";
for (int i =0; i< permutations::size(perm); ++i) { out << (i!=0 ? " " : "") << apply(perm,i);} for (int i =0; i< permutations::size(perm); ++i) { out << (i!=0 ? " " : "") << apply(perm,i);}

View File

@ -63,18 +63,7 @@ namespace triqs { namespace mc_tools {
//measure_aux(measure_aux &rhs) {*this = rhs;} // or it will use the template = bug //measure_aux(measure_aux &rhs) {*this = rhs;} // or it will use the template = bug
measure_aux(measure_aux && rhs) = default ; //{ *this = std::move(rhs);} measure_aux(measure_aux && rhs) = default ; //{ *this = std::move(rhs);}
measure_aux & operator = (measure_aux const & rhs) { *this = rhs.clone_(); return *this;} measure_aux & operator = (measure_aux const & rhs) { *this = rhs.clone_(); return *this;}
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
measure_aux & operator = (measure_aux && rhs) =default; measure_aux & operator = (measure_aux && rhs) =default;
#else
measure_aux & operator = (measure_aux && rhs) noexcept {
using std::swap;
#define SW(X) swap(X,rhs.X)
SW(impl_); SW(hash_); SW(type_name_); SW(clone_);
SW(call_);
#undef SW
return *this;
}
#endif
void operator()(){ call_();} void operator()(){ call_();}
@ -102,15 +91,7 @@ namespace triqs { namespace mc_tools {
measure_aux_set(measure_aux_set &&) = default; measure_aux_set(measure_aux_set &&) = default;
measure_aux_set& operator = (measure_aux_set const &) = default; measure_aux_set& operator = (measure_aux_set const &) = default;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
measure_aux_set& operator = (measure_aux_set &&) = default; measure_aux_set& operator = (measure_aux_set &&) = default;
#else
measure_aux_set& operator = (measure_aux_set && rhs) {
using std::swap;
swap(m_map,rhs.m_map);
return *this;
}
#endif
/** /**
* Register the auxiliary M with a name * Register the auxiliary M with a name

View File

@ -80,19 +80,7 @@ namespace triqs { namespace mc_tools {
measure(measure &rhs) {*this = rhs;} // or it will use the template = bug measure(measure &rhs) {*this = rhs;} // or it will use the template = bug
measure(measure && rhs) { *this = std::move(rhs);} measure(measure && rhs) { *this = std::move(rhs);}
measure & operator = (measure const & rhs) { *this = rhs.clone_(); return *this;} measure & operator = (measure const & rhs) { *this = rhs.clone_(); return *this;}
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
measure & operator = (measure && rhs) =default; measure & operator = (measure && rhs) =default;
#else
measure & operator = (measure && rhs) {
using std::swap;
#define SW(X) swap(X,rhs.X)
SW(impl_); SW(hash_); SW(type_name_); SW(clone_);
SW(accumulate_); SW(collect_results_); SW(h5_r); SW(h5_w);
SW(count_);
#undef SW
return *this;
}
#endif
void accumulate(MCSignType signe){ assert(impl_); count_++; accumulate_(signe); } void accumulate(MCSignType signe){ assert(impl_); count_++; accumulate_(signe); }
void collect_results (boost::mpi::communicator const & c ) { collect_results_(c);} void collect_results (boost::mpi::communicator const & c ) { collect_results_(c);}
@ -126,17 +114,8 @@ namespace triqs { namespace mc_tools {
measure_set(measure_set &&) = default; measure_set(measure_set &&) = default;
measure_set& operator = (measure_set const &) = default; measure_set& operator = (measure_set const &) = default;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
measure_set& operator = (measure_set &&) = default; measure_set& operator = (measure_set &&) = default;
#else
measure_set& operator = (measure_set && rhs) {
using std::swap;
swap(m_map,rhs.m_map);
return *this;
}
#endif
/** /**
* Register the Measure M with a name * Register the Measure M with a name
*/ */

View File

@ -89,19 +89,7 @@ namespace triqs { namespace mc_tools {
move(move &rhs) {*this = rhs;} // to avoid clash with tempalte construction ! move(move &rhs) {*this = rhs;} // to avoid clash with tempalte construction !
move(move && rhs) { *this = std::move(rhs);} move(move && rhs) { *this = std::move(rhs);}
move & operator = (move const & rhs) { *this = rhs.clone_(); return *this;} move & operator = (move const & rhs) { *this = rhs.clone_(); return *this;}
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
move & operator = (move && rhs) = default; move & operator = (move && rhs) = default;
#else
move & operator = (move && rhs) { // how painful is icc !
using std::swap;
#define SW(X) swap(X,rhs.X)
SW(impl_); SW(hash_); SW(type_name_); SW(clone_);
SW(attempt_); SW(accept_); SW(reject_); SW(h5_r); SW(h5_w);
SW(NProposed);SW(Naccepted); SW(acceptance_rate_);
#undef SW
return *this;
}
#endif
MCSignType attempt(){ NProposed++; return attempt_();} MCSignType attempt(){ NProposed++; return attempt_();}
MCSignType accept() { Naccepted++; return accept_(); } MCSignType accept() { Naccepted++; return accept_(); }
@ -155,18 +143,7 @@ namespace triqs { namespace mc_tools {
move_set(move_set const &) = default; move_set(move_set const &) = default;
move_set(move_set &&) = default; move_set(move_set &&) = default;
move_set& operator = (move_set const &) = default; move_set& operator = (move_set const &) = default;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
move_set& operator = (move_set &&) = default; move_set& operator = (move_set &&) = default;
#else
move_set& operator = (move_set && rhs) {
using std::swap;
#define SW(X) swap(X,rhs.X)
SW(move_vec); SW(names_); SW(current); SW(current_move_number); SW(RNG);
SW(Proba_Moves); SW(Proba_Moves_Acc_Sum); SW(try_sign_ratio); SW(debug_counter);
#undef SW
return *this;
}
#endif
/** /**
* Add move M with its probability of being proposed. * Add move M with its probability of being proposed.

View File

@ -24,29 +24,12 @@ namespace triqs { namespace utility {
std::vector<std::vector<std::string>> parameter_defaults:: generate_help() const{ std::vector<std::vector<std::string>> parameter_defaults:: generate_help() const{
std::vector<std::vector<std::string>> str; std::vector<std::vector<std::string>> str;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
str.push_back({"parameter:", "status:", "type", "default value:", "description:"}); str.push_back({"parameter:", "status:", "type", "default value:", "description:"});
for (auto const &s : object_map){ for (auto const &s : object_map){
std::string key=s.first; std::ostringstream val; val << s.second; std::string key=s.first; std::ostringstream val; val << s.second;
if(is_required(key)) str.push_back({key, "required", s.second.type_name(), "-", doc(key)}); if(is_required(key)) str.push_back({key, "required", s.second.type_name(), "-", doc(key)});
else str.push_back({key, "optional", s.second.type_name(), val.str(), doc(key)}); else str.push_back({key, "optional", s.second.type_name(), val.str(), doc(key)});
} }
#else
std::vector<std::string> v;
v.push_back("parameter:"); v.push_back("status:"); v.push_back("default value:"); v.push_back("description:");
str.push_back(v);
for (auto const &s : object_map){
std::string key=s.first; std::ostringstream val; val << s.second;
v.clear();
if(is_required(key)) {
v.push_back(key); v.push_back("required"); v.push_back("-"); v.push_back(doc(key));
}
else {
v.push_back(key); v.push_back("optional"); v.push_back(val.str()); v.push_back(doc(key));
}
str.push_back(v);
}
#endif
return str; return str;
} }

View File

@ -43,23 +43,14 @@ namespace triqs { namespace utility {
std::vector<std::vector<std::string>> wrong_t; std::vector<std::vector<std::string>> wrong_t;
std::vector<std::vector<std::string>> no_deft; std::vector<std::vector<std::string>> no_deft;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
std::vector<std::string> desc{"key:", "description:"}; std::vector<std::string> desc{"key:", "description:"};
std::vector<std::string> tdesc{"key:", "expected type:", "actual type:"}; std::vector<std::string> tdesc{"key:", "expected type:", "actual type:"};
#else
std::vector<std::string> desc; desc.push_back("key:"); desc.push_back("description:");
std::vector<std::string> tdesc; tdesc.push_back("key:"); tdesc.push_back("expected type:"); tdesc.push_back("actual type:");
#endif
if ( (flag & reject_key_without_default) ) { // check that no extra parameters are present if ( (flag & reject_key_without_default) ) { // check that no extra parameters are present
for (auto const & pvp : *this) { for (auto const & pvp : *this) {
auto key = pvp.first; auto key = pvp.first;
if (!pdef.has_key(key)){ if (!pdef.has_key(key)){
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
no_deft.push_back({key}); no_deft.push_back({key});
#else
{ std::vector<std::string> v; v.push_back(key); no_deft.push_back(v);}
#endif
} }
} }
} }
@ -71,23 +62,13 @@ namespace triqs { namespace utility {
if (pdef.is_required(key) && (!this->has_key(key))){ if (pdef.is_required(key) && (!this->has_key(key))){
// delay exception until all parameters have been checked // delay exception until all parameters have been checked
if (!missing.size()) missing.push_back(desc); if (!missing.size()) missing.push_back(desc);
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
missing.push_back({key, pdef.doc(key)}); missing.push_back({key, pdef.doc(key)});
#else
{ std::vector<std::string> v; v.push_back(key); v.push_back(pdef.doc(key)); missing.push_back(v);}
#endif
} }
if (this->has_key(key)) { // check whether the type is correct if (this->has_key(key)) { // check whether the type is correct
if (! have_same_type(pvp.second, (*this)[key])){ if (! have_same_type(pvp.second, (*this)[key])){
// delay exception until all parameters have been checked // delay exception until all parameters have been checked
if (!wrong_t.size()) wrong_t.push_back(tdesc); if (!wrong_t.size()) wrong_t.push_back(tdesc);
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
wrong_t.push_back({key, pvp.second.type_name(), (*this)[key].type_name()}); wrong_t.push_back({key, pvp.second.type_name(), (*this)[key].type_name()});
#else
{ std::vector<std::string> v; v.push_back(key); v.push_back(pvp.second.type_name()); v.push_back((*this)[key].type_name());
wrong_t.push_back(v);}
#endif
} }
} }
else { else {

View File

@ -34,13 +34,7 @@ class scope_guard {
void dismiss() { active_ = false; } void dismiss() { active_ = false; }
bool active() const { return active_;} bool active() const { return active_;}
scope_guard() = delete; scope_guard() = delete;
#ifdef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
private:
scope_guard(const scope_guard&) = default;
public:
#else
scope_guard(const scope_guard&) = delete; scope_guard(const scope_guard&) = delete;
#endif
scope_guard(scope_guard&& rhs) : f_(std::move(rhs.f_)) , active_(rhs.active_) { rhs.dismiss(); } scope_guard(scope_guard&& rhs) : f_(std::move(rhs.f_)) , active_(rhs.active_) { rhs.dismiss(); }
scope_guard& operator=(const scope_guard&) = delete; scope_guard& operator=(const scope_guard&) = delete;
scope_guard& operator=(scope_guard&& rhs) { using std::swap; swap(f_,rhs.f_); swap(active_, rhs.active_); return *this;} scope_guard& operator=(scope_guard&& rhs) { using std::swap; swap(f_,rhs.f_); swap(active_, rhs.active_); return *this;}

View File

@ -47,11 +47,7 @@ namespace triqs { namespace utility {
time_pt (time_pt const &) = default; time_pt (time_pt const &) = default;
time_pt (time_pt && x) = default; time_pt (time_pt && x) = default;
time_pt & operator = (time_pt const &) = default ; time_pt & operator = (time_pt const &) = default ;
#ifndef TRIQS_WORKAROUND_INTEL_COMPILER_BUGS
time_pt & operator = (time_pt && x) = default; time_pt & operator = (time_pt && x) = default;
#else
time_pt & operator = (time_pt && x) noexcept { using std::swap; swap(n,x.n); swap(beta, x.beta); swap(val, x.val); return *this;}
#endif
//this is also dangerous for reproducibility //this is also dangerous for reproducibility
time_pt & operator = (double v) = delete; time_pt & operator = (double v) = delete;