Loading...
Searching...
No Matches
GridPartitioning.hpp
//===========================================================================
//
// File: GridPartitioning.hpp
//
// Created: Mon Sep 7 10:09:13 2009
//
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
// Bård Skaflestad <bard.skaflestad@sintef.no>
//
// $Date$
//
// $Revision$
//
//===========================================================================
/*
Copyright 2009, 2010, 2013 SINTEF ICT, Applied Mathematics.
Copyright 2009, 2010 Statoil ASA.
Copyright 2013, 2025 Dr. Markus Blatt - HPC-Simulation-Software & Services
Copyright 2020, 2021 OPM-OP 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 OPM_GRIDPARTITIONING_HEADER
#define OPM_GRIDPARTITIONING_HEADER
#include <vector>
#include <array>
#include <set>
#include <tuple>
#include <dune/common/parallel/mpihelper.hh>
#include <opm/grid/utility/OpmWellType.hpp>
#include <opm/grid/common/WellConnections.hpp>
#include <opm/grid/common/ZoltanGraphFunctions.hpp>
namespace Dune
{
class CpGrid;
struct OrderByFirst
{
bool operator()(const std::pair<int,int>& o, const std::pair<int,int>& v)
{
return o.first < v.first;
}
};
void partition(const CpGrid& grid,
const std::array<int, 3>& initial_split,
int& num_part,
std::vector<int>& cell_part,
bool recursive = false,
bool ensureConnectivity = true);
void addOverlapLayer(const CpGrid& grid,
const std::vector<int>& cell_part,
std::vector<std::set<int> >& cell_overlap,
int mypart,
int overlapLayers,
bool all=false,
int level = -1);
int addOverlapLayer(const CpGrid& grid,
const std::vector<int>& cell_part,
std::vector<std::tuple<int,int,char>>& exportList,
std::vector<std::tuple<int,int,char,int>>& importList,
const Communication<Dune::MPIHelper::MPICommunicator>& cc,
bool addCornerCells,
const double* trans,
int layers = 1,
int level = -1);
namespace cpgrid
{
#if HAVE_MPI
std::tuple<std::vector<int>, std::vector<std::pair<std::string,bool>>,
std::vector<std::tuple<int,int,char> >,
std::vector<std::tuple<int,int,char,int> >,
WellConnections>
createListsFromParts(const CpGrid& grid,
const std::vector<cpgrid::OpmWellType> * wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const double* transmissibilities,
const std::vector<int>& parts,
bool allowDistributedWells,
std::shared_ptr<cpgrid::CombinedGridWellGraph> gridAndWells = nullptr,
int level = -1);
std::tuple<std::vector<int>, std::vector<std::pair<std::string,bool>>,
std::vector<std::tuple<int,int,char> >,
std::vector<std::tuple<int,int,char,int> >,
WellConnections>
vanillaPartitionGridOnRoot(const CpGrid& grid,
const std::vector<cpgrid::OpmWellType> * wells,
const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
const double* transmissibilities,
bool allowDistributedWells);
#endif
} // namespace cpgrid
} // namespace Dune
#endif // OPM_GRIDPARTITIONING_HEADER
Dune::CpGrid
[ provides Dune::Grid ]
Definition CpGrid.hpp:203
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
Dune::partition
void partition(const CpGrid &grid, const coord_t &initial_split, int &num_part, std::vector< int > &cell_part, bool recursive, bool ensureConnectivity)
Partition a CpGrid based on (ijk) coordinates, with splitting to ensure that each partition is connec...
Definition GridPartitioning.cpp:198
Dune::OrderByFirst
Definition GridPartitioning.hpp:58