mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-13 01:12:02 -05:00
Used std::distance instead of manual for-loop.
This commit is contained in:
1 parent
ca8de16285
commit
f791884639
1 file changed
+5
-9
@@ -631,15 +631,11 @@ public:
|
||||
return grid.leafGridView().size(0);
|
||||
}
|
||||
const auto& gridView = grid.leafGridView();
|
||||
const auto& elemEndIt = gridView.template end</*codim=*/0, Dune::Interior_Partition>();
|
||||
std::size_t global_nc = 0;
|
||||
|
||||
for (auto elemIt = gridView.template begin</*codim=*/0, Dune::Interior_Partition>();
|
||||
elemIt != elemEndIt; ++elemIt)
|
||||
{
|
||||
++global_nc;
|
||||
}
|
||||
return grid.comm().sum(global_nc);
|
||||
constexpr int codim = 0;
|
||||
constexpr auto Part = Dune::Interior_Partition;
|
||||
auto local_cells = std::distance(gridView.template begin<codim, Part>(),
|
||||
gridView.template end<codim, Part>());
|
||||
return grid.comm().sum(local_cells);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Reference in new issue
Block a user