Dune::cpgrid::CpGridData Class Reference

Struct that hods all the data needed to represent a Cpgrid. More...

#include <CpGridData.hpp>

Public Types

enum  { MAX_DATA_PER_CELL = 2 }
 
using MPICommunicator = CpGridDataTraits::MPICommunicator
 The type of the mpi communicator. More...
 
using Communication = CpGridDataTraits::Communication
 The type of the collective communication. More...
 
using CollectiveCommunication = CpGridDataTraits::CollectiveCommunication
 
using AttributeSet = CpGridDataTraits::AttributeSet
 The type of the set of the attributes. More...
 
using Communicator = CpGridDataTraits::Communicator
 The type of the Communicator. More...
 
using InterfaceMap = CpGridDataTraits::InterfaceMap
 The type of the map describing communication interfaces. More...
 
using CommunicationType = CpGridDataTraits::CommunicationType
 type of OwnerOverlap communication for cells More...
 
using ParallelIndexSet = CpGridDataTraits::ParallelIndexSet
 The type of the parallel index set. More...
 
using RemoteIndices = CpGridDataTraits::RemoteIndices
 The type of the remote indices information. More...
 

Public Member Functions

 CpGridData (MPIHelper::MPICommunicator comm, std::vector< std::shared_ptr< CpGridData > > &data)
 
 CpGridData (std::vector< std::shared_ptr< CpGridData > > &data)
 Constructor. More...
 
 ~CpGridData ()
 Destructor. More...
 
int size (int codim) const
 number of leaf entities per codim in this process More...
 
int size (GeometryType type) const
 number of leaf entities per geometry type in this process More...
 
void readSintefLegacyFormat (const std::string &grid_prefix)
 
void writeSintefLegacyFormat (const std::string &grid_prefix) const
 
void readEclipseFormat (const std::string &filename, bool periodic_extension, bool turn_normals=false)
 
void processEclipseFormat (const grdecl &input_data, std::array< std::set< std::pair< int, int > >, 2 > &nnc, bool remove_ij_boundary, bool turn_normals, bool pinchActive, double tolerance_unique_points)
 
void getIJK (int c, std::array< int, 3 > &ijk) const
 Extract Cartesian index triplet (i,j,k) of an active cell. More...
 
bool disjointPatches (const std::vector< std::array< int, 3 > > &startIJK_vec, const std::vector< std::array< int, 3 > > &endIJK_vec) const
 Determine if a finite amount of patches (of cells) are disjoint, namely, they do not share any corner nor face. More...
 
std::vector< int > getPatchesCells (const std::vector< std::array< int, 3 > > &startIJK_vec, const std::vector< std::array< int, 3 > > &endIJK_vec) const
 Compute cell indices of selected patches of cells (Cartesian grid required). More...
 
bool hasNNCs (const std::vector< int > &cellIndices) const
 Check all cells selected for refinement have no NNCs (no neighbor connections). Assumption: all grid cells are active. More...
 
void validStartEndIJKs (const std::vector< std::array< int, 3 > > &startIJK_vec, const std::vector< std::array< int, 3 > > &endIJK_vec) const
 Check startIJK and endIJK of each patch of cells to be refined are valid, i.e. startIJK and endIJK vectors have the same size and, startIJK < endIJK coordenate by coordenate. More...
 
void checkCuboidShape (const std::vector< int > &cellIdx_vec) const
 Check that every cell to be refined has cuboid shape. More...
 
bool patchesShareFace (const std::vector< std::array< int, 3 > > &startIJK_vec, const std::vector< std::array< int, 3 > > &endIJK_vec) const
 Determine if a finite amount of patches (of cells) share a face. More...
 
std::tuple< const std::shared_ptr< CpGridData >, const std::vector< std::array< int, 2 > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::tuple< int, std::vector< int > >, const std::vector< std::array< int, 2 > >, const std::vector< std::array< int, 2 > > > refineSingleCell (const std::array< int, 3 > &cells_per_dim, const int &parent_idx) const
 Refine a single cell and return a shared pointer of CpGridData type. More...
 
