20#ifndef OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
21#define OPM_FINDOVERLAPROWSANDCOLUMNS_HEADER_INCLUDED
25#include <opm/grid/common/WellConnections.hpp>
26#include <opm/grid/common/CartesianIndexMapper.hpp>
46 template<
class Gr
id,
class CartMapper,
class W>
47 void setWellConnections(
const Grid& grid,
const CartMapper& cartMapper,
const W& wells,
bool useWellConn, std::vector<std::set<int>>& wellGraph,
int numJacobiBlocks)
49 if ( grid.comm().size() > 1 || numJacobiBlocks > 1)
51 const int numCells = cartMapper.compressedSize();
52 wellGraph.resize(numCells);
55 const auto& cpgdim = cartMapper.cartesianDimensions();
57 std::vector<int> cart(cpgdim[0]*cpgdim[1]*cpgdim[2], -1);
59 for(
int i=0; i < numCells; ++i )
60 cart[ cartMapper.cartesianIndex( i ) ] = i;
62 Dune::cpgrid::WellConnections well_indices;
63 well_indices.init(wells, cpgdim, cart);
65 for (
auto& well : well_indices)
67 for (
auto perf = well.begin(); perf != well.end(); ++perf)
70 for (++perf2; perf2 != well.end(); ++perf2)
72 wellGraph[*perf].insert(*perf2);
73 wellGraph[*perf2].insert(*perf);
89 template<
class Gr
id,
class Mapper>
90 void findOverlapAndInterior(
const Grid& grid,
const Mapper& mapper, std::vector<int>& overlapRows,
91 std::vector<int>& interiorRows)
94 if ( grid.comm().size() > 1)
97 const auto& gridView = grid.leafGridView();
99 for (
const auto& elem : elements(gridView))
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();
128 const auto& range = elements(gridView, Dune::Partitions::interior);
129 numInterior = std::distance(range.begin(), range.end());
Definition findOverlapRowsAndColumns.hpp:29
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27