mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Change the type of the argument possibleFutureConnections from a pointer to a const reference
This commit is contained in:
@@ -953,10 +953,10 @@ private:
|
||||
? param.num_local_domains_
|
||||
: num_cells / default_cells_per_domain;
|
||||
|
||||
auto possibleFutureConnectionSet = this->model_.simulator().vanguard().schedule().getPossibleFutureConnections();
|
||||
const auto& possibleFutureConnectionSet = this->model_.simulator().vanguard().schedule().getPossibleFutureConnections();
|
||||
return ::Opm::partitionCells(param.local_domain_partition_method_,
|
||||
num_domains,
|
||||
grid.leafGridView(), wells, &possibleFutureConnectionSet, zoltan_ctrl);
|
||||
grid.leafGridView(), wells, possibleFutureConnectionSet, zoltan_ctrl);
|
||||
}
|
||||
|
||||
std::vector<int> reconstitutePartitionVector() const
|
||||
|
||||
@@ -216,7 +216,7 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
#if HAVE_OPENCL || HAVE_ROCSPARSE || HAVE_CUDA
|
||||
if (partitionJacobiBlocks) {
|
||||
this->cell_part_ = this->grid_->
|
||||
zoltanPartitionWithoutScatter(&wells, &possibleFutureConnections, faceTrans.data(),
|
||||
zoltanPartitionWithoutScatter(&wells, possibleFutureConnections, faceTrans.data(),
|
||||
numJacobiBlocks,
|
||||
imbalanceTol);
|
||||
}
|
||||
@@ -350,13 +350,13 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeights
|
||||
: std::vector<int>{};
|
||||
//For this case, simple partitioning is selected automatically
|
||||
parallelWells =
|
||||
std::get<1>(this->grid_->loadBalance(handle, parts, &wells, &possibleFutureConnections, ownersFirst,
|
||||
std::get<1>(this->grid_->loadBalance(handle, parts, &wells, possibleFutureConnections, ownersFirst,
|
||||
addCornerCells, overlapLayers));
|
||||
}
|
||||
else {
|
||||
parallelWells =
|
||||
std::get<1>(this->grid_->loadBalance(handle, edgeWeightsMethod,
|
||||
&wells, &possibleFutureConnections,
|
||||
&wells, possibleFutureConnections,
|
||||
serialPartitioning,
|
||||
faceTrans.data(), ownersFirst,
|
||||
addCornerCells, overlapLayers,
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
template <class GridView, class Element>
|
||||
void buildLocalGraph(const GridView& grid_view,
|
||||
const std::vector<Opm::Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const Opm::ZoltanPartitioningControl<Element>& zoltan_ctrl);
|
||||
|
||||
/// Partition rank's interior cells into non-overlapping domains using
|
||||
@@ -181,7 +181,7 @@ private:
|
||||
template <typename Comm>
|
||||
void connectWells(const Comm comm,
|
||||
const std::vector<Opm::Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const std::unordered_map<int, int>& g2l);
|
||||
};
|
||||
|
||||
@@ -198,7 +198,7 @@ ZoltanPartitioner::ZoltanPartitioner(const GridView&
|
||||
template <class GridView, class Element>
|
||||
void ZoltanPartitioner::buildLocalGraph(const GridView& grid_view,
|
||||
const std::vector<Opm::Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const Opm::ZoltanPartitioningControl<Element>& zoltan_ctrl)
|
||||
{
|
||||
this->connectWells(grid_view.comm(), wells, possibleFutureConnections, this->connectElements(grid_view, zoltan_ctrl));
|
||||
@@ -287,7 +287,7 @@ ZoltanPartitioner::connectElements(const GridView&
|
||||
template <typename Comm>
|
||||
void ZoltanPartitioner::connectWells(const Comm comm,
|
||||
const std::vector<Opm::Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const std::unordered_map<int, int>& g2l)
|
||||
{
|
||||
auto distributedWells = 0;
|
||||
@@ -305,17 +305,15 @@ void ZoltanPartitioner::connectWells(const Comm
|
||||
|
||||
cellIx.push_back(locPos->second);
|
||||
}
|
||||
if (possibleFutureConnections) {
|
||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections->find(well.name());
|
||||
if (possibleFutureConnectionSetIt != possibleFutureConnections->end()) {
|
||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
auto locPos = g2l.find(global_index);
|
||||
if (locPos == g2l.end()) {
|
||||
++otherProc;
|
||||
continue;
|
||||
}
|
||||
cellIx.push_back(locPos->second);
|
||||
const auto possibleFutureConnectionSetIt = possibleFutureConnections.find(well.name());
|
||||
if (possibleFutureConnectionSetIt != possibleFutureConnections.end()) {
|
||||
for (auto& global_index : possibleFutureConnectionSetIt->second) {
|
||||
auto locPos = g2l.find(global_index);
|
||||
if (locPos == g2l.end()) {
|
||||
++otherProc;
|
||||
continue;
|
||||
}
|
||||
cellIx.push_back(locPos->second);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +356,7 @@ std::pair<std::vector<int>, int>
|
||||
partitionCellsZoltan(const int num_domains,
|
||||
const GridView& grid_view,
|
||||
const std::vector<Opm::Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const Opm::ZoltanPartitioningControl<Element>& zoltan_ctrl)
|
||||
{
|
||||
if (num_domains <= 1) { // No partitioning => every cell in domain zero.
|
||||
@@ -593,7 +591,7 @@ Opm::partitionCells(const std::string& method,
|
||||
const int num_local_domains,
|
||||
const GridView& grid_view,
|
||||
[[maybe_unused]] const std::vector<Well>& wells,
|
||||
[[maybe_unused]] const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
[[maybe_unused]] const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
[[maybe_unused]] const ZoltanPartitioningControl<Element>& zoltan_ctrl)
|
||||
{
|
||||
if (method == "zoltan") {
|
||||
@@ -691,7 +689,7 @@ Opm::partitionCellsSimple(const int num_cells, const int num_domains)
|
||||
const std::remove_cv_t<std::remove_reference_t< \
|
||||
decltype(std::declval<Grid>().leafGridView())>>&, \
|
||||
const std::vector<Opm::Well>&, \
|
||||
const std::unordered_map<std::string, std::set<int>>*, \
|
||||
const std::unordered_map<std::string, std::set<int>>&, \
|
||||
const Opm::ZoltanPartitioningControl< \
|
||||
typename std::remove_cv_t<std::remove_reference_t< \
|
||||
decltype(std::declval<Grid>().leafGridView())>>::template Codim<0>::Entity>&)
|
||||
|
||||
@@ -93,7 +93,7 @@ partitionCells(const std::string& method,
|
||||
const int num_local_domains,
|
||||
const GridView& grid_view,
|
||||
const std::vector<Well>& wells,
|
||||
const std::unordered_map<std::string, std::set<int>>* possibleFutureConnections,
|
||||
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
|
||||
const ZoltanPartitioningControl<Element>& zoltan_ctrl);
|
||||
|
||||
/// Read a partitioning from file, assumed to contain one number per cell, its partition number.
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace detail
|
||||
cart[ cartMapper.cartesianIndex( i ) ] = i;
|
||||
|
||||
Dune::cpgrid::WellConnections well_indices;
|
||||
well_indices.init(wells, &possibleFutureConnections, cpgdim, cart);
|
||||
well_indices.init(wells, possibleFutureConnections, cpgdim, cart);
|
||||
|
||||
for (auto& well : well_indices)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user