std::tuple< std::shared_ptr< CpGridData >, const std::vector< std::array< int, 2 > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::array< int, 2 > >, const std::vector< std::array< int, 2 > > > refinePatch (const std::array< int, 3 > &cells_per_dim, const std::array< int, 3 > &startIJK, const std::array< int, 3 > &endIJK) const
 Refine a (connected block-shaped) patch of cells. Based on the patch, a Geometry<3,3> object is created and refined. More...
 
std::array< double, 3 > computeEclCentroid (const int idx) const
 
std::array< double, 3 > computeEclCentroid (const Entity< 0 > &elem) const
 
void computeUniqueBoundaryIds ()
 
bool uniqueBoundaryIds () const
 
void setUniqueBoundaryIds (bool uids)
 
const std::vector< double > & zcornData () const
 
const IndexSetindexSet () const
 
const cpgrid::IdSetlocalIdSet () const
 Get the local index set. More...
 
const std::array< int, 3 > & logicalCartesianSize () const
 
void distributeGlobalGrid (CpGrid &grid, const CpGridData &view_data, const std::vector< int > &cell_part)
 Redistribute a global grid. More...
 
template<class DataHandle >
void communicate (DataHandle &data, InterfaceType iftype, CommunicationDirection dir)
 communicate objects for all codims on a given level More...
 
CommunicationTypecellCommunication ()
 Get the owner-overlap-copy communication for cells. More...
 
const CommunicationTypecellCommunication () const
 Get the owner-overlap-copy communication for cells. More...
 
ParallelIndexSetcellIndexSet ()
 
const ParallelIndexSetcellIndexSet () const
 
RemoteIndicescellRemoteIndices ()
 
const RemoteIndicescellRemoteIndices () const
 
const std::vector< int > & sortedNumAquiferCells () const
 Get sorted active cell indices of numerical aquifer. More...
 

Friends

template<class T , int i>
struct mover::Mover
 
class GlobalIdSet
 
class HierarchicIterator
 
class Dune::cpgrid::IndexSet
 
class Dune::CpGrid
 
template<int >
class Entity
 
template<int >
class EntityRep
 
class Intersection
 
class PartitionTypeIndicator
 

Detailed Description

Struct that hods all the data needed to represent a Cpgrid.

Member Typedef Documentation

◆ AttributeSet

The type of the set of the attributes.

◆ CollectiveCommunication

◆ Communication

The type of the collective communication.

◆ CommunicationType

type of OwnerOverlap communication for cells

◆ Communicator

◆ InterfaceMap

The type of the map describing communication interfaces.

◆ MPICommunicator

◆ ParallelIndexSet

◆ RemoteIndices

The type of the remote indices information.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_DATA_PER_CELL 

The maximum data items allowed per cell (DUNE < 2.5.2)

    Due to a bug in DUNE < 2.5.2 we need to limit this when
    communicating. 1 is big enough for OPM as we always use
    one block for all unknowns, but some DUNE's grid checks
    actually need 2. So 2 it is. 

Constructor & Destructor Documentation

◆ CpGridData() [1/2]

Dune::cpgrid::CpGridData::CpGridData ( MPIHelper::MPICommunicator  comm,
std::vector< std::shared_ptr< CpGridData > > &  data 
)
explicit

Constructor for parallel grid data.

Parameters
commThe MPI communicator Default constructor.

◆ CpGridData() [2/2]

Dune::cpgrid::CpGridData::CpGridData ( std::vector< std::shared_ptr< CpGridData > > &  data)
explicit

Constructor.

◆ ~CpGridData()

Dune::cpgrid::CpGridData::~CpGridData ( )

Destructor.

Member Function Documentation

◆ cellCommunication() [1/2]

CommunicationType & Dune::cpgrid::CpGridData::cellCommunication ( )
inline

Get the owner-overlap-copy communication for cells.

Suitable e.g. for parallel linear algebra used by CCFV

Referenced by cellIndexSet(), and cellRemoteIndices().

◆ cellCommunication() [2/2]

const CommunicationType & Dune::cpgrid::CpGridData::cellCommunication ( ) const
inline

Get the owner-overlap-copy communication for cells.

Suitable e.g. for parallel linear algebra used by CCFV

◆ cellIndexSet() [1/2]

ParallelIndexSet & Dune::cpgrid::CpGridData::cellIndexSet ( )
inline

References cellCommunication().

