20#ifndef OPM_REGIONMAPPING_HEADER_INCLUDED 
   21#define OPM_REGIONMAPPING_HEADER_INCLUDED 
   25#include <unordered_map> 
   42    template < 
class Region = std::vector<
int> >
 
   68        typedef typename Region::size_type 
CellId;
 
   74        typedef typename std::vector<CellId>::const_iterator 
CellIter;
 
   87        const std::vector<RegionId>&
 
  103            const auto id = rev_.binid.find(r);
 
  105            if (
id == rev_.binid.end()) {
 
  107                return Range(rev_.c.end(), rev_.c.end());
 
  110            const auto i = 
id->second;
 
  112            return Range(rev_.c.begin() + rev_.p[i + 0],
 
  113                         rev_.c.begin() + rev_.p[i + 1]);
 
  126            typedef typename std::vector<CellId>::size_type 
Pos;
 
  128            std::unordered_map<RegionId, Pos> 
binid;
 
  132            std::vector<CellId> 
c;   
 
  139            init(
const Region& reg)
 
  142                for (
const auto& r : reg) {
 
  146                p     .clear();  
p.emplace_back(0);
 
  150                    for (
auto& 
id : 
binid) {
 
  151                        active.push_back(
id.first);
 
  152                        p     .push_back(
id.second);
 
  158                for (
decltype(
p.size()) i = 1, sz = 
p.size(); i < sz; ++i) {
 
  163                assert (
p[0] == 
static_cast<Pos>(reg.size()));
 
  165                c.resize(reg.size());
 
  168                    for (
const auto& r : reg) {
 
  169                        auto& pos  = 
p[ 
binid[r] + 1 ];
 
Definition: RegionMapping.hpp:43
 
std::vector< RegionId > active
Definition: RegionMapping.hpp:129
 
const std::vector< RegionId > & activeRegions() const
Definition: RegionMapping.hpp:88
 
iterator_range< CellIter > Range
Definition: RegionMapping.hpp:76
 
std::vector< CellId > c
Definition: RegionMapping.hpp:132
 
std::vector< CellId >::const_iterator CellIter
Definition: RegionMapping.hpp:74
 
Range cells(const RegionId r) const
Definition: RegionMapping.hpp:102
 
Region::value_type RegionId
Definition: RegionMapping.hpp:62
 
std::unordered_map< RegionId, Pos > binid
Definition: RegionMapping.hpp:128
 
RegionMapping(const Region ®)
Definition: RegionMapping.hpp:52
 
std::vector< Pos > p
Definition: RegionMapping.hpp:131
 
Region::size_type CellId
Definition: RegionMapping.hpp:68
 
RegionId region(const CellId c) const
Definition: RegionMapping.hpp:85
 
std::vector< CellId >::size_type Pos
Definition: RegionMapping.hpp:126
 
Holds the implementation of the CpGrid as a pimple.
Definition: CellQuadrature.hpp:26
 
Definition: IteratorRange.hpp:50