GridProperty<T>: Track Defaulted Cell Status

This commit adds a new data member (GridProperty<T>::m_defaulted)
that keeps track of whether or not a particular data item has been
implicitly assigned from the input deck.  GridProperty::setDataItem
assigns 'false', while the constructor initialises 'm_defaulted' to
true for all Cartesian cells.

The main objective is to be able to apply a post processor only to
those cells for which the input deck does not supply an explicit
value.
This commit is contained in:
Bård Skaflestad 2019-06-27 18:10:19 +02:00
parent ffba2b114b
commit 430cc9d7b2
2 changed files with 10 additions and 0 deletions

View File

@ -110,6 +110,7 @@ public:
void iset(size_t i , size_t j , size_t k , T value);
const std::vector<bool>& wasDefaulted() const;
const std::vector<T>& getData() const;
std::vector<T>& getData();
@ -269,6 +270,7 @@ private:
size_t m_nx, m_ny, m_nz;
SupportedKeywordInfo m_kwInfo;
std::vector<T> m_data;
std::vector<bool> m_defaulted;
bool m_hasRunPostProcessor = false;
bool assigned = false;
};

View File

@ -129,6 +129,7 @@ namespace Opm {
m_nz( nz ),
m_kwInfo( kwInfo ),
m_data( kwInfo.initializer()( nx * ny * nz ) ),
m_defaulted( nx * ny * nz, true ),
m_hasRunPostProcessor( false )
{}
@ -179,6 +180,11 @@ namespace Opm {
iset(g,value);
}
template< typename T >
const std::vector< bool >& GridProperty< T >::wasDefaulted() const {
return this->m_defaulted;
}
template< typename T >
const std::vector< T >& GridProperty< T >::getData() const {
return m_data;
@ -425,11 +431,13 @@ namespace Opm {
template<>
void GridProperty<int>::setDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem) {
m_data[targetIdx] = deckItem.get< int >(sourceIdx);
m_defaulted[targetIdx] = false;
}
template<>
void GridProperty<double>::setDataPoint(size_t sourceIdx, size_t targetIdx, const DeckItem& deckItem) {
m_data[targetIdx] = deckItem.getSIDouble(sourceIdx);
m_defaulted[targetIdx] = false;
}
template<>