◆ cellIndexSet() [2/2]

const ParallelIndexSet & Dune::cpgrid::CpGridData::cellIndexSet ( ) const
inline

References cellCommunication().

◆ cellRemoteIndices() [1/2]

RemoteIndices & Dune::cpgrid::CpGridData::cellRemoteIndices ( )
inline

References cellCommunication().

◆ cellRemoteIndices() [2/2]

const RemoteIndices & Dune::cpgrid::CpGridData::cellRemoteIndices ( ) const
inline

References cellCommunication().

◆ checkCuboidShape()

void Dune::cpgrid::CpGridData::checkCuboidShape ( const std::vector< int > &  cellIdx_vec) const

Check that every cell to be refined has cuboid shape.

◆ communicate()

template<class DataHandle >
void Dune::cpgrid::CpGridData::communicate ( DataHandle &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
)

communicate objects for all codims on a given level

Parameters
dataThe data handle describing the data. Has to adhere to the Dune::DataHandleIF interface.
iftypeThe interface to use for the communication.
dirThe direction of the communication along the interface (forward or backward).

References data.

Referenced by Dune::CpGrid::communicate().

◆ computeEclCentroid() [1/2]

std::array< double, 3 > Dune::cpgrid::CpGridData::computeEclCentroid ( const Entity< 0 > &  elem) const

◆ computeEclCentroid() [2/2]

std::array< double, 3 > Dune::cpgrid::CpGridData::computeEclCentroid ( const int  idx) const

◆ computeUniqueBoundaryIds()

void Dune::cpgrid::CpGridData::computeUniqueBoundaryIds ( )

Referenced by setUniqueBoundaryIds().

◆ disjointPatches()

bool Dune::cpgrid::CpGridData::disjointPatches ( const std::vector< std::array< int, 3 > > &  startIJK_vec,
const std::vector< std::array< int, 3 > > &  endIJK_vec 
) const

Determine if a finite amount of patches (of cells) are disjoint, namely, they do not share any corner nor face.

Parameters
[in]startIJK_vecVector of Cartesian triplet indices where each patch starts.
[in]endIJK_vecVector of Cartesian triplet indices where each patch ends. Last cell part of the lgr will be {endIJK_vec[<patch>][0]-1, ... ,endIJK_vec[<patch>][2]-1}.

◆ distributeGlobalGrid()

void Dune::cpgrid::CpGridData::distributeGlobalGrid ( CpGrid grid,
const CpGridData view_data,
const std::vector< int > &  cell_part 
)

Redistribute a global grid.

The whole grid must be available on all processors.

◆ getIJK()

void Dune::cpgrid::CpGridData::getIJK ( int  c,
std::array< int, 3 > &  ijk 
) const
inline

Extract Cartesian index triplet (i,j,k) of an active cell.

Parameters
[in]cActive cell index.
[out]ijkCartesian index triplet

◆ getPatchesCells()

std::vector< int > Dune::cpgrid::CpGridData::getPatchesCells ( const std::vector< std::array< int, 3 > > &  startIJK_vec,
const std::vector< std::array< int, 3 > > &  endIJK_vec 
) const

Compute cell indices of selected patches of cells (Cartesian grid required).

Parameters
[in]startIJK_vecVector of Cartesian triplet indices where each patch starts.
[in]endIJK_vecVector of Cartesian triplet indices where each patch ends. Last cell part of the lgr will be {endIJK_vec[<patch>][0]-1, ... endIJK_vec[<patch>][2]-1}.
Returns
allPatches_cells

◆ hasNNCs()

bool Dune::cpgrid::CpGridData::hasNNCs ( const std::vector< int > &  cellIndices) const

Check all cells selected for refinement have no NNCs (no neighbor connections). Assumption: all grid cells are active.

◆ indexSet()

const IndexSet & Dune::cpgrid::CpGridData::indexSet ( ) const
inline

Get the index set. This is the lead as well as th level index set.

Returns
The index set.

◆ localIdSet()

const cpgrid::IdSet & Dune::cpgrid::CpGridData::localIdSet ( ) const
inline

Get the local index set.

◆ logicalCartesianSize()

const std::array< int, 3 > & Dune::cpgrid::CpGridData::logicalCartesianSize ( ) const
inline

