24#ifndef OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
25#define OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
27#include <opm/core/props/BlackoilPhases.hpp>
29#include <dune/grid/common/gridview.hh>
46 template <
class Gr
idView>
47 std::size_t countLocalInteriorCellsGridView(
const GridView& gridView)
49 if (gridView.comm().size() == 1) {
50 return gridView.size(0);
53 return std::distance(gridView.template begin<0, Dune::Interior_Partition>(),
54 gridView.template end<0, Dune::Interior_Partition>());
66 std::size_t countLocalInteriorCells(
const Grid& grid)
68 return countLocalInteriorCellsGridView(grid.leafGridView());
82 std::size_t countGlobalCells(
const Grid& grid)
84 if ( grid.comm().size() == 1)
88 const std::size_t count = countLocalInteriorCellsGridView(grid.leafGridView());
89 return grid.comm().sum(count);
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27