Loading...
Searching...
No Matches
Opm::LookUpData< Grid, GridView > Class Template Reference

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

`#include <LookUpData.hh>`

## Public Member Functions

| LookUpData (const GridView &gridView, bool isFieldPropInLgr=false)
| : Constructor taking a GridView and a bool
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.
std::vector< double > | assignFieldPropsDoubleOnLeaf (const FieldPropsManager &fieldPropsManager, const std::string &propString) const
| : Get field property of type double from field properties manager by name.
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.
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.
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.
template<typename ElementType>
auto | getFieldPropIdx (const ElementType &elem) const
| calls `getFieldPropIdx<Grid, ElementType>(elem)`
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.
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 )

inline explicit

: Constructor taking a GridView and a bool

Parameters

  [in] | gridView | The Grid view to use
  [in] | isFieldPropInLgr | bool: 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

## getFieldPropIdx()

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

  GridType | Auxiliary 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.
  ElementType | The type of the element or index passed in.

Parameters

  elem | An 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.

## 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] | elementOrIdx | Element or index of the element in the leaf grid view.
  [in] | fieldProp | Vector (indexable collection) of field properties.

Template Parameters

  ElementOrIndex | the type of the element or index passed in.
  FieldProperties | the type of the field properties vector. Should be an `std::vector` like type.

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

- opm/grid/LookUpData.hh