24 #ifndef OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
25 #define OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
27 #include <opm/simulators/linalg/ParallelIstlInformation.hpp>
28 #include <opm/core/props/BlackoilPhases.hpp>
30 #include <dune/grid/common/gridview.hh>
39 std::vector<int> buildAllCells(
const int nc);
45 activePhases(
const PU& pu)
47 const int maxnp = BlackoilPhases::MaxNumPhases;
48 std::vector<bool> active(maxnp,
false);
50 for (
int p = 0; p < pu.MaxNumPhases; ++p) {
51 active[ p ] = pu.phase_used[ p ] != 0;
61 active2Canonical(
const PU& pu)
63 const int maxnp = BlackoilPhases::MaxNumPhases;
64 std::vector<int> act2can(maxnp, -1);
66 for (
int phase = 0; phase < maxnp; ++phase) {
67 if (pu.phase_used[ phase ]) {
68 act2can[ pu.phase_pos[ phase ] ] = phase;
77 double getGravity(
const double* g,
const int dim);
85 std::size_t countLocalInteriorCells(
const Grid& grid)
87 if ( grid.comm().size() == 1)
91 std::size_t count = 0;
92 const auto& gridView = grid.leafGridView();
93 for(
auto cell = gridView.template begin<0, Dune::Interior_Partition>(),
94 endCell = gridView.template end<0, Dune::Interior_Partition>();
95 cell != endCell; ++cell)
110 std::size_t countGlobalCells(
const Grid& grid)
112 if ( grid.comm().size() == 1)
116 std::size_t count = countLocalInteriorCells(grid);
117 return grid.comm().sum(count);
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26