Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions include/RAJA/index/IndexSet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@

#include "RAJA/config.hpp"

#include "RAJA/index/ListSegment.hpp"
#include "RAJA/index/RangeSegment.hpp"

#include "RAJA/internal/Iterators.hpp"
#include "RAJA/internal/RAJAVec.hpp"

Expand Down Expand Up @@ -802,6 +799,15 @@ struct is_indexset_policy
{};
} // namespace type_traits

template<typename T>
concept IndexSetType =
static_cast<bool>(RAJA::type_traits::is_index_set<T>::value);


template<typename T>
concept IndexSetPolicy =
static_cast<bool>(type_traits::is_indexset_policy<T>::value);

} // namespace RAJA

#endif // closing endif for header file include guard
1 change: 0 additions & 1 deletion include/RAJA/index/RangeSegment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ DefineTypeTraitFromConcept(is_range_constructible,

DefineTypeTraitFromConcept(is_range_stride_constructible,
RAJA::concepts::RangeStrideConstructible);

} // namespace type_traits

} // namespace RAJA
Expand Down
11 changes: 11 additions & 0 deletions include/RAJA/pattern/detail/TypeTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#ifndef RAJA_TYPETRAITS_HPP
#define RAJA_TYPETRAITS_HPP

#include "RAJA/policy/PolicyBase.hpp"
#include <type_traits>
#include <camp/camp.hpp>

Expand Down Expand Up @@ -96,6 +97,16 @@ struct tuple_contains_Reducers<camp::tuple<Params...>>
{};

} // namespace expt

namespace type_traits
{
template<typename Policy>
consteval bool is_policy_forall()
{
return std::is_base_of_v<PolicyBase, Policy> &&
Policy {}.pattern == RAJA::Pattern::forall;
}
} // namespace type_traits
} // namespace RAJA

#endif // RAJA_TYPETRAITS_HPP
47 changes: 47 additions & 0 deletions include/RAJA/pattern/forall-concepts.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef RAJA_forall_concepts_HPP
#define RAJA_forall_concepts_HPP

#include "RAJA/config.hpp"

#include "RAJA/pattern/detail/TypeTraits.hpp"
#include "RAJA/index/IndexSet.hpp"
#include "RAJA/index/RangeSegment.hpp"
#include "RAJA/policy/MultiPolicy.hpp"
#include "detail/TypeTraits.hpp"

namespace RAJA
{
// TODO: Several of these are based on camp type_traits, which themselves are
// automatically generated by camp's pseudo-concept interface. We wish to
// simplify this chain of requirements, potentially moving the concepts
// themselves into camp

// The Range concept is derived from camp. This concept is satisfied by any
// type with a begin() and end() iterator.
template<typename T>
concept Range = static_cast<bool>(type_traits::is_range<camp::decay<T>>::value);

// RandomAccessRange is also derived from camp, and is satisfied by any type
// with begin/end iterators and random access.
template<typename T>
concept RandomAccessRange = Range<T> && static_cast<bool>(
type_traits::is_random_access_range<camp::decay<T>>::value);

template<typename T>
concept MultiPolicyConcept = static_cast<bool>(
RAJA::type_traits::is_multi_policy<camp::decay<T>>::value);

template<typename T>
concept Integer =
static_cast<bool>(type_traits::is_integral<camp::decay<T>>::value);

template<typename Pol>
concept ForallPolicy = RAJA::type_traits::is_policy_forall<Pol>();

template<typename T>
concept ForallParameterPack =
RAJA::expt::type_traits::is_ForallParamPack<camp::decay<T>>::value;

} // namespace RAJA

#endif
Loading
Loading