|
dune-common 2.12-git
|
Loading...
Searching...
No Matches
loop.hh File Reference
#include <array>#include <cmath>#include <cstddef>#include <cstdlib>#include <cstdint>#include <ostream>#include <dune/common/math.hh>#include <dune/common/simd/simd.hh>#include <dune/common/typetraits.hh>Go to the source code of this file.
Namespaces | |
| namespace | Dune |
| Dune namespace | |
| namespace | Dune::Simd |
| Namespace for vectorization interface functions used by library developers. | |
| namespace | Dune::Simd::Overloads |
| Namespace for the overloads and specializations that make up a SIMD implementation. | |
| namespace | Dune::MathOverloads |
| namespace for customization of math functions with Dune-Semantics | |
Macros | |
| #define | DUNE_PRAGMA_OMP_SIMD |
| #define | DUNE_SIMD_LOOP_PREFIX_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_UNARY_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_POSTFIX_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_ASSIGNMENT_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_BINARY_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_BITSHIFT_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_COMPARISON_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_BOOLEAN_OP(SYMBOL) |
| #define | DUNE_SIMD_LOOP_CMATH_UNARY_OP(expr) |
| #define | DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN(expr, returnType) |
| #define | DUNE_SIMD_LOOP_STD_UNARY_OP(expr) |
| #define | DUNE_SIMD_LOOP_STD_BINARY_OP(expr) |
Macro Definition Documentation
◆ DUNE_PRAGMA_OMP_SIMD
| #define DUNE_PRAGMA_OMP_SIMD |
◆ DUNE_SIMD_LOOP_ASSIGNMENT_OP
| #define DUNE_SIMD_LOOP_ASSIGNMENT_OP | ( | SYMBOL | ) |
Value:
auto operator SYMBOL(const Simd::Scalar<T> s) { \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
(*this)[i] SYMBOL s; \
} \
return *this; \
} \
\
auto operator SYMBOL(const LoopSIMD<T,S,A> &v) { \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
(*this)[i] SYMBOL v[i]; \
} \
return *this; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_BINARY_OP
| #define DUNE_SIMD_LOOP_BINARY_OP | ( | SYMBOL | ) |
Value:
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
const LoopSIMD<T,S,A> &w) { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_BITSHIFT_OP
| #define DUNE_SIMD_LOOP_BITSHIFT_OP | ( | SYMBOL | ) |
Value:
template<class T, std::size_t S, std::size_t A, class U> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A, class U, std::size_t AU> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
const LoopSIMD<U,S,AU> &w) { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_BOOLEAN_OP
| #define DUNE_SIMD_LOOP_BOOLEAN_OP | ( | SYMBOL | ) |
Value:
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const Simd::Scalar<T> s) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const Simd::Mask<T>& s, const LoopSIMD<T,S,A> &v) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
const LoopSIMD<T,S,A> &w) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP
| #define DUNE_SIMD_LOOP_CMATH_UNARY_OP | ( | expr | ) |
Value:
typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
auto expr(const LoopSIMD<T,S,A> &v) { \
using std::expr; \
LoopSIMD<T,S,A> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN
| #define DUNE_SIMD_LOOP_CMATH_UNARY_OP_WITH_RETURN | ( | expr, | |
| returnType | |||
| ) |
Value:
typename std::enable_if_t<!std::is_integral<Simd::Scalar<T>>::value> > \
auto expr(const LoopSIMD<T,S,A> &v) { \
using std::expr; \
LoopSIMD<returnType,S> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_COMPARISON_OP
| #define DUNE_SIMD_LOOP_COMPARISON_OP | ( | SYMBOL | ) |
Value:
template<class T, std::size_t S, std::size_t A, class U> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, const U s) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL s; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const Simd::Scalar<T> s, const LoopSIMD<T,S,A> &v) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = s SYMBOL v[i]; \
} \
return out; \
} \
template<class T, std::size_t S, std::size_t A> \
auto operator SYMBOL(const LoopSIMD<T,S,A> &v, \
const LoopSIMD<T,S,A> &w) { \
Simd::Mask<LoopSIMD<T,S,A>> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = v[i] SYMBOL w[i]; \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_POSTFIX_OP
| #define DUNE_SIMD_LOOP_POSTFIX_OP | ( | SYMBOL | ) |
Value:
auto operator SYMBOL(int){ \
LoopSIMD<T,S,A> out = *this; \
SYMBOL(*this); \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_PREFIX_OP
| #define DUNE_SIMD_LOOP_PREFIX_OP | ( | SYMBOL | ) |
Value:
auto operator SYMBOL() { \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
SYMBOL(*this)[i]; \
} \
return *this; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_STD_BINARY_OP
| #define DUNE_SIMD_LOOP_STD_BINARY_OP | ( | expr | ) |
Value:
template<class T, std::size_t S, std::size_t A> \
auto expr(const LoopSIMD<T,S,A> &v, const LoopSIMD<T,S,A> &w) { \
using std::expr; \
LoopSIMD<T,S,A> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i],w[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_STD_UNARY_OP
| #define DUNE_SIMD_LOOP_STD_UNARY_OP | ( | expr | ) |
Value:
template<class T, std::size_t S, std::size_t A> \
auto expr(const LoopSIMD<T,S,A> &v) { \
using std::expr; \
LoopSIMD<T,S,A> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
\
template<class T, std::size_t S, std::size_t A> \
using std::expr; \
LoopSIMD<T,S,A> out; \
for(std::size_t i=0; i<S; i++) { \
out[i] = expr(v[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")
◆ DUNE_SIMD_LOOP_UNARY_OP
| #define DUNE_SIMD_LOOP_UNARY_OP | ( | SYMBOL | ) |
Value:
auto operator SYMBOL() const { \
LoopSIMD<T,S,A> out; \
DUNE_PRAGMA_OMP_SIMD \
for(std::size_t i=0; i<S; i++){ \
out[i] = SYMBOL((*this)[i]); \
} \
return out; \
} \
static_assert(true, "expecting ;")
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8