Merge branch 'dev' into hdf-prototype

This commit is contained in:
Magne Sjaastad
2017-08-14 10:47:44 +02:00
443 changed files with 20467 additions and 3429 deletions
@@ -10,18 +10,21 @@ set (SOURCE_GROUP_HEADER_FILES
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}cvfGeometryTools-Test.cpp
${CEE_CURRENT_LIST_DIR}Ert-Test.cpp
${CEE_CURRENT_LIST_DIR}RifcCommandCore-Test.cpp
${CEE_CURRENT_LIST_DIR}RifEclipseInputFileTools-Test.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput-Test.cpp
${CEE_CURRENT_LIST_DIR}RifReaderEclipseSummary-Test.cpp
${CEE_CURRENT_LIST_DIR}RigActiveCellInfo-Test.cpp
${CEE_CURRENT_LIST_DIR}RigReservoir-Test.cpp
${CEE_CURRENT_LIST_DIR}RigStatisticsMath-Test.cpp
${CEE_CURRENT_LIST_DIR}RigWellPathIntersectionTools-Test.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogExtractionCurveImpl-Test.cpp
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator-Test.cpp
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper-Test.cpp
${CEE_CURRENT_LIST_DIR}ScalarMapper-Test.cpp
${CEE_CURRENT_LIST_DIR}WellPathAsciiFileReader-Test.cpp
${CEE_CURRENT_LIST_DIR}opm-flowdiagnostics-Test.cpp
${CEE_CURRENT_LIST_DIR}RigTofAccumulatedPhaseFractionsCalculator-Test.cpp
${CEE_CURRENT_LIST_DIR}HDF5FileReader-Test.cpp
)
@@ -260,7 +260,7 @@ TEST(RigReservoirTest, UnifiedTestFile)
void buildResultInfoString(RigReservoir* reservoir, RifReaderInterface::PorosityModelResultType porosityModel, RimDefines::ResultCatType resultType)
void buildResultInfoString(RigReservoir* reservoir, RiaDefines::PorosityModelType porosityModel, RiaDefines::ResultCatType resultType)
{
RigCaseCellResultsData* matrixResults = reservoir->results(porosityModel);
{
@@ -302,22 +302,22 @@ TEST(RigReservoirTest, DualPorosityTest)
qDebug() << "\n\n" <<
"Matrix porosities, DYNAMIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RimDefines::DYNAMIC_NATIVE);
buildResultInfoString(reservoir.p(), RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE);
qDebug() << "\n\n" <<
"Matrix porosities, STATIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RifReaderInterface::MATRIX_RESULTS, RimDefines::STATIC_NATIVE);
buildResultInfoString(reservoir.p(), RiaDefines::MATRIX_MODEL, RiaDefines::STATIC_NATIVE);
qDebug() << "\n\n" <<
"Fracture porosities, DYNAMIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RimDefines::DYNAMIC_NATIVE);
buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::DYNAMIC_NATIVE);
qDebug() << "\n\n" <<
"Fracture porosities, STATIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RifReaderInterface::FRACTURE_RESULTS, RimDefines::STATIC_NATIVE);
buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::STATIC_NATIVE);
}
@@ -0,0 +1,167 @@
#include "gtest/gtest.h"
#include "RifcCommandFileReader.h"
#include "RicfCommandObject.h"
#include "cafPdmField.h"
#include "RicfMessages.h"
class TestCommand1: public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
TestCommand1()
{
RICF_InitField(&m_textArgument, "TextArgument", QString(), "TextArgument", "", "", "");
RICF_InitField(&m_doubleArgument, "DoubleArgument", 0.0, "DoubleArgument", "", "", "");
RICF_InitField(&m_intArgument, "IntArgument", 0, "IntArgument", "", "", "");
}
virtual void execute() override { std::cout << "TestCommand1::execute(" << "\"" << m_textArgument().toStdString() << "\", "
<< m_doubleArgument() << ", "
<< m_intArgument << ");" << std::endl; }
caf::PdmField<QString> m_textArgument;
caf::PdmField<double> m_doubleArgument;
caf::PdmField<int> m_intArgument;
};
CAF_PDM_SOURCE_INIT(TestCommand1, "TestCommand1");
class TC2: public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
TC2()
{
RICF_InitField(&m_textArgument, "ta", QString(), "TextArgument", "", "", "");
RICF_InitField(&m_doubleArgument, "da", 0.0, "DoubleArgument", "", "", "");
RICF_InitField(&m_intArgument, "ia", 0,"IntArgument", "", "", "");
}
virtual void execute() override { std::cout << "TC2::execute(" << "\"" << m_textArgument().toStdString() << "\", "
<< m_doubleArgument() << ", "
<< m_intArgument << ");" << std::endl; }
caf::PdmField<QString> m_textArgument;
caf::PdmField<double> m_doubleArgument;
caf::PdmField<int> m_intArgument;
};
CAF_PDM_SOURCE_INIT(TC2, "TC2");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicfCommands, Test1)
{
QString commandString("TestCommand1(IntArgument=3, TextArgument=\"Dette er en tekst, \\\"og\\\" jeg er: (happy)\", DoubleArgument=5.0e3) \n"
"TestCommand1 ( IntArgument = 4 , \n TextArgument = \"Dette er en tekst, \\\"og\\\" jeg er: (happy)\", \n DoubleArgument = 5.0e-3 ) \n"
" TestCommand1(TextArgument=\"Litt kortere tekst.\") \n"
"TC2 ( ta = \"Hepp\", ia = 3, da= 0.123)");
//std::cout << commandString.toStdString() << std::endl;
QTextStream inputStream(&commandString);
RicfMessages errors;
auto objects = RicfCommandFileReader::readCommands(inputStream, caf::PdmDefaultObjectFactory::instance(), &errors);
EXPECT_EQ((size_t)4, objects.size());
auto tc2 = dynamic_cast<TestCommand1*>(objects[0]);
EXPECT_EQ(39, tc2->m_textArgument().size());
EXPECT_EQ(5.0e3, tc2->m_doubleArgument());
tc2 = dynamic_cast<TestCommand1*>(objects[1]);
EXPECT_EQ(39, tc2->m_textArgument().size());
EXPECT_EQ(5e-3, tc2->m_doubleArgument());
tc2 = dynamic_cast<TestCommand1*>(objects[2]);
EXPECT_EQ(19, tc2->m_textArgument().size());
EXPECT_EQ(0.0, tc2->m_doubleArgument());
auto tc3 = dynamic_cast<TC2*>(objects[3]);
EXPECT_EQ(4, tc3->m_textArgument().size());
EXPECT_EQ(0.123, tc3->m_doubleArgument());
EXPECT_EQ(3, tc3->m_intArgument());
for (auto obj: objects)
{
obj->execute();
}
for (auto obj: objects)
{
delete(obj);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicfCommands, ErrorMessages)
{
QString commandString("TesCommand1(IntArgument=3, TextArgument=\"Dette er en tekst, \\\"og\\\" jeg er: (happy)\", DoubleArgument=5.0e3) \n"
"TestCommand1 ( IntArgument = , \n TextA rgument = \"Dette er en tekst, \\\"og\\\" jeg er: (happy)\", \n DoubleArgument ) \n"
" TestCommand1(TextArgument=Litt kortere tekst.\") \n"
"TC3 ( ta = \"Hepp\", ia = 3, da= 0.123)");
std::cout << commandString.toStdString() << std::endl;
QTextStream inputStream(&commandString);
RicfMessages errors;
auto objects = RicfCommandFileReader::readCommands(inputStream, caf::PdmDefaultObjectFactory::instance(), &errors);
EXPECT_EQ((size_t)2, objects.size());
EXPECT_EQ((size_t)5, errors.m_messages.size());
// Errors should be:
// Line 1 : TesCommand1 does not exist
// Line 2 : Unreadable value for argument IntArgument
// Line 3 : Can't find = after argument named TextA (space withing argument name)
// Line 4 : Can't find = after argument named DoubleArgument
// Line 5 : Missing quotes around TextArgument value
for (const auto& msg: errors.m_messages)
{
QString label;
if (msg.first == RicfMessages::MESSAGE_ERROR)
{
label = "Error : ";
}
else
{
label = "Warning: ";
}
std::cout << label.toStdString() << msg.second.toStdString() << std::endl;
}
for (auto obj: objects)
{
delete(obj);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RicfCommands, EmptyArgumentList)
{
// Ensure no error messages when command with no arguments is read
QString commandString("TestCommand1()");
QTextStream inputStream(&commandString);
RicfMessages errors;
auto objects = RicfCommandFileReader::readCommands(inputStream, caf::PdmDefaultObjectFactory::instance(), &errors);
EXPECT_EQ((size_t)1, objects.size());
EXPECT_EQ((size_t)0, errors.m_messages.size());
for (auto obj : objects)
{
delete(obj);
}
}
@@ -0,0 +1,159 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 - Statoil ASA
//
// 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 "gtest/gtest.h"
#include "RigTofAccumulatedPhaseFractionsCalculator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFractionTest)
{
std::vector<double> tofDataVector;
tofDataVector.push_back(0.001);
tofDataVector.push_back(0.1);
tofDataVector.push_back(0.01);
std::vector<double> fractionDataVector;
fractionDataVector.push_back(0.002);
fractionDataVector.push_back(0.2);
fractionDataVector.push_back(0.02);
std::vector<double> porvResultVector;
porvResultVector.push_back(1);
porvResultVector.push_back(1);
porvResultVector.push_back(1.5);
std::vector<double> swatResultVector;
swatResultVector.push_back(0.1);
swatResultVector.push_back(0.3);
swatResultVector.push_back(0.6);
std::vector<double> soilResultVector;
soilResultVector.push_back(0.3);
soilResultVector.push_back(0.6);
soilResultVector.push_back(0.1);
std::vector<double> sgasResultVector;
sgasResultVector.push_back(0.6);
sgasResultVector.push_back(0.1);
sgasResultVector.push_back(0.3);
std::vector<double> accumulatedPhaseFractionSwat;
std::vector<double> accumulatedPhaseFractionSoil;
std::vector<double> accumulatedPhaseFractionSgas;
std::vector<double> tofInIncreasingOrder;
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector),
&(fractionDataVector),
&(porvResultVector),
&(swatResultVector),
&(soilResultVector),
&(sgasResultVector),
tofInIncreasingOrder,
accumulatedPhaseFractionSwat,
accumulatedPhaseFractionSoil,
accumulatedPhaseFractionSgas
);
EXPECT_LT(tofInIncreasingOrder[0], tofInIncreasingOrder[1]);
EXPECT_LT(tofInIncreasingOrder[1], tofInIncreasingOrder[2]);
double sumForOneTOF = accumulatedPhaseFractionSwat[2]
+ accumulatedPhaseFractionSoil[2]
+ accumulatedPhaseFractionSgas[2];
EXPECT_DOUBLE_EQ(sumForOneTOF, 1.00);
EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSwat[0], 0.1000);
EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSoil[1], 0.1125);
EXPECT_LT(accumulatedPhaseFractionSgas[2] - 0.13017, 0.00001);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigTofAccumulatedPhaseFractionsCalculator, sortTofAndCalculateAccPhaseFractionTest2)
{
std::vector<double> tofDataVector2;
tofDataVector2.push_back(0.001);
tofDataVector2.push_back(0.1);
tofDataVector2.push_back(0.01);
tofDataVector2.push_back(0.1);
std::vector<double> fractionDataVector2;
fractionDataVector2.push_back(0.002);
fractionDataVector2.push_back(0.2);
fractionDataVector2.push_back(0.02);
fractionDataVector2.push_back(0.02);
std::vector<double> porvResultVector2;
porvResultVector2.push_back(1);
porvResultVector2.push_back(1);
porvResultVector2.push_back(1.5);
porvResultVector2.push_back(1.5);
std::vector<double> swatResultVector2;
swatResultVector2.push_back(0.1);
swatResultVector2.push_back(0.3);
swatResultVector2.push_back(0.6);
swatResultVector2.push_back(0.6);
std::vector<double> soilResultVector2;
soilResultVector2.push_back(0.3);
soilResultVector2.push_back(0.6);
soilResultVector2.push_back(0.1);
soilResultVector2.push_back(0.1);
std::vector<double> sgasResultVector2;
sgasResultVector2.push_back(0.6);
sgasResultVector2.push_back(0.1);
sgasResultVector2.push_back(0.3);
sgasResultVector2.push_back(0.3);
std::vector<double> accumulatedPhaseFractionSwat2;
std::vector<double> accumulatedPhaseFractionSoil2;
std::vector<double> accumulatedPhaseFractionSgas2;
std::vector<double> tofInIncreasingOrder2;
RigTofAccumulatedPhaseFractionsCalculatorTester::testSortTofAndCalculateAccPhaseFraction(&(tofDataVector2),
&(fractionDataVector2),
&(porvResultVector2),
&(swatResultVector2),
&(soilResultVector2),
&(sgasResultVector2),
tofInIncreasingOrder2,
accumulatedPhaseFractionSwat2,
accumulatedPhaseFractionSoil2,
accumulatedPhaseFractionSgas2);
EXPECT_EQ(tofInIncreasingOrder2.size(), 3);
double sumForOneTOF = accumulatedPhaseFractionSwat2[2]
+ accumulatedPhaseFractionSoil2[2]
+ accumulatedPhaseFractionSgas2[2];
EXPECT_DOUBLE_EQ(sumForOneTOF, 1.00);
EXPECT_LT(tofInIncreasingOrder2[0], tofInIncreasingOrder2[1]);
EXPECT_LT(tofInIncreasingOrder2[1], tofInIncreasingOrder2[2]);
EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSwat2[0], 0.1000);
EXPECT_DOUBLE_EQ(accumulatedPhaseFractionSoil2[1], 0.1125);
EXPECT_LT(accumulatedPhaseFractionSgas2[2] - 0.149618, 0.00001);
}
@@ -0,0 +1,24 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 "gtest/gtest.h"
#include "RigWellPathIntersectionTools.h"
#include "cvfStructGrid.h"
@@ -1,7 +1,6 @@
#include "gtest/gtest.h"
#include "RimWellPathCollection.h"
#include "RigWellPath.h"
#include "RifWellPathImporter.h"
#include <QTemporaryFile>
#include <QTextStream>
@@ -21,8 +20,8 @@ TEST(RimWellPathAsciiFileReaderTest, TestWellNameNoColon)
out << "1 2 3";
}
RifWellPathAsciiFileReader reader;
RifWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
RifWellPathImporter reader;
RifWellPathImporter::WellData wpData = reader.readWellData(file.fileName(), 0);
EXPECT_TRUE(wpData.m_name == wellName);
}
}
@@ -42,8 +41,8 @@ TEST(RimWellPathAsciiFileReaderTest, TestWellNameWithColon)
out << "1 2 3";
}
RifWellPathAsciiFileReader reader;
RifWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
RifWellPathImporter reader;
RifWellPathImporter::WellData wpData = reader.readWellData(file.fileName(), 0);
EXPECT_TRUE(wpData.m_name == wellName);
}
}
@@ -63,8 +62,8 @@ TEST(RimWellPathAsciiFileReaderTest, TestWellNameWithColonAndSpace)
out << "1 2 3";
}
RifWellPathAsciiFileReader reader;
RifWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
RifWellPathImporter reader;
RifWellPathImporter::WellData wpData = reader.readWellData(file.fileName(), 0);
EXPECT_TRUE(wpData.m_name == wellName);
}
}