Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes > Class Template Reference

#include <RegionAttributeHelpers.hpp>

Classes

struct  Value
 

Public Types

using RegionID = typename Select::RegionIDParameter< RegionId, std::is_integral< RegionId >::value >::type
 
using ID = typename std::remove_reference< RegionId >::type
 
using AttributeMap = std::unordered_map< ID, std::unique_ptr< Value > >
 

Public Member Functions

template<class RMap >
 RegionAttributes (const RMap &rmap, const Attributes &attr)
 
int cell (const RegionID reg) const
 
bool has (const RegionID reg) const
 
void insert (const RegionID r, const Attributes &attr)
 
const AttributeMapattributes () const
 
const Attributes & attributes (const RegionID reg) const
 
Attributes & attributes (const RegionID reg)
 

Detailed Description

template<typename RegionId, class Attributes>
class Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >

Provide mapping from Region IDs to user-specified collection of per-region attributes.

Template Parameters
RegionIdRegion identifier type. Must be hashable by
std::hash<>
. Typically a built-in integer type–e.g., int.
AttributesUser-defined type that represents collection of attributes that have meaning in a per-region aggregate sense. Must be copy-constructible.

Member Typedef Documentation

◆ AttributeMap

template<typename RegionId , class Attributes >
using Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::AttributeMap = std::unordered_map<ID, std::unique_ptr<Value> >

◆ ID

template<typename RegionId , class Attributes >
using Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::ID = typename std::remove_reference<RegionId>::type

◆ RegionID

template<typename RegionId , class Attributes >
using Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::RegionID = typename Select::RegionIDParameter <RegionId, std::is_integral<RegionId>::value>::type

Expose RegionId as a vocabulary type for use in query methods.

Constructor & Destructor Documentation

◆ RegionAttributes()

template<typename RegionId , class Attributes >
template<class RMap >
Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::RegionAttributes ( const RMap &  rmap,
const Attributes &  attr 
)
inline

Constructor.

Template Parameters
RMapClass type that implements the RegionMapping protocol. Typically an instantiation of
Opm::RegionMapping<>
.
Parameters
[in]rmapSpecific region mapping that provides reverse lookup from regions to cells.
[in]attrPre-constructed initialiser for Attributes.

Member Function Documentation

◆ attributes() [1/3]

template<typename RegionId , class Attributes >
const AttributeMap & Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::attributes ( ) const
inline

Request read-only access to region's attributes.

Returns
Read-only access to all regions attributes.

◆ attributes() [2/3]

template<typename RegionId , class Attributes >
Attributes & Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::attributes ( const RegionID  reg)
inline

Request modifiable access to region's attributes.

Parameters
[in]regSpecific region.
Returns
Read-write access to region reg's per-region attributes.

References Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::Value::attr_.

◆ attributes() [3/3]

template<typename RegionId , class Attributes >
const Attributes & Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::attributes ( const RegionID  reg) const
inline

Request read-only access to region's attributes.

Parameters
[in]regSpecific region.
Returns
Read-only access to region reg's per-region attributes.

References Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::Value::attr_.

◆ cell()

template<typename RegionId , class Attributes >
int Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::cell ( const RegionID  reg) const
inline

Retrieve representative cell in region.

Parameters
[in]regSpecific region.
Returns
Representative cell in region reg.

References Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::Value::cell_.

◆ has()

template<typename RegionId , class Attributes >
bool Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::has ( const RegionID  reg) const
inline

◆ insert()

template<typename RegionId , class Attributes >
void Opm::RegionAttributeHelpers::RegionAttributes< RegionId, Attributes >::insert ( const RegionID  r,
const Attributes &  attr 
)
inline

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