34#ifndef OPM_LOOKUPDATA_HH
35#define OPM_LOOKUPDATA_HH
37#include <dune/grid/common/mcmgmapper.hh>
39#include <opm/grid/cpgrid/Entity.hpp>
50template<
int codim>
class Entity;
64template <
typename Gr
id,
typename Gr
idView>
72 elemMapper_(gridView,
Dune::mcmgElementLayout())
88 template<
typename EntityType,
typename FeatureType>
89 FeatureType
operator()(
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const;
102 template<
typename FeatureType>
103 FeatureType
operator()(
const int& elemIdx,
const std::vector<FeatureType>& feature_vec)
const;
112 template<
typename EntityType,
typename Gr
idType = Gr
id>
113 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
122 template<
typename EntityType,
typename Gr
idType = Gr
id>
123 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
131 template<
typename Gr
idType>
132 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
140 template<
typename Gr
idType = Gr
id>
141 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
145 const GridView& gridView_;
146 Dune::MultipleCodimMultipleGeomTypeMapper<GridView> elemMapper_;
155template<
typename Gr
id,
typename Gr
idView>
166 elemMapper_(gridView,
Dune::mcmgElementLayout()),
183 template<
typename EntityType,
typename FeatureType>
184 FeatureType
operator()(
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const;
197 template<
typename FeatureType>
198 FeatureType
operator()(
const int& elemIdx,
const std::vector<FeatureType>& feature_vec)
const;
207 template<
typename EntityType,
typename Gr
idType = Gr
id>
208 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
217 template<
typename EntityType,
typename Gr
idType = Gr
id>
218 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
226 template<
typename Gr
idType = Gr
id>
227 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
235 template<
typename Gr
idType = Gr
id>
236 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
240 const GridView& gridView_;
241 Dune::MultipleCodimMultipleGeomTypeMapper<GridView> elemMapper_;
251template<
typename Gr
id,
typename Gr
idView>
252template<
typename EntityType,
typename FeatureType>
255 assert( (0 <= this->getOriginIndexFromEntity<EntityType,Grid>(elem)) &&
256 (
static_cast<int>(feature_vec.size()) > this->getOriginIndexFromEntity<EntityType,Grid>(elem)) );
257 return feature_vec[this->getOriginIndexFromEntity<EntityType,Grid>(elem)];
260template<
typename Gr
id,
typename Gr
idView>
261template<
typename FeatureType>
264 assert(0 <= this-> getOriginIndex<Grid>(elemIdx) &&
static_cast<int>(feature_vec.size()) > this-> getOriginIndex<Grid>(elemIdx));
265 return feature_vec[getOriginIndex<Grid>(elemIdx)];
268template<
typename Gr
id,
typename Gr
idView>
269template<
typename EntityType,
typename Gr
idType>
270typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
273 static_assert(std::is_same_v<Grid,GridType>);
274 return this-> elemMapper_.index(elem);
277template<
typename Gr
id,
typename Gr
idView>
278template<
typename EntityType,
typename Gr
idType>
279typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
282 static_assert(std::is_same_v<Grid,GridType>);
283 return elem.getOrigin().index();
286template<
typename Gr
id,
typename Gr
idView>
287template<
typename Gr
idType>
288typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
291 static_assert(std::is_same_v<Grid,GridType>);
295template<
typename Gr
id,
typename Gr
idView>
296template<
typename Gr
idType>
297typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
300 static_assert(std::is_same_v<Grid,GridType>);
302 return elem.getOrigin().index();
309template<
typename Gr
id,
typename Gr
idView>
310template<
typename EntityType,
typename FeatureType>
312 (
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const
315 assert( (0 <= this->getOriginIndexFromEntity<EntityType,Grid>(elem)) &&
316 (
static_cast<int>(feature_vec.size()) > this-> getOriginIndexFromEntity<EntityType,Grid>(elem)) );
317 return feature_vec[cartMapper_-> cartesianIndex(this->elemMapper_.index(elem))];
320template<
typename Gr
id,
typename Gr
idView>
321template<
typename FeatureType>
325 assert(0 <= this->getOriginIndex<Grid>(elemIdx) &&
326 static_cast<int>(feature_vec.size()) > this-> getOriginIndex<Grid>(elemIdx));
327 return feature_vec[cartMapper_-> cartesianIndex(elemIdx)];
330template<
typename Gr
id,
typename Gr
idView>
331template<
typename EntityType,
typename Gr
idType>
332typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
335 static_assert(std::is_same_v<Grid,GridType>);
336 return elemMapper_.index(elem);
339template<
typename Gr
id,
typename Gr
idView>
340template<
typename EntityType,
typename Gr
idType>
341typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
344 static_assert(std::is_same_v<Grid,GridType>);
345 return elem.getOrigin().index();
348template<
typename Gr
id,
typename Gr
idView>
349template<
typename Gr
idType>
350typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
353 static_assert(std::is_same_v<Grid,GridType>);
357template<
typename Gr
id,
typename Gr
idView>
358template<
typename Gr
idType>
359typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
362 static_assert(std::is_same_v<Grid,GridType>);
364 return elem.getOrigin().index();
Interface class to access the logical Cartesian grid as used in industry standard simulator decks.
Definition CartesianIndexMapper.hpp:16
LookUpCartesianData - To search data via CartesianIndex (cartesianMapper)
Definition LookUpData.hh:157
FeatureType operator()(const EntityType &elem, const std::vector< FeatureType > &feature_vec) const
: Call operator taking an EntityObject and a FeatureVector.
Definition LookUpData.hh:312
std::enable_if_t<!std::is_same_v< GridType, Dune::CpGrid >, int > getOriginIndex(const int &elemIdx) const
: For general grids, it retunrs the same element index.
Definition LookUpData.hh:351
LookUpCartesianData(const GridView &gridView, const Dune::CartesianIndexMapper< Grid > &mapper)
: Constructor taking a GridView and a CartesianIndexMapper
Definition LookUpData.hh:163
std::enable_if_t<!std::is_same_v< GridType, Dune::CpGrid >, int > getOriginIndexFromEntity(const EntityType &elem) const
: For general grids, it retunrs the same Entity index.
Definition LookUpData.hh:333
LookUpData class - To search data via element index.
Definition LookUpData.hh:66
FeatureType operator()(const EntityType &elem, const std::vector< FeatureType > &feature_vec) const
: Call operator taking an EntityObject and a FeatureVector.
Definition LookUpData.hh:253
std::enable_if_t<!std::is_same_v< GridType, Dune::CpGrid >, int > getOriginIndexFromEntity(const EntityType &elem) const
: For general grids, it retunrs the same Entity index.
Definition LookUpData.hh:271
LookUpData(const GridView &gridView)
: Constructor taking a GridView
Definition LookUpData.hh:70
std::enable_if_t<!std::is_same_v< GridType, Dune::CpGrid >, int > getOriginIndex(const int &elemIdx) const
: For general grids, it retunrs the same element index.
Definition LookUpData.hh:289
Copyright 2019 Equinor AS.
Definition CartesianIndexMapper.hpp:10
Holds the implementation of the CpGrid as a pimple.
Definition CellQuadrature.cpp:68