Opm::LookUpData< Grid, GridView > Class Template Reference

#include <LookUpData.hh>

Public Member Functions

 LookUpData (const GridView &gridView, bool isFieldPropInLgr=false)
 : Constructor taking a GridView and a bool More...
 
template<class ElementOrIndex , class FieldProperties >
auto operator() (const ElementOrIndex &elementOrIdx, const FieldProperties &fieldProp) const
 : Get field propertry for an element or index in the leaf grid view, from a vector and element index. More...
 
std::vector< double > assignFieldPropsDoubleOnLeaf (const FieldPropsManager &fieldPropsManager, const std::string &propString) const
 : Get field property of type double from field properties manager by name. More...
 
template<typename IntType >
std::vector< IntType > assignFieldPropsIntOnLeaf (const FieldPropsManager &fieldPropsManager, const std::string &propString, const bool &needsTranslation, std::function< void(IntType, int)> valueCheck=[](IntType, int){}) const
 : Get field property of type int from field properties manager by name. More...
 
template<typename ElemOrIndex >
double fieldPropDouble (const FieldPropsManager &fieldPropsManager, const std::string &propString, const ElemOrIndex &elemOrIndex) const
 : Get property of type double from field properties manager by name, via element or its index. More...
 
template<typename ElemOrIndex >
int fieldPropInt (const FieldPropsManager &fieldPropsManager, const std::string &propString, const ElemOrIndex &elemOrIndex) const
 : Get property of type int from field properties manager by name, via element. More...
 
template<typename ElementType >
auto getFieldPropIdx (const ElementType &elem) const
 calls getFieldPropIdx<Grid, ElementType>(elem) More...
 
template<typename GridType , typename ElementType >
auto getFieldPropIdx (const ElementType &elem) const
 Return the index used for retrieving field properties, depending on whether the grid is a CpGrid or a general grid, and whether the element is in an LGR. More...
 
template<typename GridType , typename IndexType >
auto getFieldPropIdx (const IndexType &elementOrIndex) const
 

Protected Attributes

const GridView & gridView_
 
Dune::MultipleCodimMultipleGeomTypeMapper< GridView > elemMapper_
 
bool isFieldPropInLgr_
 

Detailed Description

template<typename Grid, typename GridView>
class Opm::LookUpData< Grid, GridView >

LookUpData class - To search field properties of leaf grid view elements via element/elementIndex

Instead of using a specialitation for Dune::CpGrid, we implement std::enable_if to overload methods with different definitions: for Dune:CpGrid and for other Grid types. An auxiliary defualt template parameter (GridType = Grid) is added to deal with the dependent names at template instantiation.

Constructor & Destructor Documentation

◆ LookUpData()

template<typename Grid , typename GridView >
Opm::LookUpData< Grid, GridView >::LookUpData ( const GridView &  gridView,
bool  isFieldPropInLgr = false 
)
inlineexplicit

: Constructor taking a GridView and a bool

Parameters
[in]GridView
[in]isFieldPropInLgrbool: default false (search field property in unrefined grid) true (search field property in refined grid; LGR-id/level required) Currently, isFieldPropInLgr_ == false means that all the field properties are given in the unrefined grid (level 0).

Member Function Documentation

◆ assignFieldPropsDoubleOnLeaf()

template<typename Grid , typename GridView >
std::vector< double > Opm::LookUpData< Grid, GridView >::assignFieldPropsDoubleOnLeaf ( const FieldPropsManager &  fieldPropsManager,
const std::string &  propString 
) const

: Get field property of type double from field properties manager by name.

◆ assignFieldPropsIntOnLeaf()

template<typename Grid , typename GridView >
template<typename IntType >
std::vector< IntType > Opm::LookUpData< Grid, GridView >::assignFieldPropsIntOnLeaf ( const FieldPropsManager &  fieldPropsManager,
const std::string &  propString,
const bool &  needsTranslation,
std::function< void(IntType, int)>  valueCheck = [](IntType, int){} 
) const

: Get field property of type int from field properties manager by name.

◆ fieldPropDouble()

