39 #ifndef OPM_CPGRID_HEADER 40 #define OPM_CPGRID_HEADER 43 #include <opm/grid/utility/platform_dependent/disable_warnings.h> 45 #include <dune/grid/common/grid.hh> 47 #include <opm/grid/utility/platform_dependent/reenable_warnings.h> 49 #include <opm/grid/common/GridEnums.hpp> 51 #include <opm/grid/cpgrid/CpGridDataTraits.hpp> 52 #include <opm/grid/cpgrid/DefaultGeometryPolicy.hpp> 53 #include <opm/grid/cpgrid/OrientedEntityTable.hpp> 57 #include <opm/grid/utility/OpmWellType.hpp> 75 template <
int>
class Entity;
76 template<
int,
int>
class Geometry;
77 class HierarchicIterator;
78 class IntersectionIterator;
79 template<
int, PartitionIteratorType>
class Iterator;
80 class LevelGlobalIdSet;
83 class IntersectionIterator;
142 template <PartitionIteratorType pitype>
154 template <PartitionIteratorType pitype>
160 typedef Dune::GridView<DefaultLeafGridViewTraits<CpGrid> >
LeafGridView;
167 typedef Dune::GridView<DefaultLeafGridViewTraits<CpGrid>>
LeafGridView;
180 using CollectiveCommunication = cpgrid::CpGridDataTraits::CollectiveCommunication;
202 :
public GridDefaultImplementation<3, 3, double, CpGridFamily>
227 explicit CpGrid(MPIHelper::MPICommunicator
comm);
230 std::vector<std::size_t>
268 Opm::EclipseState* ecl_state,
269 bool periodic_extension,
273 bool edge_conformal);
312 std::vector<std::size_t>
314 Opm::EclipseState* ecl_state,
315 bool periodic_extension,
316 bool turn_normals =
false,
318 bool edge_conformal =
false);
319 #endif // HAVE_OPM_COMMON 336 bool remove_ij_boundary,
337 bool turn_normals =
false,
338 bool edge_conformal =
false);
356 const std::array<double, 3>& cellsize,
357 const std::array<int, 3>& shift = {0,0,0});
374 const std::vector<std::shared_ptr<Dune::cpgrid::CpGridData>>&
currentData()
const;
377 std::vector<std::shared_ptr<Dune::cpgrid::CpGridData>>&
currentData();
392 void getIJK(
const int c, std::array<int,3>& ijk)
const;
413 std::string
name()
const;
420 typename Traits::template Codim<codim>::LevelIterator
lbegin (
int level)
const;
423 typename Traits::template Codim<codim>::LevelIterator
lend (
int level)
const;
426 template<
int codim, PartitionIteratorType PiType>
427 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lbegin (
int level)
const;
429 template<
int codim, PartitionIteratorType PiType>
430 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lend (
int level)
const;
434 typename Traits::template Codim<codim>::LeafIterator
leafbegin()
const;
437 typename Traits::template Codim<codim>::LeafIterator
leafend()
const;
440 template<
int codim, PartitionIteratorType PiType>
441 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafbegin()
const;
443 template<
int codim, PartitionIteratorType PiType>
444 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafend()
const;
447 int size (
int level,
int codim)
const;
450 int size (
int codim)
const;
453 int size (
int level, GeometryType type)
const;
456 int size (GeometryType type)
const;
475 void globalRefine (
int refCount,
bool throwOnFailure =
false);
477 const std::vector<Dune::GeometryType>& geomTypes(
const int)
const;
502 const std::vector<std::array<int,3>>& startIJK_vec,
503 const std::vector<std::array<int,3>>& endIJK_vec,
504 const std::vector<std::string>& lgr_name_vec,
505 const std::vector<std::string>& lgr_parent_grid_name_vec = std::vector<std::string>{});
513 void autoRefine(
const std::array<int,3>& nxnynz);
516 const std::map<std::string,int>& getLgrNameToLevel()
const;
524 std::array<double,3> getEclCentroid(
const int& idx)
const;
532 std::array<double,3> getEclCentroid(
const cpgrid::Entity<0>& elem)
const;
565 bool mark(
int refCount,
const cpgrid::Entity<0>& element,
bool throwOnFailure =
false);
570 int getMark(
const cpgrid::Entity<0>& element)
const;
599 const std::vector<std::array<int,3>>& cells_per_dim_vec,
600 const std::vector<int>& assignRefinedLevel,
601 const std::vector<std::string>& lgr_name_vec,
602 const std::vector<std::array<int,3>>& startIJK_vec = std::vector<std::array<int,3>>{},
603 const std::vector<std::array<int,3>>& endIJK_vec = std::vector<std::array<int,3>>{});
610 void updateCornerHistoryLevels(
const std::vector<std::vector<std::array<int,2>>>& cornerInMarkedElemWithEquivRefinedCorner,
611 const std::map<std::array<int,2>,std::array<int,2>>& elemLgrAndElemLgrCorner_to_refinedLevelAndRefinedCorner,
612 const std::unordered_map<
int,std::array<int,2>>& adaptedCorner_to_elemLgrAndElemLgrCorner,
613 const int& corner_count,
614 const std::vector<std::array<int,2>>& preAdaptGrid_corner_history,
615 const int& preAdaptMaxLevel,
616 const int& newLevels);
618 void globalIdsPartitionTypesLgrAndLeafGrids(
const std::vector<int>& assignRefinedLevel,
619 const std::vector<std::array<int,3>>& cells_per_dim_vec,
620 const std::vector<int>& lgr_with_at_least_one_active_cell);
628 void getFirstChildGlobalIds([[maybe_unused]] std::vector<int>& parentToFirstChildGlobalIds);
650 void computeGlobalCellLgr(
const int& level,
const std::array<int,3>& startIJK, std::vector<int>& global_cell_lgr);
655 void computeGlobalCellLeafGridViewWithLgrs(std::vector<int>& global_cell_leaf);
671 void markElemAssignLevelDetectActiveLgrs(
const std::vector<std::array<int,3>>& startIJK_vec,
672 const std::vector<std::array<int,3>>& endIJK_vec,
673 std::vector<int>& assignRefinedLevel,
674 std::vector<int>& lgr_with_at_least_one_active_cell);
677 void populateCellIndexSetRefinedGrid(
int level);
680 void populateCellIndexSetLeafGridView();
683 void populateLeafGlobalIdSet();
712 void setPartitioningParams(
const std::map<std::string,std::string>& params);
726 int partitionMethod = Dune::PartitionMethod::zoltan,
727 double imbalanceTol = 1.1,
759 int partitionMethod = Dune::PartitionMethod::zoltan,
760 int edgeWeightMethod = Dune::EdgeWeightMethod::defaultTransEdgeWgt,
761 double imbalanceTol = 1.1,
810 std::pair<bool,std::vector<std::pair<std::string,bool>>>
812 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections = {},
813 const double* transmissibilities =
nullptr,
814 int overlapLayers=1,
int partitionMethod=Dune::PartitionMethod::zoltanGoG,
818 false, transmissibilities,
false,
819 overlapLayers, partitionMethod, 1.1,
false,
858 std::pair<bool,std::vector<std::pair<std::string,bool>>>
860 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections = {},
861 const double* transmissibilities =
nullptr,
bool ownersFirst=
false,
862 bool addCornerCells=
false,
int overlapLayers=1,
863 int partitionMethod = Dune::PartitionMethod::zoltanGoG,
864 double imbalanceTol = 1.1,
867 return scatterGrid(method, ownersFirst, wells, possibleFutureConnections,
false,
868 transmissibilities, addCornerCells, overlapLayers, partitionMethod, imbalanceTol,
900 template<
class DataHandle>
901 std::pair<bool, std::vector<std::pair<std::string,bool> > >
903 const std::vector<cpgrid::OpmWellType> * wells,
904 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections = {},
905 const double* transmissibilities =
nullptr,
906 int overlapLayers=1,
int partitionMethod = 1,
int level =-1)
908 auto ret =
loadBalance(wells, possibleFutureConnections, transmissibilities, overlapLayers, partitionMethod, level);
951 template<
class DataHandle>
952 std::pair<bool, std::vector<std::pair<std::string,bool> > >
954 const std::vector<cpgrid::OpmWellType> * wells,
955 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
956 bool serialPartitioning,
957 const double* transmissibilities =
nullptr,
bool ownersFirst=
false,
958 bool addCornerCells=
false,
int overlapLayers=1,
int partitionMethod = Dune::PartitionMethod::zoltanGoG,
959 double imbalanceTol = 1.1,
960 bool allowDistributedWells =
false,
961 bool useTransToFilterOverlap =
true)
963 auto ret = scatterGrid(method, ownersFirst, wells, possibleFutureConnections, serialPartitioning, transmissibilities,
964 addCornerCells, overlapLayers, partitionMethod, imbalanceTol, allowDistributedWells,
965 std::vector<int>{}, 0,
966 useTransToFilterOverlap);
999 template<
class DataHandle>
1000 std::pair<bool, std::vector<std::pair<std::string,bool> > >
1002 const std::vector<cpgrid::OpmWellType> * wells,
1003 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections = {},
1004 bool ownersFirst=
false,
1005 bool addCornerCells=
false,
int overlapLayers=1)
1009 possibleFutureConnections,
1012 addCornerCells, overlapLayers, Dune::PartitionMethod::simple,
1030 template<
class DataHandle>
1032 decltype(data.fixedSize(0,0)) overlapLayers=1,
int partitionMethod = Dune::PartitionMethod::zoltan)
1036 bool ret =
loadBalance(overlapLayers, partitionMethod);
1055 bool loadBalance(
const std::vector<int>& parts,
bool ownersFirst=
false,
1056 bool addCornerCells=
false,
int overlapLayers=1)
1063 addCornerCells, overlapLayers, Dune::PartitionMethod::simple,
1080 template<
class DataHandle>
1081 bool loadBalance(DataHandle& data,
const std::vector<int>& parts,
bool ownersFirst=
false,
1082 bool addCornerCells=
false,
int overlapLayers=1)
1084 bool ret =
loadBalance(parts, ownersFirst, addCornerCells, overlapLayers);
1107 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
1108 const double* transmissibilities,
1110 const double imbalanceTol)
const;
1119 template<
class DataHandle>
1120 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir,
int )
const 1132 template<
class DataHandle>
1133 void communicate (DataHandle& data, InterfaceType iftype, CommunicationDirection dir)
const;
1149 typedef Dune::FieldVector<double, 3> Vector;
1152 const std::vector<double>& zcornData()
const;
1160 int numCells(
int level = -1)
const;
1166 int numFaces(
int level = -1)
const;
1188 int cellFace(
int cell,
int local_index,
int level = -1)
const;
1213 int faceCell(
int face,
int local_index,
int level = -1)
const;
1223 int numFaceVertices(
int face)
const;
1229 int faceVertex(
int face,
int local_index)
const;
1238 const Vector faceAreaNormalEcl(
int face)
const;
1272 :
public RandomAccessIteratorFacade<CentroidIterator<codim>,
1273 FieldVector<double, 3>,
1274 const FieldVector<double, 3>&, int>
1278 typedef typename std::vector<
cpgrid::Geometry<3-codim, 3> >::const_iterator
1286 const FieldVector<double,3>& dereference()
const 1288 return iter_->center();
1294 const FieldVector<double,3>& elementAt(
int n)
1296 return iter_[n]->center();
1298 void advance(
int n){
1324 int boundaryId(
int face)
const;
1332 template<
class Cell2FacesRowIterator>
1334 faceTag(
const Cell2FacesRowIterator& cell_face)
const;
1347 template<
class DataHandle>
1365 template<
class DataHandle>
1413 using ParallelIndexSet = cpgrid::CpGridDataTraits::ParallelIndexSet;
1416 using RemoteIndices = cpgrid::CpGridDataTraits::RemoteIndices;
1419 using CommunicationType = cpgrid::CpGridDataTraits::CommunicationType;
1424 const CommunicationType& cellCommunication()
const;
1426 ParallelIndexSet& getCellIndexSet();
1428 RemoteIndices& getCellRemoteIndices();
1430 const ParallelIndexSet& getCellIndexSet()
const;
1432 const RemoteIndices& getCellRemoteIndices()
const;
1470 std::pair<bool, std::vector<std::pair<std::string,bool> > >
1473 const std::vector<cpgrid::OpmWellType> * wells,
1474 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
1475 bool serialPartitioning,
1476 const double* transmissibilities,
1477 bool addCornerCells,
1479 int partitionMethod = Dune::PartitionMethod::zoltanGoG,
1480 double imbalanceTol = 1.1,
1481 bool allowDistributedWells =
true,
1482 const std::vector<int>& input_cell_part = {},
1484 bool useTransToFilterOverlap =
true);
1490 std::vector<std::shared_ptr<cpgrid::CpGridData>> data_;
1492 std::vector<std::shared_ptr<cpgrid::CpGridData>> distributed_data_;
1494 std::vector<std::shared_ptr<cpgrid::CpGridData>>* current_data_;
1496 std::map<std::string,int> lgr_names_ = {{
"GLOBAL", 0}};
1502 std::shared_ptr<InterfaceMap> cell_scatter_gather_interfaces_;
1508 std::shared_ptr<InterfaceMap> point_scatter_gather_interfaces_;
1512 std::shared_ptr<cpgrid::GlobalIdSet> global_id_set_ptr_;
1518 std::map<std::string,std::string> partitioningParams;
1524 #include <opm/grid/cpgrid/Entity.hpp> 1525 #include <opm/grid/cpgrid/Iterators.hpp> 1526 #include <opm/grid/cpgrid/CpGridData.hpp> 1532 namespace Capabilities
1538 static const bool v =
true;
1545 static const bool v =
true;
1551 static const bool v =
true;
1557 static const bool v =
true;
1564 static const bool v =
false;
1569 template<
class DataHandle>
1572 current_data_->back()->communicate(data, iftype, dir);
1576 template<
class DataHandle>
1580 if (distributed_data_.empty()) {
1581 OPM_THROW(std::runtime_error,
"Moving Data only allowed with a load balanced grid!");
1583 distributed_data_[0]->scatterData(handle, data_[0].
get(),
1584 distributed_data_[0].
get(),
1591 template<
class DataHandle>
1595 if (distributed_data_.empty()) {
1596 OPM_THROW(std::runtime_error,
"Moving Data only allowed with a load balance grid!");
1598 distributed_data_[0]->gatherData(handle, data_[0].
get(), distributed_data_[0].
get());
1604 template<
class Cell2FacesRowIterator>
1617 const int cell = cell_face.getCellIndex();
1618 const int face = *cell_face;
1619 assert (0 <= cell); assert (cell <
numCells());
1620 assert (0 <= face); assert (face <
numFaces());
1625 const F2C& f2c = current_data_->back()->face_to_cell_[f];
1626 const face_tag tag = current_data_->back()->face_tag_[f];
1628 assert ((f2c.size() == 1) || (f2c.size() == 2));
1630 int inside_cell = 0;
1632 if ( f2c.size() == 2 )
1634 if ( f2c[1].index() == cell )
1639 const bool normal_is_in = ! f2c[inside_cell].orientation();
1644 return normal_is_in ? 0 : 1;
1647 return normal_is_in ? 2 : 3;
1651 return normal_is_in ? 4 : 5;
1656 OPM_THROW(std::logic_error,
"Unhandled face tag. This should never happen!");
1665 #include <opm/grid/cpgrid/PersistentContainer.hpp> 1666 #include <opm/grid/cpgrid/CartesianIndexMapper.hpp> 1667 #include "cpgrid/Intersection.hpp" 1668 #include "cpgrid/Geometry.hpp" 1669 #include "cpgrid/Indexsets.hpp" 1671 #endif // OPM_CPGRID_HEADER Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
bool refineAndUpdateGrid(bool throwOnFailure, const std::vector< std::array< int, 3 >> &cells_per_dim_vec, const std::vector< int > &assignRefinedLevel, const std::vector< std::string > &lgr_name_vec, const std::vector< std::array< int, 3 >> &startIJK_vec=std::vector< std::array< int, 3 >>{}, const std::vector< std::array< int, 3 >> &endIJK_vec=std::vector< std::array< int, 3 >>{})
Triggers the grid refinement process, allowing to select diffrent refined level grids.
Definition: CpGrid.cpp:1847
Definition: CpGrid.hpp:189
std::vector< cpgrid::Geometry< 3-codim, 3 > >::const_iterator GeometryIterator
The type of the iterator over the codim geometries.
Definition: CpGrid.hpp:1279
Traits associated with a specific grid partition type.
Definition: CpGrid.hpp:143
void switchToGlobalView()
Switch to the global view.
Definition: CpGrid.cpp:1662
double faceArea(int face) const
Get the area of a face.
Definition: CpGrid.cpp:1571
unsigned int numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: CpGrid.cpp:1114
const std::vector< std::shared_ptr< Dune::cpgrid::CpGridData > > & currentData() const
Returns either data_ or distributed_data_(if non empty).
Definition: CpGrid.cpp:664
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: CpGrid.cpp:1021
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: CpGrid.cpp:1033
cpgrid::HierarchicIterator HierarchicIterator
The type of the hierarchic iterator.
Definition: CpGrid.hpp:114
GlobalIdSet LocalIdSet
The type of the local id set.
Definition: CpGrid.hpp:176
Raw corner-point specification of a particular geological model.
Definition: preprocess.h:56
cpgrid::IndexSet LeafIndexSet
The type of the leaf index set.
Definition: CpGrid.hpp:172
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: CpGrid.cpp:1026
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, EdgeWeightMethod method, const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections, bool serialPartitioning, const double *transmissibilities=nullptr, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltanGoG, double imbalanceTol=1.1, bool allowDistributedWells=false, bool useTransToFilterOverlap=true)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:953
cpgrid::GlobalIdSet GlobalIdSet
The type of the global id set.
Definition: CpGrid.hpp:174
Definition: CpGrid.hpp:99
int faceTag(const Cell2FacesRowIterator &cell_face) const
Get the cartesian tag associated with a face tag.
Definition: CpGrid.hpp:1606
int faceCell(int face, int local_index, int level=-1) const
Get the index identifying a cell attached to a face.
Definition: CpGrid.cpp:1186
The namespace Dune is the main namespace for all Dune code.
Definition: CartesianIndexMapper.hpp:9
int getMark(const cpgrid::Entity< 0 > &element) const
Return refinement mark for entity.
Definition: CpGrid.cpp:1795
Connection topologically normal to I-J plane.
Definition: preprocess.h:69
cpgrid::CpGridDataTraits::InterfaceMap InterfaceMap
The type of the map describing communication interfaces.
Definition: CpGrid.hpp:1369
const std::vector< int > & globalCell() const
Retrieve mapping from internal ("compressed") active grid cells to external ("uncompressed") cells...
Definition: CpGrid.cpp:683
Definition: Intersection.hpp:62
cpgrid::Intersection LeafIntersection
The type of the intersection at the leafs of the grid.
Definition: CpGrid.hpp:105
const std::vector< int > & sortedNumAquiferCells() const
Get sorted active cell indices of numerical aquifer.
Definition: CpGrid.cpp:1606
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: CpGrid.cpp:992
void setUniqueBoundaryIds(bool uids)
Set whether we want to have unique boundary ids.
Definition: CpGrid.cpp:759
Arbitrary non-neighbouring connection.
Definition: preprocess.h:70
Dune::GridView< DefaultLeafGridViewTraits< CpGrid > > LeafGridView
The type of the leaf grid view associated with this partition type.
Definition: CpGrid.hpp:160
const InterfaceMap & cellScatterGatherInterface() const
Get an interface for gathering/scattering data attached to cells with communication.
Definition: CpGrid.cpp:1652
bool uniqueBoundaryIds() const
Is the grid currently using unique boundary ids?
Definition: CpGrid.cpp:754
[ provides Dune::Grid ]
Definition: CpGrid.hpp:201
Traits associated with a specific grid partition type.
Definition: CpGrid.hpp:155
cpgrid::IntersectionIterator LevelIntersectionIterator
The type of the intersection iterator at the levels of the grid.
Definition: CpGrid.hpp:111
This class encapsulates geometry for vertices, intersections, and cells.
Definition: CpGridData.hpp:94
bool mark(int refCount, const cpgrid::Entity< 0 > &element, bool throwOnFailure=false)
------------— Adaptivity (begin) ------------—
Definition: CpGrid.cpp:1776
std::vector< std::unordered_map< std::size_t, std::size_t > > mapLocalCartesianIndexSetsToLeafIndexSet() const
Compute for each level grid, a map from the global_cell_[ cell index in level grid ] to the leaf inde...
Definition: CpGrid.cpp:729
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.cpp:71
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:117
Iterator intended to be used as LeafIterator and LevelIterator (no difference due to no adaptivity) f...
Definition: Entity.hpp:96
bool loadBalance(DataHandle &data, decltype(data.fixedSize(0, 0)) overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltan)
Distributes this grid and data over the available nodes in a distributed machine. ...
Definition: CpGrid.hpp:1031
bool loadBalance(int overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltan, double imbalanceTol=1.1, int level=-1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:725
const Vector & cellCentroid(int cell) const
Get the coordinates of the center of a cell.
Definition: CpGrid.cpp:1591
cpgrid::Entity< cd > Entity
The type of the entity.
Definition: CpGrid.hpp:129
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Use the transmissibilities as edge weights.
Definition: GridEnums.hpp:38
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: CpGrid.cpp:1016
std::vector< std::array< int, 2 > > mapLeafIndexSetToLocalCartesianIndexSets() const
Reverse map: from leaf index cell to { level, local/level Cartesian index of the cell }...
Definition: CpGrid.cpp:739
int numCells(int level=-1) const
Get the number of cells.
Definition: CpGrid.cpp:1150
unsigned int overlapSize(int) const
Size of the overlap on the leaf level.
Definition: CpGrid.cpp:1092
int numVertices() const
Get The number of vertices.
Definition: CpGrid.cpp:1162
bool loadBalance(DataHandle &data, const std::vector< int > &parts, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid and data over the available nodes in a distributed machine. ...
Definition: CpGrid.hpp:1081
double cellCenterDepth(int cell_index) const
Get vertical position of cell center ("zcorn" average).
Definition: CpGrid.cpp:1424
CpGrid Grid
The type that implements the grid.
Definition: CpGrid.hpp:102
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
cpgrid::Iterator< cd, pitype > LevelIterator
The type of the iterator over the level entities of this codim on this partition. ...
Definition: CpGrid.hpp:146
Connection topologically normal to I-K plane.
Definition: preprocess.h:68
void switchToDistributedView()
Switch to the distributed view.
Definition: CpGrid.cpp:1667
CentroidIterator< 0 > beginCellCentroids() const
Get an iterator over the cell centroids positioned at the first one.
Definition: CpGrid.cpp:1596
cpgrid::IntersectionIterator LeafIntersectionIterator
The type of the intersection iterator at the leafs of the grid.
Definition: CpGrid.hpp:109
void scatterData(DataHandle &handle) const
Moves data from the global (all data on process) view to the distributed view.
Dune::cpgrid::Intersection getParentIntersectionFromLgrBoundaryFace(const Dune::cpgrid::Intersection &intersection) const
Returns the coarse-level-zero ("parent/origin") intersection of a refined intersection (face) in the ...
Definition: CpGrid.cpp:1239
CpGrid()
Default constructor.
Definition: CpGrid.cpp:166
double cellVolume(int cell) const
Get the volume of the cell.
Definition: CpGrid.cpp:1586
Traits associated with a specific codim.
Definition: CpGrid.hpp:119
void communicate(DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int) const
The new communication interface.
Definition: CpGrid.hpp:1120
const InterfaceMap & pointScatterGatherInterface() const
Get an interface for gathering/scattering data attached to points with communication.
Definition: CpGrid.cpp:1657
int numFaces(int level=-1) const
Get the number of faces.
Definition: CpGrid.cpp:1156
unsigned int ghostSize(int) const
Size of the ghost cell layer on the leaf level.
Definition: CpGrid.cpp:1098
Connection topologically normal to J-K plane.
Definition: preprocess.h:67
void gatherData(DataHandle &handle) const
Moves data from the distributed view to the global (all data on process) view.
bool adapt()
Triggers the grid refinement process.
Definition: CpGrid.cpp:1812
int maxLevel() const
Return maximum level defined in this grid. Levels are 0 and 1, maxlevel = 1 (not counting leafview)...
Definition: CpGrid.cpp:769
bool loadBalanceSerial(int overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltan, int edgeWeightMethod=Dune::EdgeWeightMethod::defaultTransEdgeWgt, double imbalanceTol=1.1, int level=-1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:758
cpgrid::Iterator< cd, All_Partition > LeafIterator
The type of the iterator over all leaf entities of this codim.
Definition: CpGrid.hpp:135
const Vector & vertexPosition(int vertex) const
Get the Position of a vertex.
Definition: CpGrid.cpp:1566
cpgrid::Entity< codim > entity(const cpgrid::Entity< codim > &seed) const
given an EntitySeed (or EntityPointer) return an entity object
Definition: CpGrid.cpp:1082
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(EdgeWeightMethod method, const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections={}, const double *transmissibilities=nullptr, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltanGoG, double imbalanceTol=1.1, int level=-1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:859
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections={}, const double *transmissibilities=nullptr, int overlapLayers=1, int partitionMethod=Dune::PartitionMethod::zoltanGoG, int level=-1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:811
const std::array< int, 3 > & logicalCartesianSize() const
The logical cartesian size of the global grid.
Definition: CpGrid.cpp:657
void postAdapt()
Clean up refinement markers - set every element to the mark 0 which represents 'doing nothing'...
Definition: CpGrid.cpp:2385
Dune::GridView< DefaultLevelGridViewTraits< CpGrid > > LevelGridView
The type of the level grid view associated with this partition type.
Definition: CpGrid.hpp:158
An iterator over the centroids of the geometry of the entities.
Definition: CpGrid.hpp:1271
Only needs to provide interface for doing nothing.
Definition: Iterators.hpp:117
The global id set for Dune.
Definition: Indexsets.hpp:482
const Vector & faceNormal(int face) const
Get the unit normal of a face.
Definition: CpGrid.cpp:1581
void autoRefine(const std::array< int, 3 > &nxnynz)
Global refine the grid with different refinement factors in each direction.
Definition: CpGrid.cpp:2750
cpgrid::Iterator< cd, pitype > LeafIterator
The type of the iterator over the leaf entities of this codim on this partition.
Definition: CpGrid.hpp:148
int faceVertex(int face, int local_index) const
Get the index identifying a vertex of a face.
Definition: CpGrid.cpp:1234
const Vector & faceCentroid(int face) const
Get the coordinates of the center of a face.
Definition: CpGrid.cpp:1576
cpgrid::Geometry< 3-cd, 3 > LocalGeometry
The type of the local geometry associated with the entity.
Definition: CpGrid.hpp:126
face_tag
Connection taxonomy.
Definition: preprocess.h:66
CpGridFamily GridFamily
Family typedef, why is this not defined by Grid<>?
Definition: CpGrid.hpp:218
void syncDistributedGlobalCellIds()
Synchronizes cell global ids across processes after load balancing.
Definition: CpGrid.cpp:2530
const Dune::cpgrid::CpGridData & currentLeafData() const
Returns current view data (the leaf grid)
Definition: CpGrid.cpp:673
CentroidIterator< 1 > beginFaceCentroids() const
Get an iterator over the face centroids positioned at the first one.
Definition: CpGrid.cpp:1601
cpgrid::IndexSet LevelIndexSet
The type of the level index set.
Definition: CpGrid.hpp:170
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
CentroidIterator(GeometryIterator iter)
Constructs a new iterator from an iterator over the geometries.
Definition: CpGrid.hpp:1282
cpgrid::Geometry< 3-cd, 3 > Geometry
The type of the geometry associated with the entity.
Definition: CpGrid.hpp:123
Low-level corner-point processing routines and supporting data structures.
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections={}, const double *transmissibilities=nullptr, int overlapLayers=1, int partitionMethod=1, int level=-1)
Distributes this grid and data over the available nodes in a distributed machine. ...
Definition: CpGrid.hpp:902
Represents an entity of a given codim, with positive or negative orientation.
Definition: CpGridData.hpp:96
int cellFace(int cell, int local_index, int level=-1) const
Get a specific face of a cell.
Definition: CpGrid.cpp:1174
Definition: Indexsets.hpp:56
cpgrid::Intersection LevelIntersection
The type of the intersection at the levels of the grid.
Definition: CpGrid.hpp:107
int numCellFaces() const
Get the sum of all faces attached to all cells.
Definition: CpGrid.cpp:1224
void globalRefine(int refCount, bool throwOnFailure=false)
Refine the grid refCount times using the default refinement rule.
Definition: CpGrid.cpp:1038
const CpGridTraits::Communication & comm() const
Get the collective communication object.
Definition: CpGrid.cpp:1139
bool loadBalance(const std::vector< int > &parts, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:1055
void createCartesian(const std::array< int, 3 > &dims, const std::array< double, 3 > &cellsize, const std::array< int, 3 > &shift={0, 0, 0})
Create a cartesian grid.
Definition: CpGrid.cpp:585
cpgrid::CpGridDataTraits::Communication Communication
The type of the collective communication.
Definition: CpGrid.hpp:179
Definition: Intersection.hpp:275
Dune::GridView< DefaultLevelGridViewTraits< CpGrid > > LevelGridView
The type of the level grid view associated with this partition type.
Definition: CpGrid.hpp:165
std::pair< bool, std::vector< std::pair< std::string, bool > > > loadBalance(DataHandle &data, const std::vector< int > &parts, const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections={}, bool ownersFirst=false, bool addCornerCells=false, int overlapLayers=1)
Distributes this grid over the available nodes in a distributed machine.
Definition: CpGrid.hpp:1001
std::string name() const
Get the grid name.
Definition: CpGrid.cpp:764
std::vector< int > zoltanPartitionWithoutScatter(const std::vector< cpgrid::OpmWellType > *wells, const std::unordered_map< std::string, std::set< int >> &possibleFutureConnections, const double *transmissibilities, const int numParts, const double imbalanceTol) const
Partitions the grid using Zoltan without decomposing and distributing it among processes.
Definition: CpGrid.cpp:189
bool preAdapt()
Set mightVanish flags for elements that will be refined in the next adapt() call Need to be called af...
Definition: CpGrid.cpp:1800
A class used as a row type for OrientedEntityTable.
Definition: OrientedEntityTable.hpp:54
void processEclipseFormat(const grdecl &input_data, bool remove_ij_boundary, bool turn_normals=false, bool edge_conformal=false)
Read the Eclipse grid format ('grdecl').
Definition: CpGrid.cpp:1743
void getIJK(const int c, std::array< int, 3 > &ijk) const
Extract Cartesian index triplet (i,j,k) of an active cell.
Definition: CpGrid.cpp:749
const cpgrid::OrientedEntityTable< 0, 1 >::row_type cellFaceRow(int cell) const
Get a list of indices identifying all faces of a cell.
Definition: CpGrid.cpp:1181
cpgrid::Entity< cd > EntitySeed
The type of the entity pointer for entities of this codim.
Definition: CpGrid.hpp:138
Dune::GridView< DefaultLeafGridViewTraits< CpGrid > > LeafGridView
The type of the leaf grid view associated with this partition type.
Definition: CpGrid.hpp:167
void addLgrsUpdateLeafView(const std::vector< std::array< int, 3 >> &cells_per_dim_vec, const std::vector< std::array< int, 3 >> &startIJK_vec, const std::vector< std::array< int, 3 >> &endIJK_vec, const std::vector< std::string > &lgr_name_vec, const std::vector< std::string > &lgr_parent_grid_name_vec=std::vector< std::string >{})
Create a grid out of a coarse one and (at most) 2 refinements(LGRs) of selected block-shaped disjoint...
Definition: CpGrid.cpp:2593
cpgrid::Iterator< cd, All_Partition > LevelIterator
The type of the iterator over all level entities of this codim.
Definition: CpGrid.hpp:132
EdgeWeightMethod
enum for choosing Methods for weighting graph-edges correspoding to cell interfaces in Zoltan's or Me...
Definition: GridEnums.hpp:34