WellConnections.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 Dr. Blatt - HPC-Simulation-Software & Services.
3 Copyright 2016 Statoil AS
4
5 This file is part of The Open Porous Media project (OPM).
6
7 OPM is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 OPM is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with OPM. If not, see <http://www.gnu.org/licenses/>.
19*/
20#ifndef DUNE_CPGRID_WELL_CONNECTIONS_HEADER_INCLUDED
21#define DUNE_CPGRID_WELL_CONNECTIONS_HEADER_INCLUDED
22
23#include <set>
24#include <unordered_set>
25#include <vector>
26#include <functional>
27
28#ifdef HAVE_MPI
30#include "mpi.h"
32#endif
33
34#include <dune/common/parallel/communication.hh>
35
36#include <opm/grid/CpGrid.hpp>
38
39namespace Dune
40{
41namespace cpgrid
42{
43
51{
52
53public:
55 typedef std::vector<std::set<int> >::const_iterator const_iterator;
56
59
60 WellConnections() = default;
61
68 WellConnections(const std::vector<OpmWellType>& wells,
69 const std::array<int, 3>& cartesianSize,
70 const std::vector<int>& cartesian_to_compressed);
71
75 WellConnections(const std::vector<OpmWellType>& wells,
76 const Dune::CpGrid& cpGrid);
77
84 void init(const std::vector<OpmWellType>& wells,
85 const std::array<int, 3>& cartesianSize,
86 const std::vector<int>& cartesian_to_compressed);
87
92 const std::set<int>& operator[](std::size_t i) const
93 {
94 return well_indices_[i];
95 }
96
99 {
100 return well_indices_.begin();
101 }
102
105 {
106 return well_indices_.end();
107 }
108
110 std::size_t size() const
111 {
112 return well_indices_.size();
113 }
114private:
117 std::vector<std::set<int> > well_indices_;
118};
119
120
121#ifdef HAVE_MPI
133std::vector<std::vector<int> >
134perforatingWellIndicesOnProc(const std::vector<int>& parts,
135 const std::vector<Dune::cpgrid::OpmWellType>& wells,
136 const CpGrid& cpgrid);
137
155std::vector<std::vector<int> >
156postProcessPartitioningForWells(std::vector<int>& parts,
157 std::function<int(int)> gid,
158 const std::vector<OpmWellType>& wells,
159 const WellConnections& well_connections,
160 const std::vector<std::set<int> >& wellGraph,
161 std::vector<std::tuple<int,int,char>>& exportList,
162 std::vector<std::tuple<int,int,char,int>>& importList,
163 const Communication<MPI_Comm>& cc);
164
173std::vector<std::pair<std::string,bool>>
174computeParallelWells(const std::vector<std::vector<int> >& wells_on_proc,
175 const std::vector<OpmWellType>& wells,
176 const Communication<MPI_Comm>& cc,
177 int root);
178#endif
179} // end namespace cpgrid
180} // end namespace Dune
181
182#endif
[ provides Dune::Grid ]
Definition: CpGrid.hpp:238
A class calculating and representing all connections of wells.
Definition: WellConnections.hpp:51
const_iterator begin() const
Get a begin iterator.
Definition: WellConnections.hpp:98
WellConnections(const std::vector< OpmWellType > &wells, const std::array< int, 3 > &cartesianSize, const std::vector< int > &cartesian_to_compressed)
Constructor.
const std::set< int > & operator[](std::size_t i) const
Access all connections of a well.
Definition: WellConnections.hpp:92
const_iterator end() const
Get the end iterator.
Definition: WellConnections.hpp:104
void init(const std::vector< OpmWellType > &wells, const std::array< int, 3 > &cartesianSize, const std::vector< int > &cartesian_to_compressed)
Initialze the data of the container.
WellConnections(const std::vector< OpmWellType > &wells, const Dune::CpGrid &cpGrid)
Constructor.
const_iterator iterator
The iterator type (always const).
Definition: WellConnections.hpp:58
std::vector< std::set< int > >::const_iterator const_iterator
The const iterator type.
Definition: WellConnections.hpp:55
std::size_t size() const
\breif Get the number of wells
Definition: WellConnections.hpp:110
std::vector< std::vector< int > > postProcessPartitioningForWells(std::vector< int > &parts, std::function< int(int)> gid, const std::vector< OpmWellType > &wells, const WellConnections &well_connections, const std::vector< std::set< int > > &wellGraph, std::vector< std::tuple< int, int, char > > &exportList, std::vector< std::tuple< int, int, char, int > > &importList, const Communication< MPI_Comm > &cc)
Computes wells assigned to processes.
std::vector< std::vector< int > > perforatingWellIndicesOnProc(const std::vector< int > &parts, const std::vector< Dune::cpgrid::OpmWellType > &wells, const CpGrid &cpgrid)
Determines the wells that have perforate cells for each process.
std::vector< std::pair< std::string, bool > > computeParallelWells(const std::vector< std::vector< int > > &wells_on_proc, const std::vector< OpmWellType > &wells, const Communication< MPI_Comm > &cc, int root)
Computes whether wells are perforating cells on this process.
The namespace Dune is the main namespace for all Dune code.
Definition: common/CartesianIndexMapper.hpp:10