From 6c9f5d1978753196f3cd922af4ebf479d6b84484 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 7 Apr 2013 16:33:45 +0200 Subject: [PATCH] Added reading of grid dimensions p4#: 21154 --- .../RifEclipseOutputFileTools.cpp | 18 ++++++++++++++++++ .../FileInterface/RifEclipseOutputFileTools.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp index 4be4484dbc..5cffc1a15c 100644 --- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -21,6 +21,7 @@ #include "util.h" #include "ecl_file.h" #include "ecl_kw_magic.h" +#include "ecl_grid.h" #include #include @@ -301,3 +302,20 @@ void RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file_type* ecl info.setProgress(i); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName, std::vector< std::vector >& gridDimensions) +{ + int gridDims[3]; + + bool ret = ecl_grid_file_dims(gridFileName.toAscii().data(), NULL, gridDims); + if (ret) + { + gridDimensions.resize(1); + gridDimensions[0].push_back(gridDims[0]); + gridDimensions[0].push_back(gridDims[1]); + gridDimensions[0].push_back(gridDims[2]); + } +} diff --git a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.h b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.h index 052c1f258b..3824b9bc01 100644 --- a/ApplicationCode/FileInterface/RifEclipseOutputFileTools.h +++ b/ApplicationCode/FileInterface/RifEclipseOutputFileTools.h @@ -54,4 +54,6 @@ public: static QString fileNameByType(const QStringList& fileSet, ecl_file_enum fileType); static QStringList fileNamesByType(const QStringList& fileSet, ecl_file_enum fileType); + + static void readGridDimensions(const QString& gridFileName, std::vector< std::vector >& gridDimensions); };