Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

884 rename getNumTotalChildren to getNumDescendants #980

Merged
merged 1 commit into from
Aug 17, 2020
Merged
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
4 changes: 2 additions & 2 deletions src/vt/collective/scatter/scatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ char* Scatter::applyScatterRecur(
}

void Scatter::scatterIn(ScatterMsg* msg) {
auto const& total_children = getNumTotalChildren();
auto const& total_children = getNumDescendants();
auto const& elm_size = msg->elm_bytes_;
auto const& total_size = msg->total_bytes_;
auto in_base_ptr = reinterpret_cast<char*>(msg) + sizeof(ScatterMsg);
Expand All @@ -91,7 +91,7 @@ void Scatter::scatterIn(ScatterMsg* msg) {
user_handler, total_size, elm_size, in_ptr - in_base_ptr, total_children
);
Tree::foreachChild([&](NodeType child) {
auto const& num_children = getNumTotalChildren(child) + 1;
auto const& num_children = getNumDescendants(child) + 1;
auto const& child_bytes_size = num_children * elm_size;
auto child_msg = makeMessageSz<ScatterMsg>(
child_bytes_size, child_bytes_size, elm_size
Expand Down
8 changes: 4 additions & 4 deletions src/vt/collective/tree/tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ Tree::NodeListType Tree::getChildren(NodeType node) const {
return children;
}

std::size_t Tree::getNumTotalChildren(NodeType child) const {
std::size_t Tree::getNumDescendants(NodeType child) const {
std::size_t total = 0;
auto children = getChildren(child);
for (auto&& elm : children) {
total += getNumTotalChildren(elm);
total += getNumDescendants(elm);
}
return total + children.size();
}

std::size_t Tree::getNumTotalChildren() const {
std::size_t Tree::getNumDescendants() const {
auto total_size = 0;
foreachChild([this,&total_size](NodeType child){
total_size += getNumTotalChildren(child);
total_size += getNumDescendants(child);
});
return total_size;
}
Expand Down
8 changes: 4 additions & 4 deletions src/vt/collective/tree/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ struct Tree {
*
* \return number of descendants
*/
std::size_t getNumTotalChildren(NodeType child) const;
std::size_t getNumDescendants(NodeType child) const;

/**
* \internal \brief Get total children in tree
* \internal \brief Get total number of descendants in the tree.
*
* \return number of children
* \return number of descendants
*/
std::size_t getNumTotalChildren() const;
std::size_t getNumDescendants() const;

private:
bool set_up_tree_ = false;
Expand Down