The logical cartesian size of the grid. This function is not part of the Dune grid interface, and should be used with caution.

◆ patchesShareFace()

bool Dune::cpgrid::CpGridData::patchesShareFace ( const std::vector< std::array< int, 3 > > &  startIJK_vec,
const std::vector< std::array< int, 3 > > &  endIJK_vec 
) const

Determine if a finite amount of patches (of cells) share a face.

Parameters
[in]startIJK_vecVector of Cartesian triplet indices where each patch starts.
[in]endIJK_vecVector of Cartesian triplet indices where each patch ends. Last cell part of the lgr will be {endIJK_vec[<patch>][0]-1, ... ,endIJK_vec[<patch>][2]-1}.

◆ processEclipseFormat()

void Dune::cpgrid::CpGridData::processEclipseFormat ( const grdecl input_data,
std::array< std::set< std::pair< int, int > >, 2 > &  nnc,
bool  remove_ij_boundary,
bool  turn_normals,
bool  pinchActive,
double  tolerance_unique_points 
)

Read the Eclipse grid format ('grdecl').

Parameters
input_datathe data in grdecl format, declared in preprocess.h.
ecl_statethe object from opm-parser provide information regarding to pore volume, NNC, aquifer information when ecl_state is available. NNC and aquifer connection information will also be updated during the function call when available and necessary.
nncis the non-neighboring connections
remove_ij_boundaryif true, will remove (i, j) boundaries. Used internally.
pinchActiveIf true, we will add faces between vertical cells that have only inactive cells or cells with zero volume between them. If false these cells will not be connected.
tolerance_unique_pointsTolerance used to identify points based on their cooridinate

◆ readEclipseFormat()

void Dune::cpgrid::CpGridData::readEclipseFormat ( const std::string &  filename,
bool  periodic_extension,
bool  turn_normals = false 
)

Read the Eclipse grid format ('grdecl').

Parameters
filenamethe name of the file to read.
periodic_extensionif true, the grid will be (possibly) refined, so that intersections/faces along i and j boundaries will match those on the other side. That is, i- faces will match i+ faces etc.

◆ readSintefLegacyFormat()

void Dune::cpgrid::CpGridData::readSintefLegacyFormat ( const std::string &  grid_prefix)

Read the Sintef legacy grid format ('topogeom').

Parameters
grid_prefixthe grid name, such that topology is found in <grid_prefix>-topo.dat etc.

◆ refinePatch()

std::tuple< std::shared_ptr< CpGridData >, const std::vector< std::array< int, 2 > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::vector< std::array< int, 2 > >, const std::vector< std::array< int, 2 > > > Dune::cpgrid::CpGridData::refinePatch ( const std::array< int, 3 > &  cells_per_dim,
const std::array< int, 3 > &  startIJK,
const std::array< int, 3 > &  endIJK 
) const

Refine a (connected block-shaped) patch of cells. Based on the patch, a Geometry<3,3> object is created and refined.

Parameters
[in]cells_per_dimNumber of (refined) cells in each direction that each parent cell should be refined to.
[in]startIJKCartesian triplet index where the patch starts.
[in]endIJKCartesian triplet index where the patch ends. Last cell part of the lgr will be {endijk[0]-1, ... endIJK[2]-1}.
Returns
refined_grid_ptr Shared pointer of CpGridData type, pointing at the refined_grid
boundary_old_to_new_corners/faces Corner/face indices on the patch-boundary associated with new-born-entity indices.
parent_to_children_faces/cell For each parent face/cell, we store its child-face/cell indices. {parent face/cell index in coarse level, {indices of its children in refined level}}
child_to_parent_faces/cells {child index, parent index}

◆ refineSingleCell()

std::tuple< const std::shared_ptr< CpGridData >, const std::vector< std::array< int, 2 > >, const std::vector< std::tuple< int, std::vector< int > > >, const std::tuple< int, std::vector< int > >, const std::vector< std::array< int, 2 > >, const std::vector< std::array< int, 2 > > > Dune::cpgrid::CpGridData::refineSingleCell ( const std::array< int, 3 > &  cells_per_dim,
const int &  parent_idx 
) const

Refine a single cell and return a shared pointer of CpGridData type.

