From 6b1b1790cf251e6d45e246288fd76bf85bd85ef1 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 25 Nov 2016 16:21:01 +0100 Subject: [PATCH] Improve has_vmult_add check --- cmake/checks/check_03_compiler_bugs.cmake | 46 ------------------- doc/news/changes.h | 8 ++++ include/deal.II/base/config.h.in | 1 - include/deal.II/lac/linear_operator.h | 33 +++++-------- tests/lac/linear_operator_05.cc | 32 ------------- .../linear_operator_05.with_cxx11=on.output | 4 +- 6 files changed, 21 insertions(+), 103 deletions(-) diff --git a/cmake/checks/check_03_compiler_bugs.cmake b/cmake/checks/check_03_compiler_bugs.cmake index fa88b646d5..cc82df6c6b 100644 --- a/cmake/checks/check_03_compiler_bugs.cmake +++ b/cmake/checks/check_03_compiler_bugs.cmake @@ -388,52 +388,6 @@ IF( CMAKE_SYSTEM_NAME MATCHES "CYGWIN" ENDIF() -# -# Intel (at least 14, 15) has a bug where it incorrectly detects multiple -# matching function candidates and dies during type resolution in a -# perfectly valid SFINAE scenario. This seems to happen because the templated -# variant is not discarded (where it should be): -# -# error: more than one instance of overloaded function -# "has_vmult_add::test [with Range=double, T=MyMatrix]" -# matches the argument list: -# function template "void has_vmult_add::test(decltype(())) [with Range=double, T=MyMatrix]" -# function template "void has_vmult_add::test(decltype((&C::vmult_add))) [with Range=double, T=MyMatrix]" -# [...] -# -# - Matthias Maier, 2015 -# - -IF(DEAL_II_WITH_CXX11) - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") - CHECK_CXX_COMPILER_BUG( - " - template struct has_vmult_add - { - template - static void test(decltype(&C::vmult_add)); - - template - static void test(decltype(&C::template vmult_add)); - - typedef decltype(test(0)) type; - }; - - struct MyMatrix - { - void vmult_add() const; - }; - - int main() - { - typedef has_vmult_add::type test; - } - " - DEAL_II_ICC_SFINAE_BUG - ) - RESET_CMAKE_REQUIRED() -ENDIF() - # # Intel 16.0.1 produces wrong code that creates a race condition in # tests/fe/curl_curl_01.debug but 16.0.2 is known to work. Blacklist this diff --git a/doc/news/changes.h b/doc/news/changes.h index 3609e397a5..1937b8b465 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -451,6 +451,14 @@ inconvenience this causes.

Specific improvements

    +
  1. Improved: The trait class has_vmult_add in linear_operators.h + has been restricted to test if there is a vmult_add and a Tvmult_add + method that takes two arguments. This check now also works with + ICC 13 and ICC 14. +
    + (Daniel Arndt, 2016/11/25) +
  2. +
  3. Fixed: DataOut::build_patches() ignored a higher order or Eulerian mapping if no data had previously been attached via DataOut::add_data_vector(), i.e., if all that was to be output diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 38dea7ae9c..11ab3d1b98 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -71,7 +71,6 @@ #cmakedefine DEAL_II_BOOST_BIND_COMPILER_BUG #cmakedefine DEAL_II_BIND_NO_CONST_OP_PARENTHESES #cmakedefine DEAL_II_CONSTEXPR_BUG -#cmakedefine DEAL_II_ICC_SFINAE_BUG /*********************************************************************** diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 576485aad1..d563d93386 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -828,35 +828,24 @@ namespace internal namespace { // A trait class that determines whether type T provides public - // (templated or non-templated) vmult_add and Tvmult_add member functions + // (templated or non-templated) vmult_add member functions template - class has_vmult_add + class has_vmult_add_and_Tvmult_add { template static std::false_type test(...); template - static std::true_type test(decltype(&C::vmult_add), - decltype(&C::Tvmult_add)); - - // Work around a bug with icc (up to version 15) that fails during type - // deduction in an SFINAE scenario -#ifndef DEAL_II_ICC_SFINAE_BUG - - template - static std::true_type test(decltype(&C::template vmult_add), - decltype(&C::template Tvmult_add)); - - template - static std::true_type test(decltype(&C::template vmult_add), - decltype(&C::template Tvmult_add)); -#endif + static auto test(Range *r, Domain *d) + -> decltype(std::declval().vmult_add(*r,*d), + std::declval().Tvmult_add(*d,*r), + std::true_type()); public: // type is std::true_type if Matrix provides vmult_add and Tvmult_add, // otherwise it is std::false_type - typedef decltype(test(0, 0)) type; + typedef decltype(test(nullptr, nullptr)) type; }; @@ -1105,10 +1094,10 @@ linear_operator(const OperatorExemplar &operator_exemplar, const Matrix &matrix) }; typename std::conditional< - has_vmult_add::type::value, - MatrixInterfaceWithVmultAdd, - MatrixInterfaceWithoutVmultAdd>::type(). - operator()(return_op, matrix); + has_vmult_add_and_Tvmult_add::type::value, + MatrixInterfaceWithVmultAdd, + MatrixInterfaceWithoutVmultAdd>::type(). + operator()(return_op, matrix); return return_op; } diff --git a/tests/lac/linear_operator_05.cc b/tests/lac/linear_operator_05.cc index 67ecd37134..8077c9f922 100644 --- a/tests/lac/linear_operator_05.cc +++ b/tests/lac/linear_operator_05.cc @@ -218,12 +218,6 @@ public: { deallog << "MyMatrix6::vmult_add" << std::endl; } - - template - void Tvmult_add(Vector &, const Vector &, bool = true) const - { - deallog << "MyMatrix6::Tvmult_add" << std::endl; - } }; using namespace dealii; @@ -253,8 +247,6 @@ int main() linear_operator(m2).vmult_add(v, u); linear_operator(m2).Tvmult_add(v, u); -#ifndef DEAL_II_ICC_SFINAE_BUG - linear_operator(m3).vmult(v, u); linear_operator(m3).Tvmult(v, u); linear_operator(m3).vmult_add(v, u); @@ -274,28 +266,4 @@ int main() linear_operator(m6).Tvmult(v, u); linear_operator(m6).vmult_add(v, u); linear_operator(m6).Tvmult_add(v, u); - -#else - - deallog << "MyMatrix3::vmult" << std::endl; - deallog << "MyMatrix3::Tvmult" << std::endl; - deallog << "MyMatrix3::vmult_add" << std::endl; - deallog << "MyMatrix3::Tvmult_add" << std::endl; - - deallog << "MyMatrix4::vmult" << std::endl; - deallog << "MyMatrix4::Tvmult" << std::endl; - deallog << "MyMatrix4::vmult_add" << std::endl; - deallog << "MyMatrix4::Tvmult_add" << std::endl; - - deallog << "MyMatrix5::vmult" << std::endl; - deallog << "MyMatrix5::Tvmult" << std::endl; - deallog << "MyMatrix5::vmult_add" << std::endl; - deallog << "MyMatrix5::Tvmult_add" << std::endl; - - deallog << "MyMatrix6::vmult" << std::endl; - deallog << "MyMatrix6::Tvmult" << std::endl; - deallog << "MyMatrix6::vmult_add" << std::endl; - deallog << "MyMatrix6::Tvmult_add" << std::endl; - -#endif } diff --git a/tests/lac/linear_operator_05.with_cxx11=on.output b/tests/lac/linear_operator_05.with_cxx11=on.output index b1e55fa541..ed20878239 100644 --- a/tests/lac/linear_operator_05.with_cxx11=on.output +++ b/tests/lac/linear_operator_05.with_cxx11=on.output @@ -21,5 +21,5 @@ DEAL::MyMatrix5::vmult_add DEAL::MyMatrix5::Tvmult_add DEAL::MyMatrix6::vmult DEAL::MyMatrix6::Tvmult -DEAL::MyMatrix6::vmult_add -DEAL::MyMatrix6::Tvmult_add +DEAL::MyMatrix6::vmult +DEAL::MyMatrix6::Tvmult -- 2.39.5