35#include <dune/grid/common/mcmgmapper.hh>
37#include <opm/grid/cpgrid/Entity.hpp>
48template<
int codim>
class Entity;
62template <
typename Gr
id,
typename Gr
idView>
70 elemMapper_(gridView,
Dune::mcmgElementLayout())
86 template<
typename EntityType,
typename FeatureType>
87 FeatureType
operator()(
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const;
100 template<
typename FeatureType>
101 FeatureType
operator()(
const int& elemIdx,
const std::vector<FeatureType>& feature_vec)
const;
110 template<
typename EntityType,
typename Gr
idType = Gr
id>
111 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
120 template<
typename EntityType,
typename Gr
idType = Gr
id>
121 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
129 template<
typename Gr
idType>
130 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
138 template<
typename Gr
idType = Gr
id>
139 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
143 const GridView& gridView_;
144 Dune::MultipleCodimMultipleGeomTypeMapper<GridView> elemMapper_;
153template<
typename Gr
id,
typename Gr
idView>
164 elemMapper_(gridView,
Dune::mcmgElementLayout()),
181 template<
typename EntityType,
typename FeatureType>
182 FeatureType
operator()(
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const;
195 template<
typename FeatureType>
196 FeatureType
operator()(
const int& elemIdx,
const std::vector<FeatureType>& feature_vec)
const;
205 template<
typename EntityType,
typename Gr
idType = Gr
id>
206 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
215 template<
typename EntityType,
typename Gr
idType = Gr
id>
216 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndexFromEntity(
const EntityType& elem)
const;
224 template<
typename Gr
idType = Gr
id>
225 typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
233 template<
typename Gr
idType = Gr
id>
234 typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
getOriginIndex(
const int& elemIdx)
const;
238 const GridView& gridView_;
239 Dune::MultipleCodimMultipleGeomTypeMapper<GridView> elemMapper_;
249template<
typename Gr
id,
typename Gr
idView>
250template<
typename EntityType,
typename FeatureType>
253 assert( (0 <= this->getOriginIndexFromEntity<EntityType,Grid>(elem)) &&
254 (
static_cast<int>(feature_vec.size()) > this->getOriginIndexFromEntity<EntityType,Grid>(elem)) );
255 return feature_vec[this->getOriginIndexFromEntity<EntityType,Grid>(elem)];
258template<
typename Gr
id,
typename Gr
idView>
259template<
typename FeatureType>
262 assert(0 <= this-> getOriginIndex<Grid>(elemIdx) &&
static_cast<int>(feature_vec.size()) > this-> getOriginIndex<Grid>(elemIdx));
263 return feature_vec[getOriginIndex<Grid>(elemIdx)];
266template<
typename Gr
id,
typename Gr
idView>
267template<
typename EntityType,
typename Gr
idType>
268typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
271 static_assert(std::is_same_v<Grid,GridType>);
272 return this-> elemMapper_.index(elem);
275template<
typename Gr
id,
typename Gr
idView>
276template<
typename EntityType,
typename Gr
idType>
277typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
280 static_assert(std::is_same_v<Grid,GridType>);
281 return elem.getOrigin().index();
284template<
typename Gr
id,
typename Gr
idView>
285template<
typename Gr
idType>
286typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
289 static_assert(std::is_same_v<Grid,GridType>);
293template<
typename Gr
id,
typename Gr
idView>
294template<
typename Gr
idType>
295typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
298 static_assert(std::is_same_v<Grid,GridType>);
300 return elem.getOrigin().index();
307template<
typename Gr
id,
typename Gr
idView>
308template<
typename EntityType,
typename FeatureType>
310 (
const EntityType& elem,
const std::vector<FeatureType>& feature_vec)
const
313 assert( (0 <= this->getOriginIndexFromEntity<EntityType,Grid>(elem)) &&
314 (
static_cast<int>(feature_vec.size()) > this-> getOriginIndexFromEntity<EntityType,Grid>(elem)) );
315 return feature_vec[cartMapper_-> cartesianIndex(this->elemMapper_.index(elem))];
318template<
typename Gr
id,
typename Gr
idView>
319template<
typename FeatureType>
323 assert(0 <= this->getOriginIndex<Grid>(elemIdx) &&
324 static_cast<int>(feature_vec.size()) > this-> getOriginIndex<Grid>(elemIdx));
325 return feature_vec[cartMapper_-> cartesianIndex(elemIdx)];
328template<
typename Gr
id,
typename Gr
idView>
329template<
typename EntityType,
typename Gr
idType>
330typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
333 static_assert(std::is_same_v<Grid,GridType>);
334 return elemMapper_.index(elem);
337template<
typename Gr
id,
typename Gr
idView>
338template<
typename EntityType,
typename Gr
idType>
339typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
342 static_assert(std::is_same_v<Grid,GridType>);
343 return elem.getOrigin().index();
346template<
typename Gr
id,
typename Gr
idView>
347template<
typename Gr
idType>
348typename std::enable_if_t<!std::is_same_v<GridType,Dune::CpGrid>,
int>
351 static_assert(std::is_same_v<Grid,GridType>);
355template<
typename Gr
id,
typename Gr
idView>
356template<
typename Gr
idType>
357typename std::enable_if_t<std::is_same_v<GridType,Dune::CpGrid>,
int>
360 static_assert(std::is_same_v<Grid,GridType>);
362 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:155
FeatureType operator()(const EntityType &elem, const std::vector< FeatureType > &feature_vec) const
: Call operator taking an EntityObject and a FeatureVector.
Definition LookUpData.hh:310
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:349
LookUpCartesianData(const GridView &gridView, const Dune::CartesianIndexMapper< Grid > &mapper)
: Constructor taking a GridView and a CartesianIndexMapper
Definition LookUpData.hh:161
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:331
LookUpData class - To search data via element index.
Definition LookUpData.hh:64
FeatureType operator()(const EntityType &elem, const std::vector< FeatureType > &feature_vec) const
: Call operator taking an EntityObject and a FeatureVector.
Definition LookUpData.hh:251
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:269
LookUpData(const GridView &gridView)
: Constructor taking a GridView
Definition LookUpData.hh:68
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:287
Copyright 2019 Equinor AS.
Definition CartesianIndexMapper.hpp:10
Holds the implementation of the CpGrid as a pimple.
Definition CellQuadrature.cpp:68