refineSingleCell() takes a cell and refines it in a chosen amount of cells (per direction); creating the geometries, topological relations, etc. Stored in a CpGridData object. Additionally, containers for parent-to-new-born entities are buil, as well as, new-born-to-parent. Maps(<int,bool>) to detect parent faces or cells are also provided. (Cell with 6 faces required).

Parameters
[in]cells_per_dimNumber of (refined) cells in each direction that each parent cell should be refined to.
[in]parent_idxParent cell index, cell to be refined.
Returns
refined_grid_ptr Shared pointer pointing at refined_grid.
parent_to_refined_corners For each corner of the parent cell, we store the index of the refined corner that coincides with the old one. We assume they are ordered 0,1,..7 6—7 2—3 | | TOP FACE | | 4—5 0—1 BOTTOM FACE
parent_to_children_faces/cell For each parent face/cell, we store its child-face/cell indices. {parent face/cell index in coarse level, {indices of its children in refined level}}
child_to_parent_faces/cells {child index, parent index}

◆ setUniqueBoundaryIds()

void Dune::cpgrid::CpGridData::setUniqueBoundaryIds ( bool  uids)
inline

Set whether we want to have unique boundary ids.

Parameters
uidsif true, each boundary intersection will have a unique boundary id.

References computeUniqueBoundaryIds().

◆ size() [1/2]

int Dune::cpgrid::CpGridData::size ( GeometryType  type) const
inline

number of leaf entities per geometry type in this process

References size().

◆ size() [2/2]

int Dune::cpgrid::CpGridData::size ( int  codim) const

number of leaf entities per codim in this process

Referenced by Dune::cpgrid::ReversePointGlobalIdSet::operator[](), and size().

◆ sortedNumAquiferCells()

const std::vector< int > & Dune::cpgrid::CpGridData::sortedNumAquiferCells ( ) const
inline

Get sorted active cell indices of numerical aquifer.

◆ uniqueBoundaryIds()

bool Dune::cpgrid::CpGridData::uniqueBoundaryIds ( ) const
inline

Is the grid currently using unique boundary ids?

Returns
true if each boundary intersection has a unique id false if we use the (default) 1-6 ids for i- i+ j- j+ k- k+ boundaries.

◆ validStartEndIJKs()

void Dune::cpgrid::CpGridData::validStartEndIJKs ( const std::vector< std::array< int, 3 > > &  startIJK_vec,
const std::vector< std::array< int, 3 > > &  endIJK_vec 
) const

Check startIJK and endIJK of each patch of cells to be refined are valid, i.e. startIJK and endIJK vectors have the same size and, startIJK < endIJK coordenate by coordenate.

Parameters
[in]startIJK_vecVector of Cartesian triplet indices where each patch starts.
[in]endIJK_vecVector of Cartesian triplet indices where each patch ends. Last cell part of the lgr will be {endIJK_vec[patch][0]-1, ..., endIJK_vec[patch][2]-1}.

◆ writeSintefLegacyFormat()

void Dune::cpgrid::CpGridData::writeSintefLegacyFormat ( const std::string &  grid_prefix) const

Write the Sintef legacy grid format ('topogeom').

Parameters
grid_prefixthe grid name, such that topology will be found in <grid_prefix>-topo.dat etc.

◆ zcornData()

const std::vector< double > & Dune::cpgrid::CpGridData::zcornData ( ) const
inline

Return the internalized zcorn copy from the grid processing, if no cells were adjusted during the minpvprocessing this can be and empty vector.

Friends And Related Function Documentation

◆ Dune::CpGrid

friend class Dune::CpGrid
friend

◆ Dune::cpgrid::IndexSet

friend class Dune::cpgrid::IndexSet
friend

◆ Entity

template<int >
friend class Entity
friend

◆ EntityRep

template<int >
friend class EntityRep
friend

◆ GlobalIdSet

friend class GlobalIdSet
friend

◆ HierarchicIterator

friend class HierarchicIterator
friend

◆ Intersection

friend class Intersection
friend

◆ mover::Mover

template<class T , int i>
friend struct mover::Mover
friend

◆ PartitionTypeIndicator

friend class PartitionTypeIndicator
friend

The documentation for this class was generated from the following file: