mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#687) Moved FileInterface tests into ApplicationCode/UnitTests
This commit is contained in:
@@ -1,114 +0,0 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
SET (ProjectName FileInterface_UnitTests)
|
||||
project ( ${ProjectName} )
|
||||
|
||||
|
||||
# Qt
|
||||
find_package (Qt4 COMPONENTS QtCore QtGui QtMain QtOpenGl REQUIRED)
|
||||
include (${QT_USE_FILE})
|
||||
|
||||
include_directories(
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/ResultStatisticsCache
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/FileInterface
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/ProjectDataModel
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty
|
||||
|
||||
${ResInsight_SOURCE_DIR}/Fwk/AppFwk/cafProjectDataModel
|
||||
|
||||
${ResInsight_SOURCE_DIR}/Fwk/AppFwk/CommonCode
|
||||
|
||||
#Remove when RigStatistics is out
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/ModelVisualization
|
||||
)
|
||||
|
||||
|
||||
# Populate variables from read from CMakeLists_files.cmake
|
||||
set (CODE_SOURCE_FILES )
|
||||
include ("${ResInsight_SOURCE_DIR}/ApplicationCode/FileInterface/CMakeLists_files.cmake")
|
||||
set( CPP_SOURCES
|
||||
${CPP_SOURCES}
|
||||
${CODE_SOURCE_FILES}
|
||||
)
|
||||
source_group( "FileInterface" FILES ${CODE_SOURCE_FILES} )
|
||||
|
||||
|
||||
# Populate variables from read from CMakeLists_files.cmake
|
||||
set (CODE_SOURCE_FILES )
|
||||
include ("${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake")
|
||||
set( CPP_SOURCES
|
||||
${CPP_SOURCES}
|
||||
${CODE_SOURCE_FILES}
|
||||
)
|
||||
source_group( "ReservoirDataModel" FILES ${CODE_SOURCE_FILES} )
|
||||
|
||||
|
||||
set( CPP_SOURCES
|
||||
${CPP_SOURCES}
|
||||
|
||||
${ResInsight_SOURCE_DIR}/Fwk/AppFwk/cafUserInterface/cafProgressInfo.cpp
|
||||
)
|
||||
|
||||
source_group( "Headers" FILES ${CODE_HEADER_FILES} )
|
||||
|
||||
set( UNIT_TEST_CPP_SOURCES
|
||||
main.cpp
|
||||
RifReaderEclipseOutput-Test.cpp
|
||||
RifEclipseInputFileTools-Test.cpp
|
||||
Ert-Test.cpp
|
||||
)
|
||||
|
||||
set( LINK_LIBRARIES
|
||||
cafProjectDataModel
|
||||
CommonCode
|
||||
|
||||
ResultStatisticsCache
|
||||
|
||||
LibViewing
|
||||
LibRender
|
||||
LibGeometry
|
||||
LibCore
|
||||
|
||||
ecl
|
||||
ert_util
|
||||
ert_geometry
|
||||
ecl_well
|
||||
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(CMAKE_CXX_FLAGS "-DGTEST_USE_OWN_TR1_TUPLE=1")
|
||||
endif()
|
||||
|
||||
add_executable( ${ProjectName}
|
||||
${CODE_HEADER_FILES}
|
||||
|
||||
${CPP_SOURCES}
|
||||
${UNIT_TEST_CPP_SOURCES}
|
||||
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
|
||||
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/FileInterface/CMakeLists_files.cmake
|
||||
${ResInsight_SOURCE_DIR}/ApplicationCode/ReservoirDataModel/CMakeLists_files.cmake
|
||||
)
|
||||
|
||||
set( EXTERNAL_LINK_LIBRARIES ${ERT_LIBRARY_LIST} )
|
||||
target_link_libraries( ${ProjectName} ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
||||
|
||||
|
||||
# Copy Dlls
|
||||
if (MSVC)
|
||||
|
||||
# Qt DLLs
|
||||
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
|
||||
foreach (qtlib ${QTLIBLIST})
|
||||
add_custom_command(TARGET ${ProjectName} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"${QT_BINARY_DIR}/${qtlib}4.dll"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
|
||||
endforeach( qtlib )
|
||||
|
||||
endif(MSVC)
|
@@ -1,206 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <util.h>
|
||||
#include <int_vector.h>
|
||||
#include <ecl_file.h>
|
||||
#include <ecl_kw.h>
|
||||
#include <ecl_kw_magic.h>
|
||||
#include <ecl_util.h>
|
||||
|
||||
#include <well_state.h>
|
||||
#include <well_info.h>
|
||||
#include <well_conn.h>
|
||||
#include <well_ts.h>
|
||||
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
#include "RifReaderEclipseInput.h"
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// This file contains test code taken from the test cases in ERT source code.
|
||||
// There is a typedef issue (center) between ERT and QTextStream, so this file does not include any
|
||||
// Qt files.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, WellTestErt)
|
||||
{
|
||||
char filename[1024] = "TEST10K_FLT_LGR_NNC.UNRST";
|
||||
|
||||
well_info_type * well_info = well_info_alloc( NULL );
|
||||
well_info_load_rstfile( well_info , filename);
|
||||
|
||||
// List all wells:
|
||||
{
|
||||
int iwell;
|
||||
for (iwell = 0; iwell < well_info_get_num_wells( well_info ); iwell++)
|
||||
{
|
||||
printf("Well[%02d] : %s \n",iwell , well_info_iget_well_name( well_info , iwell));
|
||||
}
|
||||
}
|
||||
|
||||
// Look at the timeseries for one well:
|
||||
{
|
||||
well_ts_type * well_ts = well_info_get_ts( well_info , well_info_iget_well_name( well_info , 0));
|
||||
for (int i =0; i < well_ts_get_size( well_ts ); i++)
|
||||
{
|
||||
well_state_type * well_state = well_ts_iget_state( well_ts , i );
|
||||
|
||||
printf("Well:%s report:%04d state:",well_state_get_name( well_state ), well_state_get_report_nr( well_state ));
|
||||
if (well_state_is_open( well_state ))
|
||||
printf("OPEN\n");
|
||||
else
|
||||
printf("CLOSED\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Look at one well_state:
|
||||
{
|
||||
well_state_type * well_state = well_info_iiget_state( well_info , 0 , 0 );
|
||||
printf("Well:%s report:%04d \n",well_state_get_name( well_state ), well_state_get_report_nr( well_state ));
|
||||
{
|
||||
int branchCount = well_state_get_num_branches(well_state);
|
||||
for (int ibranch = 0 ; ibranch < branchCount; ++ibranch)
|
||||
{
|
||||
printf("Branch: %d", ibranch);
|
||||
for (int iconn = 0; iconn < well_state_get_num_connections( well_state, ibranch ); iconn++)
|
||||
{
|
||||
const well_conn_type * conn = well_state_get_connections( well_state , ibranch)[iconn];
|
||||
printf("Connection:%02d i=%3d j=%3d k=%3d State:",iconn , conn->i, conn->j , conn->k);
|
||||
if (conn->open)
|
||||
printf("Open\n");
|
||||
else
|
||||
printf("Closed\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
well_info_free( well_info );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// This file contains test code taken from the test cases in ERT source code.
|
||||
// There is a typedef issue (center) between ERT and QTextStream, so this file does not include any
|
||||
// Qt files.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, ElipseInputGridFile)
|
||||
{
|
||||
RigCaseData res;
|
||||
RifReaderEclipseInput inputReader;
|
||||
bool result = inputReader.open("TEST10K_FLT_LGR_NNC.grdecl", &res);
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
|
||||
TEST(RigReservoirTest, ReadFaults)
|
||||
{
|
||||
// QString filename("d:/Models/Statoil/testcase_juli_2011/data/grid_local.grdecl");
|
||||
//
|
||||
// std::vector< RifKeywordAndFilePos > fileKeywords;
|
||||
// RifEclipseInputFileTools::findKeywordsOnFile(filename, fileKeywords);
|
||||
//
|
||||
// cvf::Collection<RigFault> faults;
|
||||
//
|
||||
// RifEclipseInputFileTools::readFaults(filename, faults, fileKeywords);
|
||||
|
||||
// for (size_t j = 0; j < faults.size(); j++)
|
||||
// {
|
||||
// printf(faults.at(j)->name().toLatin1());
|
||||
// printf("\n");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, ReadFaultsRecursively)
|
||||
{
|
||||
//TODO: Establish a way to define location of test model files
|
||||
|
||||
//QString filename("d:/Models/Statoil/TEST_RKMFAULTS/TEST_RKMFAULTS.DATA");
|
||||
QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.DATA");
|
||||
|
||||
// QString filename("d:/gitroot/ResInsight/TestModels/fault_test/regular27cell.DATA");
|
||||
|
||||
QString outFilename = "d:/tmp/msj_faults.txt";
|
||||
QFile outputFile(outFilename);
|
||||
{
|
||||
if (!outputFile.open(QIODevice::WriteOnly))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream outStream(&outputFile);
|
||||
|
||||
cvf::Collection<RigFault> faults;
|
||||
|
||||
std::vector<QString> filenamesWithFaults;
|
||||
RifEclipseInputFileTools::readFaultsInGridSection(filename, faults, filenamesWithFaults);
|
||||
|
||||
// EXPECT_EQ(4, faults.size());
|
||||
|
||||
for (size_t j = 0; j < faults.size(); j++)
|
||||
{
|
||||
const RigFault* rigFault = faults.at(j);
|
||||
|
||||
printf(rigFault->name().toLatin1());
|
||||
|
||||
for (size_t faceType = 0; faceType < 6; faceType++)
|
||||
{
|
||||
cvf::StructGridInterface::FaceType faceEnum = cvf::StructGridInterface::FaceType(faceType);
|
||||
// const std::vector<cvf::CellRange>& cellRanges = rigFault->cellRangeForFace(faceEnum);
|
||||
//
|
||||
// for (size_t i = 0; i < cellRanges.size(); i++)
|
||||
// {
|
||||
// cvf::Vec3st min, max;
|
||||
// cellRanges[i].range(min, max);
|
||||
//
|
||||
// QString tmp;
|
||||
// tmp = tmp.sprintf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d \n", min.x(), min.y(), min.z(), max.x(), max.y(), max.z());
|
||||
//
|
||||
// outStream << tmp;
|
||||
//
|
||||
// // printf("min i=%3d j=%3d k=%3d - max i=%3d j=%3d k=%3d ", min.x(), min.y(), min.z(), max.x(), max.y(), max.z());
|
||||
// // printf("\n");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@@ -1,113 +0,0 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RifEclipseInputFileToolsTest, FaultFaces)
|
||||
{
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "X" << "X+" << "I" << "I+" << "x" << "x+" << "i" << "i+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach (QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::POS_I, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "X-" << "I-" << "x-" << "i-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::NEG_I, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "Y" << "Y+" << "J" << "J+" << "y" << "y+" << "j" << "j+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::POS_J, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "Y-" << "J-" << "y-" << "j-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::NEG_J, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "Z" << "Z+" << "K" << "k+" << "z" << "z+" << "k" << "k+";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::POS_K, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "Z-" << "K-" << "z-" << "k-";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::NEG_K, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Invalid faces
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << "Z--" << "z--" << "-k-" << " -k " << " +k- ";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::NO_FACE, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
// Valid cases with whitespace
|
||||
{
|
||||
QStringList faceTexts;
|
||||
faceTexts << " X" << " X+ " << " I " << " i+ ";
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceType;
|
||||
foreach(QString text, faceTexts)
|
||||
{
|
||||
faceType = RifEclipseInputFileTools::faceEnumFromText(text);
|
||||
EXPECT_EQ(cvf::StructGridInterface::POS_I, faceType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,377 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaStdInclude.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RigCaseData.h"
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
#include "ecl_file.h"
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifReaderSettings.h"
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, DISABLED_BasicTest)
|
||||
{
|
||||
|
||||
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||
cvf::ref<RigCaseData> reservoir = new RigCaseData;
|
||||
|
||||
QString filename("d:/Models/Statoil/troll_MSW/T07-4A-W2012-16-F3.EGRID");
|
||||
|
||||
RifReaderSettings readerSettings;
|
||||
readerInterfaceEcl->setReaderSetting(&readerSettings);
|
||||
|
||||
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
{
|
||||
// QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
// EXPECT_EQ(42, staticResults.size());
|
||||
// qDebug() << "Static results\n" << staticResults;
|
||||
//
|
||||
// QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
// EXPECT_EQ(23, dynamicResults.size());
|
||||
// qDebug() << "Dynamic results\n" << dynamicResults;
|
||||
//
|
||||
// int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
// EXPECT_EQ(9, numTimeSteps);
|
||||
//
|
||||
// QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
// EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
// qDebug() << "Time step texts\n" << timeStepText;
|
||||
}
|
||||
|
||||
|
||||
readerInterfaceEcl->close();
|
||||
|
||||
{
|
||||
// QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
// EXPECT_EQ(0, staticResults.size());
|
||||
//
|
||||
// QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
// EXPECT_EQ(0, dynamicResults.size());
|
||||
//
|
||||
// int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
// EXPECT_EQ(0, numTimeSteps);
|
||||
//
|
||||
// QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
// EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(RigReservoirTest, DISABLED_FileOutputToolsTest)
|
||||
{
|
||||
cvf::DebugTimer timer("test");
|
||||
|
||||
|
||||
// QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
// QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST");
|
||||
// QString filename("d:/Models/Statoil/troll_MSW/T07-4A-W2012-16-F3.UNRST");
|
||||
QString filename("c:/tmp/troll_MSW/T07-4A-W2012-16-F3.UNRST");
|
||||
|
||||
|
||||
ecl_file_type* ertFile = ecl_file_open(filename.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||
EXPECT_TRUE(ertFile);
|
||||
|
||||
|
||||
QStringList keywords;
|
||||
std::vector<size_t> keywordDataItemCounts;
|
||||
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ertFile, &keywords, &keywordDataItemCounts);
|
||||
|
||||
EXPECT_TRUE(keywords.size() == keywordDataItemCounts.size());
|
||||
|
||||
qDebug() << "Keyword - Number of data items";
|
||||
for (int i = 0; i < keywords.size(); i++)
|
||||
{
|
||||
QString paddedKeyword = QString("%1").arg(keywords[i], 8);
|
||||
qDebug() << paddedKeyword << " - " << keywordDataItemCounts[i];
|
||||
}
|
||||
|
||||
ecl_file_close(ertFile);
|
||||
ertFile = NULL;
|
||||
|
||||
timer.reportTime();
|
||||
//qDebug() << timer.lapt;
|
||||
}
|
||||
|
||||
|
||||
TEST(RigReservoirTest, UnifiedTestFile)
|
||||
{
|
||||
//QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST");
|
||||
QString filename("d:/Models/Statoil/troll_MSW/T07-4A-W2012-16-F3.UNRST");
|
||||
|
||||
{
|
||||
cvf::ref<RifEclipseUnifiedRestartFileAccess> restartFile = new RifEclipseUnifiedRestartFileAccess();
|
||||
|
||||
QStringList fileNameList;
|
||||
fileNameList << filename;
|
||||
restartFile->setRestartFiles(fileNameList);
|
||||
restartFile->open();
|
||||
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> resultDataItemCounts;
|
||||
restartFile->resultNames(&resultNames, &resultDataItemCounts);
|
||||
|
||||
qDebug() << "Result names\n";
|
||||
for (int i = 0; i < resultNames.size(); i++)
|
||||
{
|
||||
qDebug() << resultNames[i] << "\t" << resultDataItemCounts[i];
|
||||
}
|
||||
|
||||
std::vector<QDateTime> tsteps = restartFile->timeSteps();
|
||||
|
||||
qDebug() << "Time step texts\n";
|
||||
for (int i = 0; i < tsteps.size(); i++)
|
||||
{
|
||||
qDebug() << tsteps[i].toString();
|
||||
}
|
||||
|
||||
/*
|
||||
std::vector<double> resultValues;
|
||||
size_t timeStep = 0;
|
||||
restartFile->results(resultNames[0], timeStep, &resultValues);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < 500; i++)
|
||||
{
|
||||
qDebug() << resultValues[i];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void buildResultInfoString(RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, RimDefines::ResultCatType resultType)
|
||||
{
|
||||
RigCaseCellResultsData* matrixResults = reservoir->results(porosityModel);
|
||||
{
|
||||
QStringList resultNames = matrixResults->resultNames(resultType);
|
||||
|
||||
for (size_t i = 0 ; i < resultNames.size(); i++)
|
||||
{
|
||||
std::vector<double> values;
|
||||
size_t scalarResultIndex = matrixResults->findOrLoadScalarResult(resultType, resultNames[i]);
|
||||
EXPECT_TRUE(scalarResultIndex != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
QString resultText = QString("%1").arg(resultNames[i], 8);
|
||||
std::vector< std::vector<double> > & resultValues = matrixResults->cellScalarResults(scalarResultIndex);
|
||||
for (size_t timeStepIdx = 0; timeStepIdx < matrixResults->timeStepCount(scalarResultIndex); timeStepIdx++)
|
||||
{
|
||||
size_t resultValueCount = resultValues[timeStepIdx].size();
|
||||
resultText += QString(" %1").arg(resultValueCount);
|
||||
}
|
||||
|
||||
qDebug() << resultText;
|
||||
}
|
||||
qDebug() << "Number of items : " << resultNames.size();
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RigReservoirTest, DualPorosityTest)
|
||||
{
|
||||
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||
cvf::ref<RigReservoir> reservoir = new RigReservoir;
|
||||
|
||||
QString filename("d:/Models/Statoil/DualProperty/DUALPORO.EGRID");
|
||||
//QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
|
||||
|
||||
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
|
||||
qDebug() << "\n\n" <<
|
||||
"Matrix porosities, DYNAMIC results" <<
|
||||
"----------------------------------";
|
||||
buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RimDefines::DYNAMIC_NATIVE);
|
||||
|
||||
qDebug() << "\n\n" <<
|
||||
"Matrix porosities, STATIC results" <<
|
||||
"----------------------------------";
|
||||
buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RimDefines::STATIC_NATIVE);
|
||||
|
||||
qDebug() << "\n\n" <<
|
||||
"Fracture porosities, DYNAMIC results" <<
|
||||
"----------------------------------";
|
||||
buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RimDefines::DYNAMIC_NATIVE);
|
||||
|
||||
qDebug() << "\n\n" <<
|
||||
"Fracture porosities, STATIC results" <<
|
||||
"----------------------------------";
|
||||
buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RimDefines::STATIC_NATIVE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
|
||||
/*
|
||||
TEST(RigReservoirTest, UnifiedTestFile)
|
||||
{
|
||||
|
||||
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||
#ifdef WIN32
|
||||
QString filename("d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST");
|
||||
#else
|
||||
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST");
|
||||
#endif
|
||||
|
||||
size_t numActiveCells = 11125;
|
||||
size_t numGrids = 2;
|
||||
|
||||
{
|
||||
cvf::ref<RifEclipseUnifiedRestartFileAccess> restartFile = new RifEclipseUnifiedRestartFileAccess(numGrids, numActiveCells);
|
||||
|
||||
QStringList fileNameList;
|
||||
fileNameList << filename;
|
||||
restartFile->open(fileNameList);
|
||||
|
||||
QStringList resultNames = restartFile->resultNames();
|
||||
qDebug() << "Result names\n" << resultNames;
|
||||
|
||||
QStringList timeStepText = restartFile->timeStepsText();
|
||||
qDebug() << "Time step texts\n" << timeStepText;
|
||||
|
||||
std::vector<double> resultValues;
|
||||
size_t timeStep = 0;
|
||||
restartFile->results(resultNames[0], timeStep, &resultValues);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < 500; i++)
|
||||
{
|
||||
qDebug() << resultValues[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, BasicTest)
|
||||
{
|
||||
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||
cvf::ref<RigReservoir> reservoir = new RigReservoir;
|
||||
|
||||
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||
#ifdef WIN32
|
||||
QString filename("TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#else
|
||||
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#endif
|
||||
|
||||
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
{
|
||||
QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
EXPECT_EQ(42, staticResults.size());
|
||||
qDebug() << "Static results\n" << staticResults;
|
||||
|
||||
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
EXPECT_EQ(23, dynamicResults.size());
|
||||
qDebug() << "Dynamic results\n" << dynamicResults;
|
||||
|
||||
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
EXPECT_EQ(9, numTimeSteps);
|
||||
|
||||
QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
qDebug() << "Time step texts\n" << timeStepText;
|
||||
}
|
||||
|
||||
|
||||
readerInterfaceEcl->close();
|
||||
|
||||
{
|
||||
QStringList staticResults = readerInterfaceEcl->staticResults();
|
||||
EXPECT_EQ(0, staticResults.size());
|
||||
|
||||
QStringList dynamicResults = readerInterfaceEcl->dynamicResults();
|
||||
EXPECT_EQ(0, dynamicResults.size());
|
||||
|
||||
int numTimeSteps = static_cast<int>(readerInterfaceEcl->numTimeSteps());
|
||||
EXPECT_EQ(0, numTimeSteps);
|
||||
|
||||
QStringList timeStepText = readerInterfaceEcl->timeStepText();
|
||||
EXPECT_EQ(numTimeSteps, timeStepText.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigReservoirTest, WellTest)
|
||||
{
|
||||
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
|
||||
cvf::ref<RigCaseData> reservoir = new RigCaseData;
|
||||
|
||||
// Location of test dataset received from Håkon Høgstøl in July 2011 with 10k active cells
|
||||
#ifdef WIN32
|
||||
QString filename("TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#else
|
||||
QString filename("/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID");
|
||||
#endif
|
||||
|
||||
bool result = readerInterfaceEcl->open(filename, reservoir.p());
|
||||
EXPECT_TRUE(result);
|
||||
|
||||
cvf::UByteArray* mainGridWellCells = reservoir->wellCellsInGrid(0);
|
||||
EXPECT_TRUE(mainGridWellCells->size() == reservoir->mainGrid()->cellCount());
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaStdInclude.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cvfTrace.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
cvf::Assert::setReportMode(cvf::Assert::CONSOLE);
|
||||
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
int result = RUN_ALL_TESTS();
|
||||
|
||||
std::cout << "Please press <Enter> to close the window.";
|
||||
std::cin.get();
|
||||
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user