template<typename Grid , typename GridView >
template<typename ElemOrIndex >
double Opm::LookUpData< Grid, GridView >::fieldPropDouble ( const FieldPropsManager &  fieldPropsManager,
const std::string &  propString,
const ElemOrIndex &  elemOrIndex 
) const

: Get property of type double from field properties manager by name, via element or its index.

◆ fieldPropInt()

template<typename Grid , typename GridView >
template<typename ElemOrIndex >
int Opm::LookUpData< Grid, GridView >::fieldPropInt ( const FieldPropsManager &  fieldPropsManager,
const std::string &  propString,
const ElemOrIndex &  elemOrIndex 
) const

: Get property of type int from field properties manager by name, via element.

◆ getFieldPropIdx() [1/3]

template<typename Grid , typename GridView >
template<typename ElementType >
auto Opm::LookUpData< Grid, GridView >::getFieldPropIdx ( const ElementType &  elem) const

calls getFieldPropIdx<Grid, ElementType>(elem)

◆ getFieldPropIdx() [2/3]

template<typename Grid , typename GridView >
template<typename GridType , typename ElementType >
auto Opm::LookUpData< Grid, GridView >::getFieldPropIdx ( const ElementType &  elem) const

Return the index used for retrieving field properties, depending on whether the grid is a CpGrid or a general grid, and whether the element is in an LGR.

This method determines the appropriate index under two main conditions:

  • Non-CpGrid: Returns the same element index that was passed in. If an entity is provided, it uses elemMapper_ to retrieve the index. The function asserts that maxLevel() == 0 (i.e., no LGR support) for non-CpGrid grids.
  • CpGrid: Depending on whether isFieldPropInLgr_ is true and the element (or index) is in a refined level (> 0), the returned index is for the equivalent LGR cell; otherwise, the index of the origin (level 0) cell is returned.
Template Parameters
GridTypeAuxiliary type used to specialize the method for CpGrid vs. other grids. If GridType = Dune::CpGrid, local grid refinements (LGR) are considered; otherwise, LGR is not supported.
ElementTypeThe type of the element or index passed in.
Parameters
elementOrIndexAn integral cell index or a grid entity (e.g., Dune::cpgrid::Entity<0>).
Returns
The integer index to be used for looking up the relevant field properties. For non-CpGrid grids, this is the same index or one retrieved from elemMapper_. For CpGrid grids, it is either the LGR-based index or the origin index, depending on isFieldPropInLgr_ and whether the cell is refined.
Note
If GridType is not CpGrid, the method will assert that maxLevel() == 0, since local grid refinements are only supported for CpGrid.

◆ getFieldPropIdx() [3/3]

template<typename Grid , typename GridView >
template<typename GridType , typename IndexType >
auto Opm::LookUpData< Grid, GridView >::getFieldPropIdx ( const IndexType &  elementOrIndex) const

◆ operator()()

template<typename Grid , typename GridView >
template<class ElementOrIndex , class FieldProperties >
auto Opm::LookUpData< Grid, GridView >::operator() ( const ElementOrIndex &  elementOrIdx,
const FieldProperties &  fieldProp 
) const

: Get field propertry for an element or index in the leaf grid view, from a vector and element index.

LookUpData.

    For general grids, the field property vector is assumed to be given for the gridView_.
    For CpGrid, the field property vector is assumed to be given for level 0 when isFieldPropLgr_ == false,
    and for certain LGR/level > 0 when isFieldPropLgr_ == true.
Parameters
[in]elementOrIdxElement or index of the element in the leaf grid view.
[in]fieldPropVector (indexable collection) of field properties.
Template Parameters
ElementOrIndexthe type of the element or index passed in.
FieldPropertiesthe type of the field properties vector. Should be an std::vector like type.

Member Data Documentation

◆ elemMapper_

template<typename Grid , typename GridView >
Dune::MultipleCodimMultipleGeomTypeMapper<GridView> Opm::LookUpData< Grid, GridView >::elemMapper_
protected

◆ gridView_

template<typename Grid , typename GridView >
const GridView& Opm::LookUpData< Grid, GridView >::gridView_
protected

◆ isFieldPropInLgr_

template<typename Grid , typename GridView >
bool Opm::LookUpData< Grid, GridView >::isFieldPropInLgr_
protected

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