Skip to content

Commit

Permalink
Converted to new iterator adaptor usage for views and groups
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornung67 committed Apr 10, 2023
1 parent bb607ba commit 8be9e4e
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions src/axom/sidre/core/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,41 +169,36 @@ void Group::getDataInfoHelper(Node& n, bool recursive) const
//
// Gather info from Views owned by this Group
//
IndexType vidx = getFirstValidViewIndex();
while(indexIsValid(vidx))
for(auto& view : views())
{
const View* view = getView(vidx);

if(view->isExternal())
if(view.isExternal())
{
num_views_external += 1;
num_bytes_external += view->getTotalBytes();
num_bytes_external += view.getTotalBytes();
}
else if(view->isScalar())
else if(view.isScalar())
{
num_views_scalar += 1;
num_bytes_assoc_with_views += view->getTotalBytes();
num_bytes_assoc_with_views += view.getTotalBytes();
}
else if(view->isString())
else if(view.isString())
{
num_views_string += 1;
num_bytes_assoc_with_views += view->getTotalBytes();
num_bytes_assoc_with_views += view.getTotalBytes();
}
else if(view->hasBuffer())
else if(view.hasBuffer())
{
num_views_buffer += 1;
if(view->isAllocated())
if(view.isAllocated())
{
num_bytes_assoc_with_views += view->getTotalBytes();
num_bytes_assoc_with_views += view.getTotalBytes();
}
}
else
{
num_views_empty += 1;
}

vidx = getNextValidViewIndex(vidx);
}
}

//
// Update Node entries with data info for this Group
Expand All @@ -223,12 +218,9 @@ void Group::getDataInfoHelper(Node& n, bool recursive) const
//
if(recursive)
{
IndexType gidx = getFirstValidGroupIndex();
while(indexIsValid(gidx))
for(auto& group : groups())
{
this->getGroup(gidx)->getDataInfoHelper(n, recursive);

gidx = getNextValidGroupIndex(gidx);
group.getDataInfoHelper(n, recursive);
}
}
}
Expand Down

0 comments on commit 8be9e4e

Please sign in to comment.