Merge pull request #901 from jokva/grid-export-compressed-map
Active cell cache with automatic storage
This commit is contained in:
@@ -679,26 +679,27 @@ namespace Opm {
|
||||
}
|
||||
|
||||
const std::vector<int>& EclipseGrid::getActiveMap() const {
|
||||
if (!activeMap) {
|
||||
std::vector<int> * data_ptr = new std::vector<int>( getNumActive() );
|
||||
std::vector<int>& data = *data_ptr;
|
||||
activeMap.reset( data_ptr );
|
||||
if( !this->activeMap.empty() ) return this->activeMap;
|
||||
|
||||
for (int global_index = 0; global_index < static_cast<int>(getCartesianSize()); global_index++) {
|
||||
// Using the low level C function to get the active index, because the C++
|
||||
// version will throw for inactive cells.
|
||||
int active_index = ecl_grid_get_active_index1( m_grid.get() , global_index );
|
||||
if (active_index >= 0)
|
||||
data[active_index] = global_index;
|
||||
}
|
||||
this->activeMap.resize( this->getNumActive() );
|
||||
const auto size = int(this->getCartesianSize());
|
||||
|
||||
for( int global_index = 0; global_index < size; global_index++) {
|
||||
// Using the low level C function to get the active index, because the C++
|
||||
// version will throw for inactive cells.
|
||||
int active_index = ecl_grid_get_active_index1( m_grid.get() , global_index );
|
||||
if (active_index >= 0)
|
||||
this->activeMap[ active_index ] = global_index;
|
||||
}
|
||||
|
||||
return *activeMap;
|
||||
return this->activeMap;
|
||||
}
|
||||
|
||||
void EclipseGrid::resetACTNUM( const int * actnum) {
|
||||
activeMap.reset( 0 );
|
||||
ecl_grid_reset_actnum( m_grid.get() , actnum );
|
||||
/* re-build the active map cache */
|
||||
this->activeMap.clear();
|
||||
this->getActiveMap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -87,9 +87,7 @@ namespace Opm {
|
||||
double getMinpvValue( ) const;
|
||||
|
||||
/// Will return a vector a length num_active; where the value
|
||||
/// of each element is the corresponding global index. Observe
|
||||
/// that this reference is *invalidated* if there is a call to
|
||||
/// resetACTNUM().
|
||||
/// of each element is the corresponding global index.
|
||||
const std::vector<int>& getActiveMap() const;
|
||||
std::array<double, 3> getCellCenter(size_t i,size_t j, size_t k) const;
|
||||
std::array<double, 3> getCellCenter(size_t globalIndex) const;
|
||||
@@ -123,7 +121,7 @@ namespace Opm {
|
||||
Value<double> m_pinch;
|
||||
PinchMode::ModeEnum m_pinchoutMode;
|
||||
PinchMode::ModeEnum m_multzMode;
|
||||
mutable std::unique_ptr< std::vector<int> > activeMap;
|
||||
mutable std::vector< int > activeMap;
|
||||
|
||||
void initCornerPointGrid(const std::array<int,3>& dims ,
|
||||
const std::vector<double>& coord ,
|
||||
|
||||
Reference in New Issue
Block a user