opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
countGlobalCells.hpp
1
/*
2
Copyright 2013, 2015 SINTEF ICT, Applied Mathematics.
3
Copyright 2014, 2015 Dr. Blatt - HPC-Simulation-Software & Services
4
Copyright 2014, 2015 Statoil ASA.
5
Copyright 2015 NTNU
6
Copyright 2015 IRIS AS
7
8
This file is part of the Open Porous Media project (OPM).
9
10
OPM is free software: you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
OPM is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with OPM. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
#ifndef OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
25
#define OPM_COUNTGLOBALCELLS_HEADER_INCLUDED
26
27
#include <dune/grid/common/gridview.hh>
28
29
#include <algorithm>
30
#include <vector>
31
32
namespace
Opm
{
33
namespace
detail {
34
44
template
<
class
Gr
id
View>
45
std::size_t countLocalInteriorCellsGridView(
const
GridView& gridView)
46
{
47
if
(gridView.comm().size() == 1) {
48
return
gridView.size(0);
49
}
50
51
return
std::distance(gridView.template begin<0, Dune::Interior_Partition>(),
52
gridView.template end<0, Dune::Interior_Partition>());
53
}
54
63
template
<
class
Gr
id
>
64
std::size_t countLocalInteriorCells(
const
Grid& grid)
65
{
66
return
countLocalInteriorCellsGridView(grid.leafGridView());
67
}
68
79
template
<
class
Gr
id
>
80
std::size_t countGlobalCells(
const
Grid& grid)
81
{
82
if
( grid.comm().size() == 1)
83
{
84
return
grid.size(0);
85
}
86
const
std::size_t count = countLocalInteriorCellsGridView(grid.leafGridView());
87
return
grid.comm().sum(count);
88
}
89
90
}
// namespace detail
91
}
// namespace Opm
92
93
#endif
// OPM_BLACKOILDETAILS_HEADER_INCLUDED
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition
blackoilbioeffectsmodules.hh:43
opm
simulators
flow
countGlobalCells.hpp
Generated by
1.17.0