My Project
|
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. | |
using | Communication = CpGridDataTraits::Communication |
The type of the collective communication. | |
using | CollectiveCommunication = CpGridDataTraits::CollectiveCommunication |
Public Member Functions | |
CpGridData (MPIHelper::MPICommunicator comm, std::vector< std::shared_ptr< CpGridData > > &data) | |
Constructor for parallel grid data. | |
CpGridData (std::vector< std::shared_ptr< CpGridData > > &data) | |
Constructor. | |
~CpGridData () | |
Destructor. | |
int | size (int codim) const |
number of leaf entities per codim in this process | |
int | size (GeometryType type) const |
number of leaf entities per geometry type in this process | |
void | readEclipseFormat (const std::string &filename, bool periodic_extension, bool turn_normals=false) |
Read the Eclipse grid format ('grdecl'). | |
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) |
Read the Eclipse grid format ('grdecl'). | |
void | getIJK (int c, std::array< int, 3 > &ijk) const |
Extract Cartesian index triplet (i,j,k) of an active cell. | |
std::array< int, 3 > | getIJK (int idx_in_parent_cell, const std::array< int, 3 > &cells_per_dim) const |
Extract Cartesian index triplet (i,j,k) given an index between 0 and NXxNYxNZ -1 where NX, NY, and NZ is the total amoung of cells in each direction x-,y-,and z- respectively. | |
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. | |
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). | |
bool | hasNNCs (const std::vector< int > &cellIndices) const |
Check all cells selected for refinement have no NNCs (no neighbor connections). | |
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. | |
void | checkCuboidShape (const std::vector< int > &cellIdx_vec) const |
Check that every cell to be refined has cuboid shape. | |
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. | |
int | sharedFaceTag (const std::vector< std::array< int, 3 > > &startIJK_2Patches, const std::vector< std::array< int, 3 > > &endIJK_2Patches) const |
bool | mark (int refCount, const cpgrid::Entity< 0 > &element) |
Mark entity for refinement or coarsening. | |
int | getMark (const cpgrid::Entity< 0 > &element) const |
Return refinement mark for entity. | |
bool | preAdapt () |
Set mightVanish flags for elements that will be refined in the next adapt() call Need to be called after elements have been marked for refinement. | |
bool | adapt () |
TO DO: Documentation. Triggers the grid refinement process - Currently, returns preAdapt() | |
void | postAdapt () |
Clean up refinement/coarsening markers - set every element to the mark 0 which represents 'doing nothing'. | |
int | getGridIdx () const |
Add doc/or remove method and replace it with better approach. | |
std::vector< std::shared_ptr< Dune::cpgrid::CpGridData > > | levelData () const |
Add doc/or remove method and replace it with better approach. | |
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. | |
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. | |
std::array< double, 3 > | computeEclCentroid (const int idx) const |
std::array< double, 3 > | computeEclCentroid (const Entity< 0 > &elem) const |
void | computeUniqueBoundaryIds () |
bool | uniqueBoundaryIds () const |
Is the grid currently using unique boundary ids? | |
void | setUniqueBoundaryIds (bool uids) |
Set whether we want to have unique boundary ids. | |
const std::vector< double > & | zcornData () const |
Return the internalized zcorn copy from the grid processing, if no cells were adjusted during the minpvprocessing this can be and empty vector. | |
const IndexSet & | indexSet () const |
Get the index set. | |
const cpgrid::IdSet & | localIdSet () const |
Get the local index set. | |
const cpgrid::LevelGlobalIdSet & | globalIdSet () const |
Get the global index set. | |
const std::array< int, 3 > & | logicalCartesianSize () const |
The logical cartesian size of the grid. | |
void | distributeGlobalGrid (CpGrid &grid, const CpGridData &view_data, const std::vector< int > &cell_part) |
Redistribute a global grid. | |
template<class DataHandle > | |
void | communicate (DataHandle &data, InterfaceType iftype, CommunicationDirection dir) |
communicate objects for all codims on a given level | |
void | computeCellPartitionType () |
void | computePointPartitionType () |
void | computeCommunicationInterfaces (int noexistingPoints) |
const std::vector< int > & | sortedNumAquiferCells () const |
Get sorted active cell indices of numerical aquifer. | |
Struct that hods all the data needed to represent a Cpgrid.
anonymous enum |
|
explicit |
Constructor for parallel grid data.
comm | The MPI communicator Default constructor. |
void Dune::cpgrid::CpGridData::communicate | ( | DataHandle & | data, |
InterfaceType | iftype, | ||
CommunicationDirection | dir | ||
) |
communicate objects for all codims on a given level
data | The data handle describing the data. Has to adhere to the Dune::DataHandleIF interface. |
iftype | The interface to use for the communication. |
dir | The direction of the communication along the interface (forward or backward). |
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.
[in] | startIJK_vec | Vector of Cartesian triplet indices where each patch starts. |
[in] | endIJK_vec | Vector 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}. |
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.
|
inline |
Extract Cartesian index triplet (i,j,k) of an active cell.
[in] | c | Active cell index. |
[out] | ijk | Cartesian index triplet |
|
inline |
Extract Cartesian index triplet (i,j,k) given an index between 0 and NXxNYxNZ -1 where NX, NY, and NZ is the total amoung of cells in each direction x-,y-,and z- respectively.
[in] | idx | Integer between 0 and cells_per_dim[0]*cells_per_dim[1]*cells_per_dim[2]-1 |
[in] | cells_per_dim |
int Dune::cpgrid::CpGridData::getMark | ( | const cpgrid::Entity< 0 > & | element | ) | const |
Return refinement mark for entity.
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).
[in] | startIJK_vec | Vector of Cartesian triplet indices where each patch starts. |
[in] | endIJK_vec | Vector 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}. |
PATCH CELLS
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.
|
inline |
Get the index set.
This is the lead as well as th level index set.
|
inline |
The logical cartesian size of the grid.
This function is not part of the Dune grid interface, and should be used with caution.
bool Dune::cpgrid::CpGridData::mark | ( | int | refCount, |
const cpgrid::Entity< 0 > & | element | ||
) |
Mark entity for refinement or coarsening.
Refinement on CpGrid is partially supported for Cartesian grids, with the keyword CARFIN. This only works for entities of codim 0.
[in] | refCount | To mark the element for
|
[in] | element | Entity<0>. Currently, an element from the GLOBAL grid (level zero). |
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.
[in] | startIJK_vec | Vector of Cartesian triplet indices where each patch starts. |
[in] | endIJK_vec | Vector 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}. |
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').
Read the Eclipse grid format ('.grdecl').
input_data | the data in grdecl format, declared in preprocess.h. |
ecl_state | the 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. |
nnc | is the non-neighboring connections |
remove_ij_boundary | if true, will remove (i, j) boundaries. Used internally. |
pinchActive | If 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_points | Tolerance used to identify points based on their cooridinate |
void Dune::cpgrid::CpGridData::readEclipseFormat | ( | const std::string & | filename, |
bool | periodic_extension, | ||
bool | turn_normals = false |
||
) |
Read the Eclipse grid format ('grdecl').
filename | the name of the file to read. |
periodic_extension | if 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. |
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.
[in] | cells_per_dim | Number of (refined) cells in each direction that each parent cell should be refined to. |
[in] | startIJK | Cartesian triplet index where the patch starts. |
[in] | endIJK | Cartesian triplet index where the patch ends. Last cell part of the lgr will be {endijk[0]-1, ... endIJK[2]-1}. |
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).
[in] | cells_per_dim | Number of (refined) cells in each direction that each parent cell should be refined to. |
[in] | parent_idx | Parent cell index, cell to be refined. |
|
inline |
Set whether we want to have unique boundary ids.
uids | if true, each boundary intersection will have a unique boundary id. |
|
inline |
Is the grid currently using unique boundary ids?
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.
[in] | startIJK_vec | Vector of Cartesian triplet indices where each patch starts. |
[in] | endIJK_vec | Vector 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}. |