20 #ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
21 #define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
25 #include <opm/grid/common/WellConnections.hpp>
41 template<
class Gr
id,
class W>
42 void setWellConnections(
const Grid& grid,
const W& wells,
bool useWellConn, std::vector<std::set<int>>& wellGraph)
44 if ( grid.comm().size() > 1)
46 Dune::CartesianIndexMapper< Grid > cartMapper( grid );
47 const int numCells = cartMapper.compressedSize();
48 wellGraph.resize(numCells);
51 const auto& cpgdim = cartMapper.cartesianDimensions();
53 std::vector<int> cart(cpgdim[0]*cpgdim[1]*cpgdim[2], -1);
55 for(
int i=0; i < numCells; ++i )
56 cart[ cartMapper.cartesianIndex( i ) ] = i;
58 Dune::cpgrid::WellConnections well_indices;
59 well_indices.init(wells, cpgdim, cart);
61 for (
auto& well : well_indices)
63 for (
auto perf = well.begin(); perf != well.end(); ++perf)
66 for (++perf2; perf2 != well.end(); ++perf2)
68 wellGraph[*perf].insert(*perf2);
69 wellGraph[*perf2].insert(*perf);
85 template<
class Gr
id,
class Mapper>
86 void findOverlapAndInterior(
const Grid& grid,
const Mapper& mapper, std::vector<int>& overlapRows,
87 std::vector<int>& interiorRows)
90 if ( grid.comm().size() > 1)
93 const auto& gridView = grid.leafGridView();
94 auto elemIt = gridView.template begin<0>();
95 const auto& elemEndIt = gridView.template end<0>();
98 for (; elemIt != elemEndIt; ++elemIt)
100 const auto& elem = *elemIt;
101 int lcell = mapper.index(elem);
103 if (elem.partitionType() != Dune::InteriorEntity)
106 overlapRows.push_back(lcell);
108 interiorRows.push_back(lcell);
119 template <
class Gr
id>
120 size_t numMatrixRowsToUseInSolver(
const Grid& grid,
bool ownerFirst)
122 size_t numInterior = 0;
123 if (!ownerFirst || grid.comm().size()==1)
124 return grid.leafGridView().size(0);
125 const auto& gridView = grid.leafGridView();
126 auto elemIt = gridView.template begin<0>();
127 const auto& elemEndIt = gridView.template end<0>();
130 for (; elemIt != elemEndIt; ++elemIt) {
133 if (elemIt->partitionType() == Dune::InteriorEntity) {
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26