Skip to content

Commit

Permalink
Review update.
Browse files Browse the repository at this point in the history
Co-authored-by: Tobias Ribizel<ribizel@kit.edu>
  • Loading branch information
pratikvn committed Mar 29, 2022
1 parent 7a8c7e6 commit 43545a0
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions include/ginkgo/core/base/index_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ class index_set {
*/
using index_type = IndexType;

/**
* Creates an empty Array not tied to any executor.
*/
index_set() noexcept
: exec_(nullptr), index_space_size_{0}, num_stored_indices_{0}
{}

/**
* Creates an empty index_set tied to the specified Executor.
*
Expand Down Expand Up @@ -211,13 +204,6 @@ class index_set {
if (&other == this) {
return *this;
}
if (other.get_executor() == nullptr) {
this->clear();
return *this;
}
if (exec_ == nullptr) {
this->exec_ = other.get_executor();
}
this->index_space_size_ = other.index_space_size_;
this->num_stored_indices_ = other.num_stored_indices_;
this->subsets_begin_ = other.subsets_begin_;
Expand All @@ -242,17 +228,8 @@ class index_set {
if (&other == this) {
return *this;
}
if (other.get_executor() == nullptr) {
this->clear();
return *this;
}
if (exec_ == nullptr) {
this->exec_ = other.get_executor();
}
this->index_space_size_ = other.index_space_size_;
this->num_stored_indices_ = other.num_stored_indices_;
other.index_space_size_ = 0;
other.num_stored_indices_ = 0;
this->index_space_size_ = std::exchange(other.index_space_size_, 0);
this->num_stored_indices_ = std::exchange(other.num_stored_indices_, 0);
this->subsets_begin_ = std::move(other.subsets_begin_);
this->subsets_end_ = std::move(other.subsets_end_);
this->superset_cumulative_indices_ =
Expand Down Expand Up @@ -462,11 +439,11 @@ class index_set {
const bool is_sorted);

std::shared_ptr<const Executor> exec_;
index_type index_space_size_{};
index_type num_stored_indices_{};
gko::Array<index_type> subsets_begin_{};
gko::Array<index_type> subsets_end_{};
gko::Array<index_type> superset_cumulative_indices_{};
index_type index_space_size_;
index_type num_stored_indices_;
gko::Array<index_type> subsets_begin_;
gko::Array<index_type> subsets_end_;
gko::Array<index_type> superset_cumulative_indices_;
};


Expand Down

0 comments on commit 43545a0

Please sign in to comment.