Skip to content

Commit

Permalink
Remaining naming changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaiser committed Jul 10, 2017
1 parent 736cb48 commit 078c0f7
Show file tree
Hide file tree
Showing 16 changed files with 210 additions and 212 deletions.
10 changes: 5 additions & 5 deletions hpx/parallel/algorithms/adjacent_difference.hpp
Expand Up @@ -51,25 +51,25 @@ namespace hpx { namespace parallel { inline namespace v1
first, last, dest, std::forward<Op>(op));
}

template <typename ExPolicy, typename FwdIter1, typename Op>
template <typename ExPolicy, typename FwdIter, typename Op>
static typename util::detail::algorithm_result<
ExPolicy, Iter
>::type
parallel(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
parallel(ExPolicy && policy, FwdIter first, FwdIter last,
Iter dest, Op && op)
{
typedef hpx::util::zip_iterator<FwdIter1, FwdIter1, Iter>
typedef hpx::util::zip_iterator<FwdIter, FwdIter, Iter>
zip_iterator;
typedef util::detail::algorithm_result<ExPolicy, Iter> result;
typedef typename std::iterator_traits<FwdIter1>::difference_type
typedef typename std::iterator_traits<FwdIter>::difference_type
difference_type;

if (first == last)
return result::get(std::move(dest));

difference_type count = std::distance(first, last) - 1;

FwdIter1 prev = first;
FwdIter prev = first;
*dest++ = *first++;

if (count == 0)
Expand Down
16 changes: 8 additions & 8 deletions hpx/parallel/algorithms/detail/set_operation.hpp
Expand Up @@ -26,7 +26,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail
/// \cond NOINTERNAL

///////////////////////////////////////////////////////////////////////////
template <typename OutIter>
template <typename FwdIter>
struct set_operations_buffer
{
template <typename T>
Expand All @@ -52,7 +52,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail
T const* item_;
};

typedef typename std::iterator_traits<OutIter>::value_type value_type;
typedef typename std::iterator_traits<FwdIter>::value_type value_type;
typedef typename std::conditional<
std::is_scalar<value_type>::value,
value_type, rewritable_ref<value_type>
Expand All @@ -68,11 +68,11 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail

///////////////////////////////////////////////////////////////////////////
template <typename ExPolicy, typename RanIter1, typename RanIter2,
typename OutIter, typename F, typename Combiner, typename SetOp>
typename util::detail::algorithm_result<ExPolicy, OutIter>::type
typename FwdIter, typename F, typename Combiner, typename SetOp>
typename util::detail::algorithm_result<ExPolicy, FwdIter>::type
set_operation(ExPolicy policy,
RanIter1 first1, RanIter1 last1, RanIter2 first2, RanIter2 last2,
OutIter dest, F && f, Combiner && combiner, SetOp && setop)
FwdIter dest, F && f, Combiner && combiner, SetOp && setop)
{
typedef typename std::iterator_traits<RanIter1>::difference_type
difference_type1;
Expand All @@ -83,7 +83,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail
difference_type1 len1 = std::distance(first1, last1);
difference_type2 len2 = std::distance(first2, last2);

typedef typename set_operations_buffer<OutIter>::type buffer_type;
typedef typename set_operations_buffer<FwdIter>::type buffer_type;
boost::shared_array<buffer_type> buffer(
new buffer_type[combiner(len1, len2)]);

Expand All @@ -94,7 +94,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail
boost::shared_array<set_chunk_data> chunks(new set_chunk_data[cores]);

// fill the buffer piecewise
return parallel::util::partitioner<ExPolicy, OutIter, void>::call(
return parallel::util::partitioner<ExPolicy, FwdIter, void>::call(
policy, chunks.get(), cores,
// first step, is applied to all partitions
[=](set_chunk_data* curr_chunk, std::size_t part_size) -> void
Expand Down Expand Up @@ -156,7 +156,7 @@ namespace hpx { namespace parallel { inline namespace v1 { namespace detail
) - buffer_dest;
},
// second step, is executed after all partitions are done running
[buffer, chunks, cores, dest](std::vector<future<void> >&&) -> OutIter
[buffer, chunks, cores, dest](std::vector<future<void> >&&) -> FwdIter
{
// accumulate real length
set_chunk_data* chunk = chunks.get();
Expand Down
57 changes: 29 additions & 28 deletions hpx/parallel/algorithms/detail/transfer.hpp
Expand Up @@ -27,21 +27,21 @@ namespace hpx { namespace parallel { inline namespace v1
namespace detail
{
// parallel version
template <typename Algo, typename ExPolicy, typename FwdIter,
typename OutIter>
template <typename Algo, typename ExPolicy, typename FwdIter1,
typename FwdIter2>
typename util::detail::algorithm_result<
ExPolicy, std::pair<FwdIter, OutIter>
ExPolicy, std::pair<FwdIter1, FwdIter2>
>::type
transfer_(ExPolicy && policy, FwdIter first, FwdIter last, OutIter dest,
std::false_type)
transfer_(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, std::false_type)
{
#if defined(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
typedef std::integral_constant<bool,
parallel::execution::is_sequenced_execution_policy<
ExPolicy
>::value ||
!hpx::traits::is_forward_iterator<FwdIter>::value ||
!hpx::traits::is_forward_iterator<OutIter>::value
!hpx::traits::is_forward_iterator<FwdIter1>::value ||
!hpx::traits::is_forward_iterator<FwdIter2>::value
> is_seq;
#else
typedef parallel::execution::is_sequenced_execution_policy<
Expand All @@ -55,13 +55,13 @@ namespace hpx { namespace parallel { inline namespace v1
}

// forward declare segmented version
template <typename Algo, typename ExPolicy, typename FwdIter,
typename OutIter>
template <typename Algo, typename ExPolicy, typename FwdIter1,
typename FwdIter2>
typename util::detail::algorithm_result<
ExPolicy, std::pair<FwdIter, OutIter>
ExPolicy, std::pair<FwdIter1, FwdIter2>
>::type
transfer_(ExPolicy && policy, FwdIter first, FwdIter last, OutIter dest,
std::true_type);
transfer_(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, std::true_type);

// Executes transfer algorithm on the elements in the range [first, last),
// to another range beginning at \a dest.
Expand All @@ -76,10 +76,10 @@ namespace hpx { namespace parallel { inline namespace v1
// It describes the manner in which the execution
// of the algorithm may be parallelized and the manner
// in which it executes the move assignments.
// \tparam FwdIter The type of the source iterators used (deduced).
// \tparam FwdIter1 The type of the source iterators used (deduced).
// This iterator type must meet the requirements of an
// forward iterator.
// \tparam OutIter The type of the iterator representing the
// \tparam FwdIter2 The type of the iterator representing the
// destination range (deduced).
// This iterator type must meet the requirements of an
// output iterator.
Expand All @@ -92,44 +92,45 @@ namespace hpx { namespace parallel { inline namespace v1
// algorithm will be applied to.
// \param dest Refers to the beginning of the destination range.
//
// \returns The \a transfer algorithm returns a \a hpx::future<OutIter> if
// \returns The \a transfer algorithm returns a \a hpx::future<FwdIter2> if
// the execution policy is of type
// \a sequenced_task_policy or
// \a parallel_task_policy and
// returns \a OutIter otherwise.
// returns \a FwdIter2 otherwise.
// The \a move algorithm returns the output iterator to the
// element in the destination range, one past the last element
// transfered.
//

template <typename Algo, typename ExPolicy, typename FwdIter, typename OutIter,
template <typename Algo, typename ExPolicy, typename FwdIter1,
typename FwdIter2,
HPX_CONCEPT_REQUIRES_(
hpx::parallel::execution::is_execution_policy<ExPolicy>::value &&
hpx::traits::is_iterator<FwdIter>::value &&
hpx::traits::is_iterator<OutIter>::value)>
hpx::traits::is_iterator<FwdIter1>::value &&
hpx::traits::is_iterator<FwdIter2>::value)>
typename util::detail::algorithm_result<
ExPolicy, hpx::util::tagged_pair<tag::in(FwdIter), tag::out(OutIter)>
ExPolicy,
hpx::util::tagged_pair<tag::in(FwdIter1), tag::out(FwdIter2)>
>::type
transfer(ExPolicy && policy, FwdIter first, FwdIter last, OutIter dest)
transfer(ExPolicy && policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest)
{
#if defined(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
static_assert(
(hpx::traits::is_input_iterator<FwdIter>::value),
(hpx::traits::is_input_iterator<FwdIter1>::value),
"Required at least input iterator.");
static_assert(
(hpx::traits::is_output_iterator<OutIter>::value ||
hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_output_iterator<FwdIter2>::value ||
hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least output iterator.");
#else
static_assert(
(hpx::traits::is_forward_iterator<FwdIter>::value),
(hpx::traits::is_forward_iterator<FwdIter1>::value),
"Required at least forward iterator.");
static_assert(
(hpx::traits::is_forward_iterator<OutIter>::value),
(hpx::traits::is_forward_iterator<FwdIter2>::value),
"Requires at least forward iterator.");
#endif

typedef hpx::traits::is_segmented_iterator<FwdIter> is_segmented;
typedef hpx::traits::is_segmented_iterator<FwdIter1> is_segmented;

return hpx::util::make_tagged_pair<tag::in, tag::out>(
transfer_<Algo>(
Expand Down
35 changes: 18 additions & 17 deletions hpx/parallel/algorithms/find.hpp
Expand Up @@ -680,9 +680,9 @@ namespace hpx { namespace parallel { inline namespace v1
namespace detail
{
/// \cond NOINTERNAL
template <typename Iter>
template <typename FwdIter>
struct find_first_of
: public detail::algorithm<find_first_of<Iter>, Iter>
: public detail::algorithm<find_first_of<FwdIter>, FwdIter>
{
find_first_of()
: find_first_of::algorithm("find_first_of")
Expand All @@ -708,18 +708,18 @@ namespace hpx { namespace parallel { inline namespace v1
return last;
}

template <typename ExPolicy, typename FwdIter, typename Pred>
template <typename ExPolicy, typename FwdIter2, typename Pred>
static typename util::detail::algorithm_result<
ExPolicy, Iter
ExPolicy, FwdIter
>::type
parallel(ExPolicy && policy, Iter first, Iter last,
FwdIter s_first, FwdIter s_last, Pred && op)
parallel(ExPolicy && policy, FwdIter first, FwdIter last,
FwdIter2 s_first, FwdIter2 s_last, Pred && op)
{
typedef util::detail::algorithm_result<ExPolicy, Iter> result;
typedef typename std::iterator_traits<Iter>::reference reference;
typedef typename std::iterator_traits<Iter>::difference_type
difference_type;
typedef util::detail::algorithm_result<ExPolicy, FwdIter> result;
typedef typename std::iterator_traits<FwdIter>::reference reference;
typedef typename std::iterator_traits<FwdIter>::difference_type
difference_type;
typedef typename std::iterator_traits<FwdIter2>::difference_type
s_difference_type;

s_difference_type diff = std::distance(s_first, s_last);
Expand All @@ -732,11 +732,12 @@ namespace hpx { namespace parallel { inline namespace v1

util::cancellation_token<difference_type> tok(count);

return util::partitioner<ExPolicy, Iter, void>::
return util::partitioner<ExPolicy, FwdIter, void>::
call_with_index(
std::forward<ExPolicy>(policy), first, count, 1,
[s_first, s_last, tok, op](
Iter it, std::size_t part_size, std::size_t base_idx
FwdIter it, std::size_t part_size,
std::size_t base_idx
) mutable -> void
{
util::loop_idx_n(
Expand All @@ -745,15 +746,15 @@ namespace hpx { namespace parallel { inline namespace v1
reference v, std::size_t i
) -> void
{
for(FwdIter iter = s_first; iter != s_last;
for(FwdIter2 iter = s_first; iter != s_last;
++iter)
{
if (hpx::util::invoke(op, v, *iter))
tok.cancel(i);
}
});
},
[=](std::vector<hpx::future<void> > &&) mutable -> Iter
[=](std::vector<hpx::future<void> > &&) mutable -> FwdIter
{
difference_type find_first_of_res = tok.get_data();

Expand Down Expand Up @@ -827,11 +828,11 @@ namespace hpx { namespace parallel { inline namespace v1
/// fashion in unspecified threads, and indeterminately sequenced
/// within each thread.
///
/// \returns The \a find_first_of algorithm returns a \a hpx::future<FwdIter> if the
/// \returns The \a find_first_of algorithm returns a \a hpx::future<FwdIter1> if the
/// execution policy is of type
/// \a sequenced_task_policy or
/// \a parallel_task_policy and
/// returns \a FwdIter otherwise.
/// returns \a FwdIter1 otherwise.
/// The \a find_first_of algorithm returns an iterator to the first element
/// in the range [first, last) that is equal to an element from the range
/// [s_first, s_last).
Expand Down Expand Up @@ -860,7 +861,7 @@ namespace hpx { namespace parallel { inline namespace v1

typedef std::integral_constant<bool,
execution::is_sequenced_execution_policy<ExPolicy>::value ||
!hpx::traits::is_forward_iterator<FwdIter>::value
!hpx::traits::is_forward_iterator<FwdIter1>::value
> is_seq;
#else
static_assert(
Expand Down

0 comments on commit 078c0f7

Please sign in to comment.