26#ifndef OPM_GRAPH_OF_GRID_HEADER
27#define OPM_GRAPH_OF_GRID_HEADER
42template<
typename Gr
id>
44 using WeightType = float;
45 using EdgeList = std::map<int,WeightType>;
47 struct VertexProperties
50 WeightType weight = 1;
56 const double* transmissibilities=
nullptr,
61 createGraph(transmissibilities,edgeWeightMethod, level);
89 auto pgID = graph.find(gID);
90 if (pgID == graph.end())
97 pgID = graph.find(gID);
109 auto pgID =
find(gID);
110 if (pgID == graph.end())
112 OPM_THROW(std::logic_error,
"GraphOfGrid::getVertex: gID is not in the graph!");
122 auto pgID =
find(gID);
123 if (pgID == graph.end())
129 return pgID->second.edges.size();
137 auto pgID =
find(gID);
138 if (pgID==graph.end())
140 OPM_THROW(std::logic_error,
"GraphOfGrid::edgeList: gID is not in the graph!");
142 return pgID->second.edges;
160 void addWell (
const std::set<int>& well,
bool checkIntersection=
true);
176 for (
int i=0; i<layers; ++i)
188 void createGraph (
const double* transmissibilities=
nullptr,
196 int wellID (
int gID)
const;
206 void mergeWellIndices(
const std::set<int>& well);
211 void contractWellAndAdd(
const std::set<int>& well);
214 std::unordered_map<int, VertexProperties> graph;
215 std::list<std::set<int>> wells;
A class storing a graph representation of the grid.
Definition: GraphOfGrid.hpp:43
const Grid & getGrid() const
Definition: GraphOfGrid.hpp:64
const auto & getWells() const
Return the list of wells.
Definition: GraphOfGrid.hpp:163
auto end() const
Definition: GraphOfGrid.hpp:79
int numEdges(int gID) const
Number of vertices for given vertex.
Definition: GraphOfGrid.hpp:120
void addWell(const std::set< int > &well, bool checkIntersection=true)
Register the well to the list of wells.
int contractVertices(int gID1, int gID2)
Contract two vertices.
void addNeighboringCellsToWells(int layers)
Definition: GraphOfGrid.hpp:174
GraphOfGrid(const Grid &grid_, const double *transmissibilities=nullptr, const Dune::EdgeWeightMethod edgeWeightMethod=Dune::EdgeWeightMethod::defaultTransEdgeWgt, int level=-1)
Definition: GraphOfGrid.hpp:55
int size() const
Number of graph vertices.
Definition: GraphOfGrid.hpp:70
void addNeighboringCellsToWells()
Contract a layer of verices around each well into it.
const VertexProperties & getVertex(int gID) const
Return properties of vertex of given ID.
Definition: GraphOfGrid.hpp:107
const EdgeList & edgeList(int gID) const
List of neighbors for given vertex.
Definition: GraphOfGrid.hpp:134
auto find(int gID) const
Get iterator to the vertex with this global ID or ID of the well containing it.
Definition: GraphOfGrid.hpp:86
auto begin() const
Definition: GraphOfGrid.hpp:75
EdgeWeightMethod
enum for choosing Methods for weighting graph-edges correspoding to cell interfaces in Zoltan's or Me...
Definition: GridEnums.hpp:34
@ defaultTransEdgeWgt
Use the transmissibilities as edge weights.
Definition: GridEnums.hpp:38
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.hpp:26