DUNE PDELab (git)

standard.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3#ifndef DUNE_COMMON_SIMD_STANDARD_HH
4#define DUNE_COMMON_SIMD_STANDARD_HH
5
20#include <cstddef>
21#include <type_traits>
22#include <utility>
23
24#include <dune/common/indices.hh>
27
45namespace Dune {
46 namespace Simd {
47
48 namespace Overloads {
49
56
59 template<class V, class>
60 struct ScalarType { using type = V; };
61
63
66 template<class S, class, class>
67 struct RebindType { using type = S; };
68
70
73 template<class, class>
74 struct LaneCount : public index_constant<1> { };
75
77
86 template<class V>
87 V lane(ADLTag<2>, std::size_t, V v)
88 {
89 return v;
90 }
91
92 template<class V>
93 V &lane(ADLTag<3>, std::size_t, V &v)
94 {
95 return v;
96 }
97
98 // No Simd::cond() implementation, the overload for bool masks in the
99 // interface is sufficient
100
102 inline bool anyTrue(ADLTag<2>, bool mask) { return mask; }
103
105 inline bool allTrue(ADLTag<2>, bool mask) { return mask; }
106
108 inline bool anyFalse(ADLTag<2>, bool mask) { return !mask; }
109
111 inline bool allFalse(ADLTag<2>, bool mask) { return !mask; }
112
114
115 } // namespace Overloads
116 } // namespace Simd
117} // namespace Dune
118
119#endif // DUNE_COMMON_SIMD_STANDARD_HH
Basic definitions for SIMD Implementations.
Default implementations for SIMD Implementations.
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition: indices.hh:29
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition: defaults.hh:153
bool allFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::allFalse()
Definition: defaults.hh:124
bool allTrue(ADLTag< 0 >, const Mask &mask)
implements Simd::allTrue()
Definition: defaults.hh:104
bool anyFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::anyFalse()
Definition: defaults.hh:114
Dune namespace.
Definition: alignedallocator.hh:13
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition: base.hh:182
should be derived from a Dune::index_constant
Definition: standard.hh:74
should have a member type type
Definition: standard.hh:67
should have a member type type
Definition: standard.hh:60
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)