Skip to content
Snippets Groups Projects
Commit 474b5e9f authored by Jö Fahlke's avatar Jö Fahlke
Browse files

Revert accidential merge of !16.

This adresses #26.

Revert "Merge remote-tracking branch 'refs/remotes/core/feature/vc' into patches"

This reverts commit 68d8b5a5, reversing
changes made to e8d207bb.
parent 0456eef1
No related branches found
No related tags found
1 merge request!74Revert accidential merge of !16.
# Defines the functions to use VC
#
# .. cmake_function:: add_dune_vc_flags
#
# .. cmake_param:: targets
# :positional:
# :single:
# :required:
#
# A list of targets to use VC with.
#
function(add_dune_vc_flags _targets)
if(Vc_FOUND)
foreach(_target ${_targets})
target_link_libraries(${_target} ${Vc_LIBRARIES})
target_compile_options(${_target} PUBLIC ${Vc_ALL_FLAGS})
target_include_directories(${_target} SYSTEM PUBLIC ${Vc_INCLUDE_DIR})
endforeach(_target ${_targets})
endif(Vc_FOUND)
endfunction(add_dune_vc_flags)
if(Vc_FOUND)
dune_register_package_flags(COMPILE_OPTIONS "${Vc_ALL_FLAGS}"
LIBRARIES "${Vc_LIBRARIES}"
INCLUDE_DIRS "${Vc_INCLUDE_DIR}")
endif(Vc_FOUND)
set(HAVE_VC ${Vc_FOUND})
......@@ -26,7 +26,3 @@ include(AddGMPFlags)
find_package(Inkscape)
include(UseInkscape)
include(FindMProtect)
# try to find the Vc library
find_package(Vc)
include(AddVcFlags)
......@@ -45,9 +45,6 @@
to facilitate activating and deactivating GMP using compile flags. */
#cmakedefine HAVE_GMP ENABLE_GMP
/* Define to 1 if you have the Vc library. */
#cmakedefine HAVE_VC 1
/* Define to 1 if you have the symbol mprotect. */
#cmakedefine HAVE_MPROTECT 1
......
......@@ -21,15 +21,6 @@
@ingroup Utilities
*/
/**
@defgroup RangeUtilities Range Utilities
@brief Utilities for reduction like operations on ranges
All these reduction operations work for appropriate ranges and scalar values
@ingroup Utilities
*/
/**
@defgroup StringUtilities String Utilities
@brief Utility functions for std::string
......
#ifndef DUNE_COMMON_CONDITIONAL_HH
#define DUNE_COMMON_CONDITIONAL_HH
namespace Dune
{
/** \brief conditional evaluate
sometimes call immediate if, evaluates to
\code
if (b)
return v1;
else
return v2;
\endcode
In contrast to if-then-else the cond function can also be
evaluated for vector valued SIMD data types, see simd.hh.
\param b boolean value
\param v1 value of b==true
\param v2 value of b==false
*/
template<typename T1, typename T2>
const T1 cond(bool b, const T1 & v1, const T2 & v2)
{
return (b ? v1 : v2);
}
} // end namespace Dune
#endif // DUNE_COMMON_CONDITIONAL_HH
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_RANGE_UTILITIES_HH
#define DUNE_COMMON_RANGE_UTILITIES_HH
#include <dune/common/typetraits.hh>
#include <utility>
#include <type_traits>
#include <bitset>
/**
* \file
* \brief Utilities for reduction like operations on ranges
* \author Christian Engwer
*/
/**
* @addtogroup RangeUtilities
* @{
*/
namespace Dune
{
/**
\brief compute the maximum value over a range
overloads for scalar values, and ranges exist
*/
template <typename T,
typename std::enable_if<is_range<T>::value, int>::type = 0>
typename T::value_type
max_value(const T & v) {
using std::max;
typename T::value_type m;
for (const auto & e : v)
m = max(e,m);
return m;
};
template <typename T,
typename std::enable_if<!is_range<T>::value, int>::type = 0>
const T & max_value(const T & v) { return v; };
/**
\brief compute the minimum value over a range
overloads for scalar values, and ranges exist
*/
template <typename T,
typename std::enable_if<is_range<T>::value, int>::type = 0>
typename T::value_type
min_value(const T & v) {
using std::min;
typename T::value_type m;
for (const auto & e : v)
m = min(e,m);
return m;
};
template <typename T,
typename std::enable_if<!is_range<T>::value, int>::type = 0>
T & min_value(const T & v) { return v; };
/**
\brief similar to std::bitset<N>::any() return true, if any entries is true
overloads for scalar values, ranges, and std::bitset<N> exist
*/
template <typename T,
typename std::enable_if<is_range<T>::value, int>::type = 0>
bool any_true(const T & v) {
bool b = false;
for (const auto & e : v)
b = b or bool(e);
return b;
};
template <typename T,
typename std::enable_if<!is_range<T>::value, int>::type = 0>
bool any_true(const T & v) { return v; };
template<std::size_t N>
bool any_true(const std::bitset<N> & b)
{
return b.any();
}
/**
\brief similar to std::bitset<N>::all() return true, if any entries is true
overloads for scalar values, ranges, and std::bitset<N> exist
*/
template <typename T,
typename std::enable_if<is_range<T>::value, int>::type = 0>
bool all_true(const T & v) {
bool b = true;
for (const auto & e : v)
b = b and bool(e);
return b;
};
template <typename T,
typename std::enable_if<!is_range<T>::value, int>::type = 0>
bool all_true(const T & v) { return v; };
template<std::size_t N>
bool all_true(const std::bitset<N> & b)
{
return b.all();
}
}
#endif // DUNE_COMMON_RANGE_UTILITIES_HH
#ifndef DUNE_COMMON_SIMD_HH
#define DUNE_COMMON_SIMD_HH
#include <dune/common/rangeutilities.hh>
#include <dune/common/conditional.hh>
#if HAVE_VC
#include <Vc/Vc>
namespace Dune
{
template<typename T, typename A>
Vc::Vector<T,A> cond(const Vc::Mask<T,A> & b,
const Vc::Vector<T,A> & v1,
const Vc::Vector<T,A> & v2)
{
return std::move(Vc::iif(b, v1, v2));
}
template<typename T, std::size_t N, typename V, std::size_t M>
Vc::SimdArray<T,N,V,M> cond(const typename Vc::SimdArray<T,N,V,M>::mask_type & b,
const Vc::SimdArray<T,N,V,M> & v1,
const Vc::SimdArray<T,N,V,M> & v2)
{
return std::move(Vc::iif(b, v1, v2));
}
template<typename T, typename A>
T max_value(const Vc::Vector<T,A> & v)
{
return v.max();
}
template<typename T, std::size_t N, typename V, std::size_t M>
double max_value(const Vc::SimdArray<T,N,V,M> & v)
{
return v.max();
}
template<typename T, typename A>
T min_value(const Vc::Vector<T,A> & v)
{
return v.min();
}
template<typename T, std::size_t N, typename V, std::size_t M>
double min_value(const Vc::SimdArray<T,N,V,M> & v)
{
return v.min();
}
template<typename T, typename A>
bool any_true(const Vc::Mask<T,A> & v)
{
return Vc::any_of(v);
}
template<typename T, std::size_t N, typename V, std::size_t M>
bool any_true(const Vc::SimdMaskArray<T,N,V,M> & v)
{
return Vc::any_of(v);
}
template<typename T, typename A>
bool all_true(const Vc::Mask<T,A> & v)
{
return Vc::all_of(v);
}
template<typename T, std::size_t N, typename V, std::size_t M>
bool all_true(const Vc::SimdMaskArray<T,N,V,M> & v)
{
return Vc::all_of(v);
}
} // end namespace Dune
#endif // HAVE_VC
#endif // DUNE_COMMON_SIMD_HH
......@@ -395,25 +395,6 @@ namespace Dune
#endif // defined(DOXYGEN) or HAVE_IS_INDEXABLE_SUPPORT
/**
typetrait to check that a class has begin() and end() members
*/
// default version, gets picked if SFINAE fails
template<typename T, typename = void, typename = void>
struct is_range
: public std::false_type
{};
#ifndef DOXYGEN
// version for types with begin() and end()
template<typename T>
struct is_range<T,
decltype(Std::declval<T>().begin()),
decltype(Std::declval<T>().end())>
: public std::true_type
{};
#endif
namespace detail
{
///
......
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