mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-27 13:47:12 -05:00
Add readGridDimensions
This commit is contained in:
@@ -72,6 +72,31 @@ RifReaderOpmCommon::~RifReaderOpmCommon()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderOpmCommon::GridDimensions RifReaderOpmCommon::readGridDimensions( const QString& gridFileName )
|
||||
{
|
||||
GridDimensions result;
|
||||
|
||||
try
|
||||
{
|
||||
Opm::EclIO::EGrid opmGrid( gridFileName.toStdString() );
|
||||
|
||||
const auto& dims = opmGrid.dimension();
|
||||
result.i = dims[0];
|
||||
result.j = dims[1];
|
||||
result.k = dims[2];
|
||||
result.activeCellCount = opmGrid.activeCells();
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
{
|
||||
RiaLogging::debug( QString( "Failed to read grid dimensions from %1: %2" ).arg( gridFileName ).arg( e.what() ) );
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -53,6 +53,14 @@ class ProgressInfo;
|
||||
class RifReaderOpmCommon : public RifReaderInterface
|
||||
{
|
||||
public:
|
||||
struct GridDimensions
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
size_t activeCellCount = 0;
|
||||
};
|
||||
|
||||
RifReaderOpmCommon();
|
||||
~RifReaderOpmCommon() override;
|
||||
|
||||
@@ -64,6 +72,8 @@ public:
|
||||
std::vector<QDateTime> timeStepsOnFile( QString gridFileName );
|
||||
std::set<RiaDefines::PhaseType> availablePhases() const override;
|
||||
|
||||
static GridDimensions readGridDimensions( const QString& gridFileName );
|
||||
|
||||
protected:
|
||||
virtual bool importGrid( RigMainGrid* mainGrid, RigEclipseCaseData* caseData );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user