19#ifndef OPM_PARALLELWELLINFO_HEADER_INCLUDED
20#define OPM_PARALLELWELLINFO_HEADER_INCLUDED
22#include <dune/common/parallel/communicator.hh>
23#include <dune/common/parallel/interface.hh>
24#include <dune/common/parallel/mpihelper.hh>
25#include <dune/common/parallel/plocalindex.hh>
26#include <dune/common/parallel/remoteindices.hh>
28#include <opm/simulators/utils/ParallelCommunication.hpp>
51 using LocalIndex = Dune::ParallelLocalIndex<Attribute>;
52 using IndexSet = Dune::ParallelIndexSet<int,LocalIndex,50>;
54 using RI = Dune::RemoteIndices<IndexSet>;
87 const double* current,
96 const double* current,
106 template<
class RAIterator>
112 int numLocalPerfs()
const;
115 Parallel::Communication comm_;
117 IndexSet current_indices_;
120 IndexSet above_indices_;
122 Dune::Interface interface_;
123 Dune::BufferedCommunicator communicator_;
125 std::size_t num_local_perfs_{};
137 using IndexSet = CommunicateAboveBelow::IndexSet;
138 using Attribute = CommunicateAboveBelow::Attribute;
139 using GlobalIndex =
typename IndexSet::IndexPair::GlobalIndex;
144 const Parallel::Communication comm,
145 int num_local_perfs);
152 std::vector<double>
createGlobal(
const std::vector<double>& local_perf_container,
153 std::size_t num_components)
const;
159 void copyGlobalToLocal(
const std::vector<double>& global, std::vector<double>& local,
160 std::size_t num_components)
const;
162 int numGlobalPerfs()
const;
165 const IndexSet& local_indices_;
166 Parallel::Communication comm_;
167 int num_global_perfs_;
169 std::vector<int> sizes_;
171 std::vector<int> displ_;
173 std::vector<int> map_received_;
177 std::vector<int> perf_ecl_index_;
186 static constexpr int INVALID_ECL_INDEX = -1;
199 Parallel::Communication allComm);
201 const Parallel::Communication& communication()
const
222 const double* current,
223 std::size_t size)
const;
229 const std::vector<double>& current)
const;
237 const double* current,
238 std::size_t size)
const;
244 const std::vector<double>& current)
const;
256 const std::string&
name()
const
264 return hasLocalCells_;
280 template<
typename It>
281 typename It::value_type
sumPerfValues(It begin, It end)
const;
290 template<
class RAIterator>
293 commAboveBelow_->partialSumPerfValues(begin, end);
311 void operator()(Parallel::Communication* comm);
322 int rankWithFirstPerf_;
326 std::unique_ptr<Parallel::Communication, DestroyComm> comm_;
329 std::unique_ptr<CommunicateAboveBelow> commAboveBelow_;
331 std::unique_ptr<GlobalPerfContainerFactory> globalPerfCont_;
349 bool checkAllConnectionsFound();
352 std::vector<std::size_t> foundConnections_;
363bool operator<(
const std::pair<std::string, bool>& pair,
const ParallelWellInfo& well);
365bool operator<(
const ParallelWellInfo& well,
const std::pair<std::string, bool>& pair);
367bool operator==(
const std::pair<std::string, bool>& pair,
const ParallelWellInfo& well);
369bool operator==(
const ParallelWellInfo& well,
const std::pair<std::string, bool>& pair);
371bool operator!=(
const std::pair<std::string, bool>& pair,
const ParallelWellInfo& well);
373bool operator!=(
const ParallelWellInfo& well,
const std::pair<std::string, bool>& pair);
Class checking that all connections are on active cells.
Definition ParallelWellInfo.hpp:338
void connectionFound(std::size_t index)
Inidicate that the i-th completion was found.
Definition ParallelWellInfo.cpp:621
Class to facilitate getting values associated with the above/below perforation.
Definition ParallelWellInfo.hpp:40
void beginReset()
Indicates that we will add the index information.
Definition ParallelWellInfo.cpp:208
void clear()
Clear all the parallel information.
Definition ParallelWellInfo.cpp:197
const IndexSet & getIndexSet() const
Get index set for the local perforations.
Definition ParallelWellInfo.cpp:410
void partialSumPerfValues(RAIterator begin, RAIterator end) const
Do a (in place) partial sum on values attached to all perforations.
Definition ParallelWellInfo.cpp:240
int endReset()
Indicates that the index information is complete.
Definition ParallelWellInfo.cpp:220
std::vector< double > communicateAbove(double first_value, const double *current, std::size_t size)
Creates an array of values for the perforation above.
Definition ParallelWellInfo.cpp:315
void pushBackEclIndex(int above, int current, bool owner=true)
Adds information about original index of the perforations in ECL Schedule.
Definition ParallelWellInfo.cpp:370
std::vector< double > communicateBelow(double first_value, const double *current, std::size_t size)
Creates an array of values for the perforation below.
Definition ParallelWellInfo.cpp:342
A factory for creating a global data representation for distributed wells.
Definition ParallelWellInfo.hpp:135
void copyGlobalToLocal(const std::vector< double > &global, std::vector< double > &local, std::size_t num_components) const
Copies the values of the global perforation to the local representation.
Definition ParallelWellInfo.cpp:155
std::vector< double > createGlobal(const std::vector< double > &local_perf_container, std::size_t num_components) const
Creates a container that holds values for all perforations.
Definition ParallelWellInfo.cpp:106
Class encapsulating some information about parallel wells.
Definition ParallelWellInfo.hpp:184
bool hasLocalCells() const
Whether local cells are perforated somewhen.
Definition ParallelWellInfo.hpp:262
void pushBackEclIndex(int above, int current)
Adds information about the ecl indices of the perforations.
Definition ParallelWellInfo.cpp:458
void clear()
Free data of communication data structures.
Definition ParallelWellInfo.cpp:492
const std::string & name() const
Name of the well.
Definition ParallelWellInfo.hpp:256
It::value_type sumPerfValues(It begin, It end) const
Sum all the values of the perforations.
Definition ParallelWellInfo.cpp:480
void communicateFirstPerforation(bool hasFirst)
Collectively decide which rank has first perforation.
Definition ParallelWellInfo.cpp:447
const GlobalPerfContainerFactory & getGlobalPerfContainerFactory() const
Get a factor to create a global representation of peforation data.
Definition ParallelWellInfo.cpp:552
std::vector< double > communicateBelowValues(double last_value, const double *current, std::size_t size) const
Creates an array of values for the perforation below.
Definition ParallelWellInfo.cpp:536
std::vector< double > communicateAboveValues(double first_value, const double *current, std::size_t size) const
Creates an array of values for the perforation above.
Definition ParallelWellInfo.cpp:521
void beginReset()
Inidicate that we will reset the ecl index information.
Definition ParallelWellInfo.cpp:463
void partialSumPerfValues(RAIterator begin, RAIterator end) const
Do a (in place) partial sum on values attached to all perforations.
Definition ParallelWellInfo.hpp:291
T broadcastFirstPerforationValue(const T &t) const
If the well does not have any open connections the member rankWithFirstPerf is not initialized,...
Definition ParallelWellInfo.cpp:500
void endReset()
Inidicate completion of reset of the ecl index information.
Definition ParallelWellInfo.cpp:469
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27