Loading...
Searching...
No Matches
WellConnections.hpp
/*
Copyright 2016 Dr. Blatt - HPC-Simulation-Software & Services.
Copyright 2016 Statoil AS
This file is part of The Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DUNE_CPGRID_WELL_CONNECTIONS_HEADER_INCLUDED
#define DUNE_CPGRID_WELL_CONNECTIONS_HEADER_INCLUDED
#include <set>
#include <unordered_set>
#include <vector>
#include <functional>
#ifdef HAVE_MPI
#include <opm/grid/utility/platform_dependent/disable_warnings.h>
#include "mpi.h"
#include <opm/grid/utility/platform_dependent/reenable_warnings.h>
#endif
#include <dune/common/parallel/communication.hh>
#include <opm/grid/CpGrid.hpp>
#include <opm/grid/utility/OpmWellType.hpp>
namespace Dune
{
namespace cpgrid
{
class WellConnections
{
public:
typedef std::vector<std::set<int> >::const_iterator const_iterator;
typedef const_iterator iterator;
WellConnections() = default;
WellConnections(const std::vector<OpmWellType>& wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const std::array<int, 3>& cartesianSize,
const std::vector<int>& cartesian_to_compressed);
WellConnections(const std::vector<OpmWellType>& wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const Dune::CpGrid& cpGrid);
void init(const std::vector<OpmWellType>& wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const std::array<int, 3>& cartesianSize,
const std::vector<int>& cartesian_to_compressed);
const std::set<int>& operator[](std::size_t i) const
{
return well_indices_[i];
}
const_iterator begin() const
{
return well_indices_.begin();
}
const_iterator end() const
{
return well_indices_.end();
}
std::size_t size() const
{
return well_indices_.size();
}
private:
std::vector<std::set<int> > well_indices_;
};
#ifdef HAVE_MPI
std::vector<std::vector<int> >
perforatingWellIndicesOnProc(const std::vector<int>& parts,
const std::vector<Dune::cpgrid::OpmWellType>& wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const CpGrid& cpgrid);
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);
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);
#endif
} // end namespace cpgrid
} // end namespace Dune
#endif
Dune::CpGrid
[ provides Dune::Grid ]
Definition CpGrid.hpp:203
Dune::cpgrid::WellConnections::begin
const_iterator begin() const
Get a begin iterator.
Definition WellConnections.hpp:110
Dune::cpgrid::WellConnections::init
void init(const std::vector< OpmWellType > &wells, const std::unordered_map< std::string, std::set< int > > &possibleFutureConnections, const std::array< int, 3 > &cartesianSize, const std::vector< int > &cartesian_to_compressed)
Initialze the data of the container.
Definition WellConnections.cpp:108
Dune::cpgrid::WellConnections::operator[]
const std::set< int > & operator[](std::size_t i) const
Access all connections of a well.
Definition WellConnections.hpp:104
Dune::cpgrid::WellConnections::end
const_iterator end() const
Get the end iterator.
Definition WellConnections.hpp:116
Dune::cpgrid::WellConnections::iterator
const_iterator iterator
The iterator type (always const).
Definition WellConnections.hpp:58
Dune::cpgrid::WellConnections::const_iterator
std::vector< std::set< int > >::const_iterator const_iterator
The const iterator type.
Definition WellConnections.hpp:55
Dune::cpgrid::WellConnections::size
std::size_t size() const
\breif Get the number of wells
Definition WellConnections.hpp:122
Dune::cpgrid
Copyright 2019 Equinor AS.
Definition GridPartitioning.cpp:673
Dune
The namespace Dune is the main namespace for all Dune code.
Definition CartesianIndexMapper.hpp:10