Rename ApplicationCode to ApplicationLibCode

This commit is contained in:
Gaute Lindkvist
2021-01-06 14:55:29 +01:00
parent 751df1a421
commit 81699db187
3242 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
CONFIGURE_FILE( ${CMAKE_CURRENT_LIST_DIR}/RiaTestDataDirectory.h.cmake
${CMAKE_BINARY_DIR}/Generated/RiaTestDataDirectory.h
)
set (SOURCE_GROUP_HEADER_FILES
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/cvfGeometryTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/Ert-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifcCommandCore-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifEclipseInputFileTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifReaderEclipseOutput-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifReaderEclipseSummary-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigReservoir-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigStatisticsMath-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathIntersectionTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveImpl-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RivPipeGeometryGenerator-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RivTernaryScalarMapper-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/ScalarMapper-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/WellPathAsciiFileReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/opm-flowdiagnostics-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigTofAccumulatedPhaseFractionsCalculator-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/HDF5FileReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCellGeometryTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigHexIntersectionTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/ObservedDataParser-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/EclipseRftReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExpressionParser-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuSummaryVectorDescriptionMap-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/FixedWidthDataParser-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigTimeCurveHistoryMerger-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/ListKeywordsForObjectsAndFields-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifElementPropertyTableReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRelocatePath-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigTransmissibilityCondenser-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseUnitTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifCaseRealizationParametersReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellLogExtractor-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifEclipseSummaryAddress-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTimeHistoryCurveTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/SolveSpaceSolver-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaPolyArcLineSampler-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifTextDataTableFormatter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedMean-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaMedianCalculator-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedHarmonicMeanCalculator-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCellDividingTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/Intersect-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifPerforationIntervalReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathCompletions-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifWellMeasurementReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaDateStringParser-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigHexGradientTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceImporter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifColorLegendData-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifRoffReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifElasticPropertiesReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStatisticsTools-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanXmlReader-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RigWellPathGeometryExporter-Test.cpp
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelDeviationFrkExporter-Test.cpp
)
if (RESINSIGHT_ENABLE_GRPC)
list(APPEND GPRC_UNIT_TEST_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiaGrpcInterface-Test.cpp
)
list(APPEND SOURCE_GROUP_SOURCE_FILES
${GRPC_UNIT_TEST_SOURCE_FILES}
)
endif(RESINSIGHT_ENABLE_GRPC)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "UnitTests" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,39 @@
#include "gtest/gtest.h"
#include "RifEclipseRftAddress.h"
#include "RifReaderEclipseRft.h"
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
// TEST(RifReaderEclipseRftTest, TestRifEclipseRftAddress)
TEST( DISABLED_RifReaderEclipseRftTest, TestRifEclipseRftAddress )
{
QString filename = "C:\\Users\\Rebecca Cox\\Dropbox\\norne\\norne\\NORNE_ATW2013.RFT";
RifReaderEclipseRft reader( filename );
std::set<RifEclipseRftAddress> addresses = reader.eclipseRftAddresses();
/*for (RifEclipseRftAddress address : addresses)
{
std::cout << address.wellName() << std::endl;
}*/
for ( RifEclipseRftAddress address : addresses )
{
std::vector<double> values;
reader.values( address, &values );
EXPECT_TRUE( values.size() > 0 );
}
ASSERT_TRUE( addresses.size() > 0 );
std::vector<double> values;
reader.values( *addresses.begin(), &values );
ASSERT_TRUE( values.size() > 0 );
std::cout << "First value: " << values.front() << ", last value: " << values.back() << std::endl;
}

View File

@@ -0,0 +1,208 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "ert/ecl/ecl_file.h"
#include "gtest/gtest.h"
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, WellTestErt)
{
{
char filename[1024] =
"d:/Models/Statoil_multipleRealisations/MultipleRealisations/Case_with_10_timesteps/Real0/BRUGGE_0000.X0000";
ecl_file_type* ecl_file = ecl_file_open(filename, ECL_FILE_CLOSE_STREAM); ecl_file_close(ecl_file);
}
{
char filename[1024] = "d:/Models/Statoil/kapoCoulibaly/data/15K_080910_AS1.X0000";
ecl_file_type* ecl_file = ecl_file_open(filename, ECL_FILE_CLOSE_STREAM);
if (ecl_file) ecl_file_close(ecl_file);
}
{
char filename[1024] = "d:/Models/Statoil/kapoCoulibaly/data/15K_080910_AS1.X0000";
ecl_file_type* ecl_file = ecl_file_open(filename, ECL_FILE_WRITABLE);
if (ecl_file) ecl_file_close(ecl_file);
}
}
*/
#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

View File

@@ -0,0 +1,416 @@
#include "gtest/gtest.h"
#include "RifColumnBasedUserDataParser.h"
#include "RifEclipseUserDataParserTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, BasicUsage )
{
QString data = R"(1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016
-------------------------------------------------------------------------------------------------------------------------------
DATE FGIRH FVPT FWPT FOPT FLPT FLPTH FGPT FOPTH FGPTH
SM3/DAY RM3 SM3 SM3 SM3 SM3 SM3 SM3 SM3
*10**3 *10**3 *10**3 *10**3 *10**3 *10**6 *10**3 *10**6
0 0 0 0 0 0 0 0 0
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 0 0 0 0 0 0 0
7-NOV-1997 0 5.749954 0.004548 4.379801 4.384350 4.347700 0.476000 4.347700 0.482595
8-NOV-1997 0 13.76883 0.010841 10.48852 10.49936 10.41106 1.139745 10.41106 1.155627
9-NOV-1997 0 19.38692 0.015243 14.76847 14.78372 14.65899 1.604722 14.65899 1.627147
)";
std::stringstream streamData;
streamData.str( data.toStdString() );
std::vector<std::string> tableHeaderLines = RifEclipseUserDataParserTools::findValidHeaderLines( streamData );
EXPECT_EQ( size_t( 4 ), tableHeaderLines.size() );
{
std::string line;
std::getline( streamData, line );
std::string firstDataLine = "6-NOV-1997";
size_t foundPos = line.find_first_of( firstDataLine );
EXPECT_TRUE( foundPos != std::string::npos );
}
auto colHeaders = RifEclipseUserDataParserTools::splitIntoColumnHeaders( tableHeaderLines );
EXPECT_EQ( size_t( 10 ), colHeaders.size() );
EXPECT_TRUE( colHeaders[9][0].find_first_of( "FGPTH" ) != std::string::npos );
EXPECT_TRUE( colHeaders[9][1].find_first_of( "SM3" ) != std::string::npos );
EXPECT_TRUE( colHeaders[9][2].find_first_of( "*10**6" ) != std::string::npos );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, ColumnData )
{
std::vector<std::vector<std::string>> columnData;
{
std::vector<std::string> col;
col.push_back( "FGPTH" );
col.push_back( "SM3" );
col.push_back( "*10**6" );
columnData.push_back( col );
}
auto ci = RifEclipseUserDataParserTools::columnInfoFromColumnHeaders( columnData );
EXPECT_EQ( size_t( 1 ), ci.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, DetectFixedWidth )
{
QString data =
R"(1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016
-------------------------------------------------------------------------------------------------------------------------------
DATE YEARS NEWTON MLINEARS DAY MONTH YEAR NEWTON TCPU ELAPSED
YEARS SECONDS SECONDS
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 0 6 11 1997 0 4.880000 9.720000
7-NOV-1997 0.002738 3 28 7 11 1997 3 5.240000 10.11000
8-NOV-1997 0.006556 4 42 8 11 1997 4 5.730000 10.60000
9-NOV-1997 0.009231 3 28 9 11 1997 3 6.080000 10.95000
10-NOV-1997 0.011462 4 32 10 11 1997 4 6.500000 11.37000
11-NOV-1997 0.013710 4 35 11 11 1997 4 6.940001 11.81000
11-NOV-1997 0.015950 3 25 11 11 1997 3 7.270000 12.14000
12-NOV-1997 0.018477 4 35 12 11 1997 4 7.710001 12.58000
13-NOV-1997 0.020190 3 24 13 11 1997 3 8.040000 12.91000
14-NOV-1997 0.021903 3 27 14 11 1997 3 8.380000 13.25000
14-NOV-1997 0.024232 2 17 14 11 1997 2 8.640000 13.57000
17-NOV-1997 0.030838 3 26 17 11 1997 3 8.980000 13.91000
19-NOV-1997 0.037060 3 30 19 11 1997 3 9.350000 14.28000
1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016
-------------------------------------------------------------------------------------------------------------------------------
DATE RGIR RGPR RGIPG RGIPL RGIT RGPT RWIR RWPR RWPT
SM3/DAY SM3/DAY SM3 SM3 SM3 SM3 SM3/DAY SM3/DAY SM3
*10**3 *10**3 *10**3 *10**3
1 1 1 1 1 1 1 1 1
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 5426677. 591448.1 0 0 0 0 0
7-NOV-1997 0 2396930. 5424424. 591498.1 0 2396.930 0 -21.6173 -21.6173
8-NOV-1997 0 -250487. 5423940. 591966.2 0 2047.598 0 -11124.0 -15535.3
9-NOV-1997 0 2829432. 5421400. 591952.3 0 4812.102 0 -17.8744 -15552.8
10-NOV-1997 0 -280634. 5421285. 592209.2 0 4583.461 0 -10959.9 -24482.1
11-NOV-1997 0 2830404. 5419148. 592196.6 0 6908.132 0 -10.3646 -24490.7
11-NOV-1997 0 -295420. 5419071. 592429.6 0 6666.499 0 -10081.2 -32736.4
12-NOV-1997 0 2653586. 5416835. 592407.6 0 9116.355 0 1.209827 -32735.3
13-NOV-1997 0 -360534. 5416802. 592585.4 0 8890.818 0 -9987.70 -38983.3
14-NOV-1997 0 2637960. 5415305. 592557.9 0 10541.03 0 14.09936 -38974.5
14-NOV-1997 392181.0 1892660. 5414172. 592553.9 333.6561 12151.25 0 12.94364 -38963.4
17-NOV-1997 392181.0 -248070. 5414992. 592978.2 1279.883 11552.73 0 -6587.17 -54856.5
19-NOV-1997 392181.0 2105310. 5411504. 592928.2 2171.132 16337.13 0 50.99986 -54740.6
1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016
-------------------------------------------------------------------------------------------------------------------------------
DATE RWIP ROPR ROIR ROIT ROIPG ROIPL ROPT WBP5 WBP5
SM3 SM3/DAY SM3/DAY SM3 SM3 SM3 SM3 BARSA BARSA
*10**3
C-4H B-2H
1 1 1 1 1 1 1
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 11497.27 0 0 0 311329.6 5356031. 0 267.8818 272.3813
7-NOV-1997 11497.30 136.0644 0 0 310820.4 5356412. 136.0644 267.5505 271.7487
8-NOV-1997 11512.83 -2235.10 0 0 307801.2 5359464. -2981.04 267.9665 271.5258
9-NOV-1997 11512.86 164.4799 0 0 307597.5 5359512. -2820.33 267.7249 271.3749
10-NOV-1997 11521.80 -2242.95 0 0 307640.1 5361289. -4647.73 267.9192 271.2401
11-NOV-1997 11521.82 167.4484 0 0 307474.1 5361327. -4510.20 267.6667 271.1284
11-NOV-1997 11530.07 -2050.93 0 0 307511.9 5362954. -6187.72 267.9205 271.0045
12-NOV-1997 11530.08 159.2625 0 0 307328.3 5362987. -6040.69 267.6598 270.8947
13-NOV-1997 11536.33 -2048.92 0 0 307366.7 5364262. -7322.42 267.8667 270.8219
14-NOV-1997 11536.33 163.7713 0 0 307245.2 5364278. -7219.97 267.6961 270.7566
14-NOV-1997 11536.32 110.5641 0 0 307121.3 5364291. -7125.90 267.7364 270.6674
17-NOV-1997 11552.19 -1263.74 0 0 307151.2 5367307. -10175.0 268.3125 270.3454
19-NOV-1997 11552.09 133.3163 0 0 306850.8 5367300. -9872.00 267.8979 270.1126
1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 USER dtb MACHINE stj-lcb01-01-03
-------------------------------------------------------------------------------------------------------------------------------
DATE WWCT WWCT WWCTH WWCTH WWCTH WWCTH WWCTH WWCTH WWCTH
D-3BH B-1BH C-4H B-2H D-1H B-1AH B-4H B-4AH C-1H
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 0 0 0 0 0 0 0
7-NOV-1997 0 0 0 0 0 0 0 0 0
8-NOV-1997 0 0 0 0 0 0 0 0 0
9-NOV-1997 0 0 0 0 0 0 0 0 0
10-NOV-1997 0 0 0 0 0 0 0 0 0
11-NOV-1997 0 0 0 0 0 0 0 0 0
11-NOV-1997 0 0 0 0 0 0 0 0 0
12-NOV-1997 0 0 0 0 0 0 0 0 0
13-NOV-1997 0 0 0 0 0 0 0 0 0
14-NOV-1997 0 0 0 0 0 0 0 0 0
14-NOV-1997 0 0 0 0 0 0 0 0 0
17-NOV-1997 0 0 0 0 0 0 0 0 0
19-NOV-1997 0 0 0 0 0 0 0 0 0
)";
EXPECT_TRUE( RifEclipseUserDataParserTools::isFixedWidthHeader( data.toStdString() ) );
RifColumnBasedUserDataParser parser( data );
auto tables = parser.tableData();
EXPECT_EQ( size_t( 1 ), tables.size() );
EXPECT_EQ( size_t( 37 ), tables[0].columnInfos().size() );
EXPECT_EQ( size_t( 13 ), tables[0].columnInfos()[0].textValues.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, VaryingTimeStepCount )
{
QString data = "1 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" DATE YEARS NEWTON MLINEARS DAY MONTH YEAR NEWTON "
" TCPU ELAPSED \n"
" YEARS "
" SECONDS SECONDS \n"
" "
" \n"
" "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" 6-NOV-1997 0 0 0 6 11 1997 "
"0 4.880000 9.720000 \n"
" 7-NOV-1997 0.002738 3 28 7 11 1997 "
"3 5.240000 10.11000 \n"
" 8-NOV-1997 0.006556 4 42 8 11 1997 "
"4 5.730000 10.60000 \n"
"1 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" DATE RGIR RGPR RGIPG RGIPL RGIT RGPT RWIR "
" RWPR RWPT \n"
" SM3/DAY SM3/DAY SM3 SM3 SM3 SM3 "
"SM3/DAY SM3/DAY SM3 \n"
" *10**3 *10**3 *10**3 *10**3 "
" \n"
" "
" \n"
" 1 1 1 1 1 1 1 "
" 1 1 \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" 6-NOV-1997 0 0 5426677. 591448.1 0 0 "
"0 0 0 \n"
" 7-NOV-1997 0 2396930. 5424424. 591498.1 0 2396.930 "
"0 -21.6173 -21.6173 \n"
" 8-NOV-1997 0 -250487. 5423940. 591966.2 0 2047.598 "
"0 -11124.0 -15535.3 \n"
" 9-NOV-1997 0 2829432. 5421400. 591952.3 0 4812.102 "
"0 -17.8744 -15552.8 \n";
RifColumnBasedUserDataParser parser( data );
auto tables = parser.tableData();
EXPECT_EQ( size_t( 2 ), tables.size() );
EXPECT_EQ( size_t( 3 ), tables[0].columnInfos()[0].itemCount() );
EXPECT_EQ( size_t( 4 ), tables[1].columnInfos()[0].itemCount() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, HandlingOfStepType )
{
QString data =
R"(1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 USER dtb MACHINE stj-lcb01-01-03
-------------------------------------------------------------------------------------------------------------------------------
DATE YEARS NEWTON MLINEARS DAY MONTH YEAR NEWTON TCPU ELAPSED
YEARS SECONDS SECONDS
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 0 6 11 1997 0 4.880000 9.720000
7-NOV-1997 0.002738 3 28 7 11 1997 3 5.240000 10.11000
8-NOV-1997 0.006556 4 42 8 11 1997 4 5.730000 10.60000
9-NOV-1997 0.009231 3 28 9 11 1997 3 6.080000 10.95000
10-NOV-1997 0.011462 4 32 10 11 1997 4 6.500000 11.37000
11-NOV-1997 0.013710 4 35 11 11 1997 4 6.940001 11.81000
11-NOV-1997 0.015950 3 25 11 11 1997 3 7.270000 12.14000
12-NOV-1997 0.018477 4 35 12 11 1997 4 7.710001 12.58000
13-NOV-1997 0.020190 3 24 13 11 1997 3 8.040000 12.91000
14-NOV-1997 0.021903 3 27 14 11 1997 3 8.380000 13.25000
14-NOV-1997 0.024232 2 17 14 11 1997 2 8.640000 13.57000
17-NOV-1997 0.030838 3 26 17 11 1997 3 8.980000 13.91000
19-NOV-1997 0.037060 3 30 19 11 1997 3 9.350000 14.28000
21-NOV-1997 0.042841 4 35 21 11 1997 4 9.790001 14.71000
23-NOV-1997 0.049239 5 45 23 11 1997 5 10.33000 15.26000
25-NOV-1997 0.054613 3 25 25 11 1997 3 10.67000 15.60000
28-NOV-1997 0.061135 3 27 28 11 1997 3 11.01000 15.94000
29-NOV-1997 0.064791 3 23 29 11 1997 3 11.33000 16.26000
1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 USER dtb MACHINE stj-lcb01-01-03
-------------------------------------------------------------------------------------------------------------------------------
DATE TIMESTEP TCPUTS TCPUDAY MLINEARS MSUMLINS NLINEARS STEPTYPE TELAPLIN MSUMNEWT
DAYS SECONDS SEC/D SECONDS
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 4.880000 0 0 0 0 0 0
7-NOV-1997 1.000000 5.240000 5.240000 28 28 9.333333 INIT 0.361071 3
8-NOV-1997 1.394612 0.490000 0.351352 42 70 10.50000 TRNC 0.151429 7
9-NOV-1997 0.977053 0.350000 0.358220 28 98 9.333333 TRNC 0.111735 10
10-NOV-1997 0.814727 0.420000 0.515510 32 130 8.000000 TRNC 0.087462 14
11-NOV-1997 0.821321 0.430000 0.523547 35 165 8.750000 TRNC 0.071576 18
11-NOV-1997 0.817933 0.320000 0.391230 25 190 8.333333 TRNC 0.063895 21
12-NOV-1997 0.923225 0.430000 0.465759 35 225 8.750000 TRNC 0.055911 25
13-NOV-1997 0.625564 0.320000 0.511538 24 249 8.000000 HALF 0.051847 28
14-NOV-1997 0.625564 0.340000 0.543509 27 276 9.000000 REPT 0.048007 31
14-NOV-1997 0.850771 0.240000 0.282097 17 293 8.500000 TRNC 0.046314 33
17-NOV-1997 2.412731 0.340000 0.140919 26 319 8.666667 TRNC 0.043605 36
19-NOV-1997 2.272543 0.360000 0.158413 30 349 10.00000 TRNC 0.040917 39
21-NOV-1997 2.111558 0.440000 0.208377 35 384 8.750000 TRNC 0.038307 43
23-NOV-1997 2.336865 0.540000 0.231079 45 429 9.000000 TRNC 0.035571 48
25-NOV-1997 1.962967 0.330000 0.168113 25 454 8.333333 EFF+ 0.034361 51
28-NOV-1997 2.382306 0.340000 0.142719 27 481 9.000000 TRNC 0.033139 54
29-NOV-1997 1.335130 0.310000 0.232187 23 504 7.666667 HALF 0.032262 57
)";
RifColumnBasedUserDataParser parser( data );
auto tables = parser.tableData();
EXPECT_EQ( size_t( 1 ), tables.size() );
EXPECT_EQ( size_t( 19 ), tables[0].columnInfos().size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, ParsingOfHeaderWithCompletions )
{
QString data =
R"(1
-------------------------------------------------------------------------------------------------------------------------------
SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 USER dtb MACHINE stj-lcb01-01-03
-------------------------------------------------------------------------------------------------------------------------------
DATE CWIR CWIR CWIR CWIR CWIR CWIR CWIR CWIR CWIR
SM3/DAY SM3/DAY SM3/DAY SM3/DAY SM3/DAY SM3/DAY SM3/DAY SM3/DAY SM3/DAY
F-1H F-1H F-2H F-2H F-2H F-2H F-2H F-2H F-2H
12 85 22 12 85 5 18 83 1 18 83 2 18 83 3 18 83 6 18 83 7 18 83 8 18 83 10
-------------------------------------------------------------------------------------------------------------------------------
6-NOV-1997 0 0 0 0 0 0 0 0 0
7-NOV-1997 9.231156 0 4.764449 0.281349 0.745133 0.265189 0.920954 0.836619 3.560058
8-NOV-1997 14.24625 0 -0.32936 -0.02394 -0.03676 -0.01107 -0.04118 -0.04043 -0.20764
9-NOV-1997 18.14752 0 12.64910 0.550845 1.412629 0.484177 1.673316 1.510174 6.306583
10-NOV-1997 22.47141 0 -0.43799 -0.08433 -0.22154 -0.06072 -0.22558 -0.22200 -1.14752
11-NOV-1997 26.39600 0 4.129149 0.249054 0.636686 0.220191 0.752644 0.669143 2.670208
11-NOV-1997 30.89960 0 -0.42792 -0.07257 -0.18697 -0.06075 -0.22589 -0.22287 -1.16095
12-NOV-1997 34.92273 0 2.787762 0.204226 0.520520 0.173727 0.588237 0.516083 1.973659
13-NOV-1997 37.70422 0 -0.45489 -0.08366 -0.21913 -0.07483 -0.27827 -0.27465 -1.43221
14-NOV-1997 40.17989 0 1.737699 0.167881 0.426118 0.136267 0.456785 0.394921 1.435897
14-NOV-1997 41.75888 0 -0.03586 0.081980 0.190420 0.058727 0.180976 0.136145 0.240186
17-NOV-1997 55.30696 0 -0.39500 -0.05166 -0.13519 -0.05874 -0.22546 -0.23077 -1.29799
19-NOV-1997 57.85853 0 -0.06687 0.071926 0.165751 0.048624 0.144723 0.101929 0.076216
21-NOV-1997 66.37193 0 -0.41220 -0.05978 -0.16607 -0.06713 -0.26004 -0.26881 -1.54050
23-NOV-1997 66.17105 0 -0.16977 0.031785 0.060331 0.015140 0.026817 -0.00778 -0.45987
25-NOV-1997 71.57468 0 -0.35382 -0.03761 -0.11790 -0.04534 -0.18728 -0.20627 -1.31764
)";
std::stringstream streamData;
streamData.str( data.toStdString() );
std::vector<std::string> tableHeaderLines = RifEclipseUserDataParserTools::findValidHeaderLines( streamData );
EXPECT_EQ( size_t( 4 ), tableHeaderLines.size() );
auto colHeaders = RifEclipseUserDataParserTools::splitIntoColumnHeaders( tableHeaderLines );
EXPECT_EQ( size_t( 10 ), colHeaders.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( FixedWidthDataParser, DifferentStartDate )
{
QString data = "1 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" DATE YEARS NEWTON MLINEARS DAY MONTH YEAR NEWTON "
" TCPU ELAPSED \n"
" YEARS "
" SECONDS SECONDS \n"
" "
" \n"
" "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" 6-NOV-1997 0 0 0 6 11 1997 "
"0 4.880000 9.720000 \n"
" 7-NOV-1997 0.002738 3 28 7 11 1997 "
"3 5.240000 10.11000 \n"
" 8-NOV-1997 0.006556 4 42 8 11 1997 "
"4 5.730000 10.60000 \n"
"1 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" SUMMARY OF RUN NORNE_ATW2013_RFTPLT_V3 ECLIPSE 2016.2 DATESTAMP 13-DEC-2016 "
" \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" DATE RGIR RGPR RGIPG RGIPL RGIT RGPT RWIR "
" RWPR RWPT \n"
" SM3/DAY SM3/DAY SM3 SM3 SM3 SM3 "
"SM3/DAY SM3/DAY SM3 \n"
" *10**3 *10**3 *10**3 *10**3 "
" \n"
" "
" \n"
" 1 1 1 1 1 1 1 "
" 1 1 \n"
" --------------------------------------------------------------------------------------------------"
"-----------------------------\n"
" 7-NOV-1997 0 2396930. 5424424. 591498.1 0 2396.930 "
"0 -21.6173 -21.6173 \n"
" 8-NOV-1997 0 -250487. 5423940. 591966.2 0 2047.598 "
"0 -11124.0 -15535.3 \n"
" 9-NOV-1997 0 2829432. 5421400. 591952.3 0 4812.102 "
"0 -17.8744 -15552.8 \n";
RifColumnBasedUserDataParser parser( data );
auto tables = parser.tableData();
EXPECT_EQ( size_t( 2 ), tables.size() );
}

View File

@@ -0,0 +1,130 @@
#ifdef USE_HDF5
#include "gtest/gtest.h"
#include "H5Cpp.h"
#include <iostream>
#include <H5Exception.h>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_HDFTests, BasicFileRead )
{
std::string file_path = "D:/ResInsight/SourSim/PKMUNK_NOV_TEST_SS.sourpre.00001";
try
{
H5::Exception::dontPrint(); // Turn off auto-printing of failures to handle the errors appropriately
H5::H5File file( file_path.c_str(), H5F_ACC_RDONLY );
{
H5::Group timestep = file.openGroup( "Timestep_00001" );
H5::Attribute attr = timestep.openAttribute( "timestep" );
double timestep_value = 0.0;
H5::DataType type = attr.getDataType();
attr.read( type, &timestep_value );
// std::cout << "Timestep value " << timestep_value << std::endl;
EXPECT_NEAR( timestep_value, 1.0, 1e-1 );
}
{
// Group size is not an attribute!
H5::Group GridFunctions = file.openGroup( "Timestep_00001/GridParts/GridPart_00000/GridFunctions" );
hsize_t group_size = GridFunctions.getNumObjs();
// std::cout << "GridFunctions group_size " << group_size << std::endl;
EXPECT_EQ( size_t( 20 ), group_size );
/* for (hsize_t i = 0; i < group_size; i++)
{
// H5std_string node_name = GridFunctions.getObjnameByIdx(i); // crashes on VS2017 due
to lib/heap/runtime differences to HDF5 VS2015 lib
std::string node_name;
node_name.resize(1024);
ssize_t slen = GridFunctions.getObjnameByIdx(i, &node_name[0], 1023);
node_name.resize(slen + 1);
std::cout << "GridFunctions sub-node name " << node_name << std::endl;
}
*/
std::string first_subnode( 1024, '\0' );
ssize_t slen = GridFunctions.getObjnameByIdx( 0, &first_subnode[0], 1023 );
first_subnode.resize( slen + 1 );
EXPECT_TRUE( first_subnode.compare( 0, slen, "GridFunction_00002" ) == 0 );
}
{
H5::Group GridFunction_00002 =
file.openGroup( "Timestep_00001/GridParts/GridPart_00000/GridFunctions/GridFunction_00002" );
H5::Attribute attr = GridFunction_00002.openAttribute( "limits_max" );
double limits_max = 0.0;
H5::DataType type = attr.getDataType();
attr.read( type, &limits_max );
// std::cout << "limits_max " << limits_max << std::endl;
EXPECT_NEAR( limits_max, 0.3970204292629652, 1e-10 );
}
{
H5::Group GridFunction_00002 =
file.openGroup( "Timestep_00001/GridParts/GridPart_00000/GridFunctions/GridFunction_00002" );
H5::DataSet dataset = H5::DataSet( GridFunction_00002.openDataSet( "values" ) );
hsize_t dims[2];
H5::DataSpace dataspace = dataset.getSpace();
dataspace.getSimpleExtentDims( dims, nullptr );
std::vector<double> values;
values.resize( dims[0] );
dataset.read( values.data(), H5::PredType::NATIVE_DOUBLE );
/* for (hsize_t i = 0; i < dims[0]; i++)
{
std::cout << "value " << i << " " << values[i] << std::endl;
}
*/
EXPECT_NEAR( values[0], 0.32356910366452146, 1e-10 );
EXPECT_NEAR( values[dims[0] - 1], 0.12200070891582514, 1e-10 );
}
} // end of try block
catch ( H5::FileIException& error ) // catch failure caused by the H5File operations
{
std::cout << error.getCDetailMsg();
}
catch ( H5::DataSetIException& error ) // catch failure caused by the DataSet operations
{
std::cout << error.getCDetailMsg();
}
catch ( H5::DataSpaceIException& error ) // catch failure caused by the DataSpace operations
{
std::cout << error.getCDetailMsg();
}
catch ( H5::DataTypeIException& error ) // catch failure caused by the DataSpace operations
{
std::cout << error.getCDetailMsg();
}
}
#endif // USE_HDF5

View File

@@ -0,0 +1,41 @@
#include "gtest/gtest.h"
#include "RifEclipseOutputFileTools.h"
#include <QString>
#include "ert/ecl/ecl_file.h"
#include "ert/ecl/ecl_kw.hpp"
#include "ert/ecl/ecl_kw_magic.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( IntersectDataImport, DISABLED_TestImportPORV )
{
QString baseFolder = "d:/Models/Statoil/IX_output_files/";
QString filename = baseFolder + "NORNE_IX2.INIT";
std::string porv_kw( "PORV" );
ecl_file_type* ecl_file = ecl_file_open( filename.toStdString().data(), ECL_FILE_CLOSE_STREAM );
bool isIntersect = RifEclipseOutputFileTools::isExportedFromIntersect( ecl_file );
EXPECT_TRUE( isIntersect );
if ( ecl_file_has_kw( ecl_file, porv_kw.data() ) )
{
ecl_file_load_all( ecl_file );
int keywordCount = ecl_file_get_num_named_kw( ecl_file, porv_kw.data() );
for ( int index = 0; index < keywordCount; index++ )
{
auto fileKeyword = ecl_file_iget_named_file_kw( ecl_file, porv_kw.data(), index );
float porvThreshold = 0.0f;
auto actnumFromPorv = ecl_kw_alloc_actnum( ecl_file_kw_get_kw_ptr( fileKeyword ), porvThreshold );
EXPECT_TRUE( actnumFromPorv != nullptr );
}
}
}

View File

@@ -0,0 +1,110 @@
#include "gtest/gtest.h"
#include "RiaVersionInfo.h"
#include "cafClassTypeName.h"
#include "cafPdmDefaultObjectFactory.h"
#include "cafPdmObjectHandle.h"
#include <QDateTime>
#include <QFile>
#include <QTextStream>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void writeTextToFile( const QString& filePath, const QString& text )
{
QFile exportFile( filePath );
if ( exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
{
QTextStream stream( &exportFile );
stream << text;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString versionHeaderText()
{
QString text;
text += QString( "// ResInsight version string : %1\n" ).arg( STRPRODUCTVER );
text += QString( "// Report generated : %1\n" ).arg( QDateTime::currentDateTime().toString() );
text += "//\n";
text += "//\n";
text += "\n";
return text;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ListKeywords, ListAllObjectKeywords )
{
auto instance = caf::PdmDefaultObjectFactory::instance();
QString textString;
QTextStream stream( &textString );
textString = versionHeaderText();
std::vector<QString> classKeywords = instance->classKeywords();
for ( auto keyword : classKeywords )
{
stream << keyword << "\n";
}
QString filePath = "c:/temp/ri-objectKeywords.txt";
// writeTextToFile(filePath, textString);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ListKeywords, ListAllObjectKeywordsAndFieldKeywords )
{
auto instance = caf::PdmDefaultObjectFactory::instance();
QString textString;
QTextStream stream( &textString );
bool includeClassName = true;
textString = versionHeaderText();
std::vector<QString> classKeywords = instance->classKeywords();
for ( auto keyword : classKeywords )
{
caf::PdmObjectHandle* myClass = instance->create( keyword );
stream << keyword;
if ( includeClassName )
{
QString className = qStringTypeName( *myClass );
stream << " - " << className;
}
stream << "\n";
std::vector<caf::PdmFieldHandle*> fields;
myClass->fields( fields );
for ( auto f : fields )
{
stream << " " << f->keyword() << "\n";
}
stream << "\n";
delete myClass;
}
QString filePath = "c:/temp/ri-fieldKeywords.txt";
// writeTextToFile(filePath, textString);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiaCellDividingTools.h"
#include "RigMainGrid.h"
//--------------------------------------------------------------------------------------------------
/// Helper
//--------------------------------------------------------------------------------------------------
std::array<cvf::Vec3d, 8> createRegularCellCoords( cvf::Vec3d refPt, double xLen, double yLen, double zLen )
{
std::array<cvf::Vec3d, 8> coords = {
refPt + cvf::Vec3d( 0, 0, 0 ),
refPt + cvf::Vec3d( xLen, 0, 0 ),
refPt + cvf::Vec3d( xLen, yLen, 0 ),
refPt + cvf::Vec3d( 0, yLen, 0 ),
refPt + cvf::Vec3d( 0, 0, zLen ),
refPt + cvf::Vec3d( xLen, 0, zLen ),
refPt + cvf::Vec3d( xLen, yLen, zLen ),
refPt + cvf::Vec3d( 0, yLen, zLen ),
};
return coords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaCellDividingTools, flowDistanceCubicMainCell_AreaPointInCenter )
{
std::array<cvf::Vec3d, 8> mainCellCorners = createRegularCellCoords( cvf::Vec3d( 10, 10, 10 ), 10, 10, 10 );
cvf::Vec3d point( 15, 15, 15 );
double dist = RiaCellDividingTools::computeFlowDistance( mainCellCorners, point );
double expectedDist =
( ( cvf::Vec3d( 12.5, 12.5, 12.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 12.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 12.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 12.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 12.5, 17.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 17.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 17.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 17.5 ) - point ).length() ) /
8;
EXPECT_NEAR( expectedDist, dist, 1e-6 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaCellDividingTools, flowDistanceCubicMainCell_AreaPointNearCorner )
{
std::array<cvf::Vec3d, 8> mainCellCorners = createRegularCellCoords( cvf::Vec3d( 10, 10, 10 ), 10, 10, 10 );
cvf::Vec3d point( 11, 11, 11 );
double dist = RiaCellDividingTools::computeFlowDistance( mainCellCorners, point );
double expectedDist =
( ( cvf::Vec3d( 12.5, 12.5, 12.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 12.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 12.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 12.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 12.5, 17.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 17.5 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 17.5 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 17.5 ) - point ).length() ) /
8;
EXPECT_NEAR( expectedDist, dist, 1e-6 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaCellDividingTools, flowDistanceHighMainCell_AreaPointNearLowerCorner )
{
std::array<cvf::Vec3d, 8> mainCellCorners = createRegularCellCoords( cvf::Vec3d( 10, 10, 10 ), 10, 10, 100 );
cvf::Vec3d point( 11, 11, 11 );
double dist = RiaCellDividingTools::computeFlowDistance( mainCellCorners, point );
double expectedDist =
( ( cvf::Vec3d( 12.5, 12.5, 35 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 35 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 35 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 35 ) - point ).length() +
( cvf::Vec3d( 12.5, 12.5, 85 ) - point ).length() + ( cvf::Vec3d( 17.5, 12.5, 85 ) - point ).length() +
( cvf::Vec3d( 12.5, 17.5, 85 ) - point ).length() + ( cvf::Vec3d( 17.5, 17.5, 85 ) - point ).length() ) /
8;
EXPECT_NEAR( expectedDist, dist, 1e-6 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, lgrNodesTest )
{
std::array<cvf::Vec3d, 8> mainCellCorners = createRegularCellCoords( cvf::Vec3d( 10, 10, 10 ), 36, 18, 18 );
auto coords = RiaCellDividingTools::createHexCornerCoords( mainCellCorners, 6, 3, 3 );
}

View File

@@ -0,0 +1,133 @@
#include "gtest/gtest.h"
#include "RiaDateStringParser.h"
#include "RiaQDateTimeTools.h"
#include <QDate>
#include <QDateTime>
#include <map>
#include <string>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaDateStringParserTest, ParseYearFirstWithSeparators )
{
QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) );
may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> may2ndStrings = { "2011 05 02",
"2011 May 02",
"2011_05_02",
"2011_May_02",
"2011_may_02",
"2011-05-02",
"2011-May-02",
"2011-may-02",
"2011.05.02",
"2011.May.02" };
for ( auto may2ndString : may2ndStrings )
{
QDateTime parsedDate = RiaDateStringParser::parseDateString( may2ndString );
EXPECT_TRUE( may2ndDT == parsedDate );
}
QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) );
nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> nov24thStrings = { "1992-11-24", "1992-Nov-24", "1992-nov-24", "1992.11.24" };
for ( auto nov24thString : nov24thStrings )
{
EXPECT_TRUE( nov24thDT == RiaDateStringParser::parseDateString( nov24thString ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaDateStringParserTest, ParseDayFirstWithSeparators )
{
QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) );
may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> may2ndStrings = { "02 05 2011",
"02 May 2011",
"02_05_2011",
"02_May_2011",
"02_may_2011",
"02-05-2011",
"02-May-2011",
"02-may-2011",
"02.05.2011" };
for ( auto may2ndString : may2ndStrings )
{
QDateTime parsedDate = RiaDateStringParser::parseDateString( may2ndString );
EXPECT_TRUE( may2ndDT == parsedDate );
}
QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) );
nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> nov24thStrings = { "24-11-1992", "24-Nov-1992", "24.Nov 1992", "24.11.1992" };
for ( auto nov24thString : nov24thStrings )
{
EXPECT_TRUE( nov24thDT == RiaDateStringParser::parseDateString( nov24thString ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaDateStringParserTest, ParseMonthFirstWithSeparators )
{
QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) );
may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> may2ndStrings = { "May 02 2011", "may 02 2011", "May_02_2011", "May.02.2011", "May 02. 2011" };
for ( auto may2ndString : may2ndStrings )
{
QDateTime parsedDate = RiaDateStringParser::parseDateString( may2ndString );
EXPECT_TRUE( may2ndDT == parsedDate );
}
QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) );
nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> nov24thStrings = { "11-24-1992", "Nov-24-1992", "Nov 24. 1992", "11.24.1992", "11 24 1992" };
for ( auto nov24thString : nov24thStrings )
{
EXPECT_TRUE( nov24thDT == RiaDateStringParser::parseDateString( nov24thString ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaDateStringParserTest, ParseWithoutSeparators )
{
QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) );
QDateTime feb5thDT = QDateTime( QDate( 2011, 02, 05 ) );
may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
feb5thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> may2ndStrings = { "20110502", "02052011", "Date_20110502" };
for ( auto may2ndString : may2ndStrings )
{
QDateTime parsedDate = RiaDateStringParser::parseDateString( may2ndString );
EXPECT_TRUE( may2ndDT == parsedDate );
}
// This is ambiguous and we prefer day first ahead of month first.
std::string may2ndMonthFirstString( "05022011" );
EXPECT_FALSE( may2ndDT == RiaDateStringParser::parseDateString( may2ndMonthFirstString ) );
EXPECT_TRUE( feb5thDT == RiaDateStringParser::parseDateString( may2ndMonthFirstString ) );
QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) );
nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() );
std::vector<std::string> nov24thStrings = { "19921124", "24111992", "921124", "241192", "11241992", "112492" };
for ( auto nov24thString : nov24thStrings )
{
EXPECT_TRUE( nov24thDT == RiaDateStringParser::parseDateString( nov24thString ) );
}
}

View File

@@ -0,0 +1,82 @@
#include "gtest/gtest.h"
#include "RiaEclipseUnitTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaEclipseUnitTools, TestConversionToMeter )
{
double deltaRange = 1e-7;
{
double sourceValue = RiaEclipseUnitTools::feetPerMeter();
QString unitText = "ft";
double destValue = RiaEclipseUnitTools::convertToMeter( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = RiaEclipseUnitTools::feetPerMeter() * 12.0;
QString unitText = "in";
double destValue = RiaEclipseUnitTools::convertToMeter( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = 1.0;
QString unitText = "m";
double destValue = RiaEclipseUnitTools::convertToMeter( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = 100.0;
QString unitText = "cm";
double destValue = RiaEclipseUnitTools::convertToMeter( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = 123.0;
QString unitText = "mm";
double destValue = RiaEclipseUnitTools::convertToMeter( sourceValue, unitText );
EXPECT_NEAR( 0.123, destValue, deltaRange );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaEclipseUnitTools, TestConversionToFeet )
{
double deltaRange = 1e-7;
{
double sourceValue = 1.0;
QString unitText = "ft";
double destValue = RiaEclipseUnitTools::convertToFeet( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = 1.0 * 12.0;
QString unitText = "in";
double destValue = RiaEclipseUnitTools::convertToFeet( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = RiaEclipseUnitTools::meterPerFeet();
QString unitText = "m";
double destValue = RiaEclipseUnitTools::convertToFeet( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
{
double sourceValue = RiaEclipseUnitTools::meterPerFeet() * 100.0;
QString unitText = "cm";
double destValue = RiaEclipseUnitTools::convertToFeet( sourceValue, unitText );
EXPECT_NEAR( 1.0, destValue, deltaRange );
}
}

View File

@@ -0,0 +1,114 @@
#include "gtest/gtest.h"
#include "RiaFilePathTools.h"
#include <iostream>
std::ostream& operator<<( std::ostream& out, const QString& text )
{
out << text.toStdString();
return out;
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, rootSearchPathFromSearchFilter )
{
{
QString testPath( "" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "" ), resultRootPath );
}
{
QString testPath( "D:/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "D:/" ), resultRootPath );
}
{
QString testPath( "D:/A" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "D:/A" ), resultRootPath );
}
{
QString testPath( "D:/A/B[cd]/E" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "D:/A" ), resultRootPath );
}
{
QString testPath( "/A/B[cd]/E" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "/A" ), resultRootPath );
}
{
QString testPath( "/A/B?/E" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "/A" ), resultRootPath );
}
{
QString testPath( "//A/B/E*" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B" ), resultRootPath );
}
{
QString testPath( "//A/B/E" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B/E" ), resultRootPath );
}
{
QString testPath( "//A/B/E/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B/E/" ), resultRootPath );
}
{
QString testPath( "//A/B[[]/E/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B[[]/E/" ), resultRootPath );
}
{
QString testPath( "//A/B[]]/E/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B[]]/E/" ), resultRootPath );
}
{
QString testPath( "//A/B[*]/E/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B[*]/E/" ), resultRootPath );
}
{
QString testPath( "//A/B[?]/E/" );
QString resultRootPath = RiaFilePathTools::rootSearchPathFromSearchFilter( testPath );
EXPECT_EQ( QString( "//A/B[?]/E/" ), resultRootPath );
}
}
//--------------------------------------------------------------------------------------------------
TEST( RiaFilePathTools, removeDuplicatePathSeparators )
{
{
QString testPath( "//myshare/folder-a/folder-b/" );
QString resultRootPath = RiaFilePathTools::removeDuplicatePathSeparators( testPath );
EXPECT_STRCASEEQ( testPath.toLatin1(), resultRootPath.toLatin1() );
}
{
QString testPath( "//myshare/folder-a//folder-b/" );
QString expectedPath( "//myshare/folder-a/folder-b/" );
QString resultRootPath = RiaFilePathTools::removeDuplicatePathSeparators( testPath );
EXPECT_STRCASEEQ( expectedPath.toLatin1(), resultRootPath.toLatin1() );
}
{
QString testPath( R"(\\myshare\folder-a\folder-b\)" );
QString resultRootPath = RiaFilePathTools::removeDuplicatePathSeparators( testPath );
EXPECT_STRCASEEQ( testPath.toLatin1(), resultRootPath.toLatin1() );
}
{
QString testPath( R"(\\myshare\folder-a\\folder-b\\)" );
QString expectedPath( R"(\\myshare\folder-a\folder-b\)" );
QString resultRootPath = RiaFilePathTools::removeDuplicatePathSeparators( testPath );
EXPECT_STRCASEEQ( expectedPath.toLatin1(), resultRootPath.toLatin1() );
}
}

View File

@@ -0,0 +1,72 @@
#include "gtest/gtest.h"
#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/security/credentials.h>
#include <memory>
#include <numeric>
#include "Properties.grpc.pb.h"
using grpc::Channel;
using grpc::ClientContext;
using grpc::ClientReader;
using grpc::ClientReaderWriter;
using grpc::ClientWriter;
using grpc::Status;
class PropertiesClient
{
public:
PropertiesClient( std::shared_ptr<Channel> channel )
: m_stub( rips::Properties::NewStub( channel ) )
{
}
Status GetActiveCellProperty( rips::PropertyType propType,
const std::string& propertyName,
int timeStep,
std::vector<double>* results ) const
{
rips::PropertyRequest request;
rips::CaseRequest* requestCase = new rips::CaseRequest;
requestCase->set_id( 0 );
request.set_allocated_case_request( requestCase );
request.set_grid_index( 0 );
request.set_porosity_model( rips::PorosityModelType::MATRIX_MODEL );
request.set_property_type( propType );
request.set_property_name( propertyName );
request.set_time_step( timeStep );
rips::PropertyChunk resultArray;
ClientContext context;
std::unique_ptr<ClientReader<rips::PropertyChunk>> reader = m_stub->GetActiveCellProperty( &context, request );
while ( reader->Read( &resultArray ) )
{
results->insert( results->end(), resultArray.values().begin(), resultArray.values().end() );
}
return reader->Finish();
}
private:
std::unique_ptr<rips::Properties::Stub> m_stub;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaGrpcInterface, SoilAverage )
{
PropertiesClient client( grpc::CreateChannel( "localhost:50051", grpc::InsecureChannelCredentials() ) );
for ( size_t i = 0; i < 10; ++i )
{
std::vector<double> results;
Status status = client.GetActiveCellProperty( rips::PropertyType::DYNAMIC_NATIVE, "SOIL", i, &results );
std::cout << "Number of results: " << results.size() << std::endl;
double sum = std::accumulate( results.begin(), results.end(), 0.0 );
std::cout << "Avg: " << sum / static_cast<double>( results.size() ) << std::endl;
EXPECT_EQ( grpc::OK, status.error_code() );
}
}

View File

@@ -0,0 +1,129 @@
#include "gtest/gtest.h"
#include "RiaInterpolationTools.h"
#include <limits>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, LinearEmptyData )
{
std::vector<double> x;
std::vector<double> y;
double res = RiaInterpolationTools::linear( x, y, 99.9 );
EXPECT_EQ( std::numeric_limits<double>::infinity(), res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, SingleValue )
{
std::vector<double> x = { 1.0 };
std::vector<double> y = { 3.0 };
double res = RiaInterpolationTools::linear( x, y, 2.0 );
EXPECT_EQ( std::numeric_limits<double>::infinity(), res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, ValidInterval )
{
std::vector<double> x = { 0.0, 1.0 };
std::vector<double> y = { 0.0, 2.0 };
double res = RiaInterpolationTools::linear( x, y, 0.5 );
EXPECT_DOUBLE_EQ( 1.0, res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, ValidIntervalLastBin )
{
std::vector<double> x = { 0.0, 1.0, 100.0, 1100.0 };
std::vector<double> y = { 0.0, 2.0, 0.0, 2000.0 };
double res = RiaInterpolationTools::linear( x, y, 600.0 );
EXPECT_DOUBLE_EQ( 1000.0, res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, ValidIntervalValueTooLow )
{
std::vector<double> x = { 0.0, 1.0 };
std::vector<double> y = { 0.0, 2.0 };
// Outside interval on low side
double res = RiaInterpolationTools::linear( x, y, -1.0 );
EXPECT_DOUBLE_EQ( std::numeric_limits<double>::infinity(), res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, ValidIntervalValueTooHigh )
{
std::vector<double> x = { 0.0, 1.0 };
std::vector<double> y = { 0.0, 2.0 };
// Outside interval on high side
double res = RiaInterpolationTools::linear( x, y, 100.0 );
EXPECT_DOUBLE_EQ( std::numeric_limits<double>::infinity(), res );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, InterpolateMisssingValuesStraightLine )
{
double inf = std::numeric_limits<double>::infinity();
std::vector<double> x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
std::vector<double> y = { 0.0, 1.0, inf, inf, inf, 5.0 };
RiaInterpolationTools::interpolateMissingValues( x, y );
EXPECT_DOUBLE_EQ( y[2], 2.0 );
EXPECT_DOUBLE_EQ( y[3], 3.0 );
EXPECT_DOUBLE_EQ( y[4], 4.0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, InterpolateMissingValuesStraightLineExtrapolateStart )
{
double inf = std::numeric_limits<double>::infinity();
std::vector<double> x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
std::vector<double> y = { inf, inf, 2.0, inf, 4.0, 5.0 };
RiaInterpolationTools::interpolateMissingValues( x, y );
EXPECT_DOUBLE_EQ( y[0], 0.0 );
EXPECT_DOUBLE_EQ( y[1], 1.0 );
EXPECT_DOUBLE_EQ( y[2], 2.0 );
EXPECT_DOUBLE_EQ( y[3], 3.0 );
EXPECT_DOUBLE_EQ( y[4], 4.0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaInterpolationToolsTest, InterpolateMissingValuesStraightLineExtrapolateEnd )
{
double inf = std::numeric_limits<double>::infinity();
std::vector<double> x = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
std::vector<double> y = { 0.0, inf, 2.0, inf, 4.0, inf };
RiaInterpolationTools::interpolateMissingValues( x, y );
EXPECT_DOUBLE_EQ( y[0], 0.0 );
EXPECT_DOUBLE_EQ( y[1], 1.0 );
EXPECT_DOUBLE_EQ( y[2], 2.0 );
EXPECT_DOUBLE_EQ( y[3], 3.0 );
EXPECT_DOUBLE_EQ( y[4], 4.0 );
EXPECT_DOUBLE_EQ( y[5], 5.0 );
}

View File

@@ -0,0 +1,127 @@
#include "gtest/gtest.h"
#include "RiaMedianCalculator.h"
#include <algorithm>
#include <random>
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaMedianCalculator, EmptyDataSet )
{
RiaMedianCalculator<double> calc;
EXPECT_FALSE( calc.valid() );
}
TEST( RiaMedianCalculator, SingleValue )
{
RiaMedianCalculator<double> calc;
calc.add( 4.0 );
EXPECT_DOUBLE_EQ( 4.0, calc.median() );
}
TEST( RiaMedianCalculator, TwoValues )
{
RiaMedianCalculator<double> calc;
std::vector<double> values{ 3.0, 6.0 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.add( values[i] );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 4.5, calc.median() );
}
TEST( RiaMedianCalculator, ThreeValues )
{
RiaMedianCalculator<double> calc;
std::vector<double> values{ 3.0, 6.0, 2.0 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.add( values[i] );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 3.0, calc.median() );
}
TEST( RiaMedianCalculator, SameValues )
{
RiaMedianCalculator<double> calc;
const double value = 113.0;
for ( size_t i = 0; i < 1000; ++i )
{
calc.add( value );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( value, calc.median() );
}
TEST( RiaMedianCalculator, OrderedRangeOdd )
{
RiaMedianCalculator<double> calc;
for ( size_t i = 0; i < 101; ++i )
{
calc.add( (double)i );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 50.0, calc.median() );
}
TEST( RiaMedianCalculator, OrderedRangeEven )
{
RiaMedianCalculator<double> calc;
for ( size_t i = 0; i < 100; ++i )
{
calc.add( (double)i );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 49.5, calc.median() );
}
TEST( RiaMedianCalculator, ShuffledRangeOdd )
{
RiaMedianCalculator<double> calc;
std::vector<int> values;
for ( int i = 0; i < 101; ++i )
{
values.push_back( i );
}
std::random_device rd;
std::mt19937 g( rd() );
std::shuffle( values.begin(), values.end(), g );
for ( double value : values )
{
calc.add( value );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 50.0, calc.median() );
}
TEST( RiaMedianCalculator, ShuffledRangeEven )
{
RiaMedianCalculator<double> calc;
std::vector<int> values;
for ( int i = 0; i < 200; ++i )
{
values.push_back( i );
}
std::random_device rd;
std::mt19937 g( rd() );
std::shuffle( values.begin(), values.end(), g );
for ( double value : values )
{
calc.add( value );
}
EXPECT_TRUE( calc.valid() );
EXPECT_DOUBLE_EQ( 99.5, calc.median() );
}

View File

@@ -0,0 +1,67 @@
#include "gtest/gtest.h"
#include "RiaPolyArcLineSampler.h"
#include <iostream>
//--------------------------------------------------------------------------------------------------
TEST( RiaPolyArcLineSampler, Basic )
{
std::vector<cvf::Vec3d> points{ { 0, 0, 0 }, { 0, 0, -10 }, { 0, 10, -20 }, { 0, 20, -20 }, { 0, 30, -30 } };
RiaPolyArcLineSampler sampler( { 0, 0, -1 }, points );
auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
#if 1
for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx )
{
std::cout << sampledPoints[pIdx].x() << " " << sampledPoints[pIdx].y() << " " << sampledPoints[pIdx].z()
<< " md: " << mds[pIdx] << std::endl;
}
#endif
EXPECT_EQ( 55, (int)sampledPoints.size() );
EXPECT_NEAR( 51.4159, mds.back(), 1e-4 );
EXPECT_NEAR( points[2].y(), sampledPoints[27].y(), 2 );
EXPECT_NEAR( points[2].z(), sampledPoints[27].z(), 2 );
EXPECT_NEAR( points[4].y(), sampledPoints.back().y(), 2 );
EXPECT_NEAR( points[4].z(), sampledPoints.back().z(), 2 );
}
//--------------------------------------------------------------------------------------------------
TEST( RiaPolyArcLineSampler, TestInvalidInput )
{
{
// Two identical points after each other
std::vector<cvf::Vec3d> points{ { 0, 0, -20 }, { 0, 0, -20 } };
RiaPolyArcLineSampler sampler( { 0, 0, -1 }, points );
auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
EXPECT_EQ( 0, (int)sampledPoints.size() );
EXPECT_EQ( 0, (int)mds.size() );
}
{
std::vector<cvf::Vec3d> points;
RiaPolyArcLineSampler sampler( { 0, 0, -1 }, points );
auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
EXPECT_EQ( 0, (int)sampledPoints.size() );
EXPECT_EQ( 0, (int)mds.size() );
}
{
std::vector<cvf::Vec3d> points{ { 0, 0, 0 } };
RiaPolyArcLineSampler sampler( { 0, 0, -1 }, points );
auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
EXPECT_EQ( 0, (int)sampledPoints.size() );
EXPECT_EQ( 0, (int)mds.size() );
}
}

View File

@@ -0,0 +1,171 @@
#include "gtest/gtest.h"
#include "RiaProjectFileVersionTools.h"
#include <QStringList>
TEST( RiaProjectFileVersionTools, DecodeProjectVersionString )
{
{
int majorVersion = -1;
int minorVersion = -1;
int patchNumber = -1;
int developmentId = -1;
QString projectFileVersionString = "2017.05.1";
RiaProjectFileVersionTools::decodeVersionString( projectFileVersionString,
&majorVersion,
&minorVersion,
&patchNumber,
&developmentId );
EXPECT_EQ( 2017, majorVersion );
EXPECT_EQ( 5, minorVersion );
EXPECT_EQ( 1, patchNumber );
EXPECT_EQ( -1, developmentId );
}
{
int majorVersion = -1;
int minorVersion = -1;
int patchNumber = -1;
int developmentId = -1;
QString projectFileVersionString = "";
RiaProjectFileVersionTools::decodeVersionString( projectFileVersionString,
&majorVersion,
&minorVersion,
&patchNumber,
&developmentId );
EXPECT_EQ( -1, majorVersion );
EXPECT_EQ( -1, minorVersion );
EXPECT_EQ( -1, patchNumber );
EXPECT_EQ( -1, developmentId );
}
{
int majorVersion = -1;
int minorVersion = -1;
int patchNumber = -1;
int developmentId = -1;
QString projectFileVersionString = "2017.05.2-dev.23";
RiaProjectFileVersionTools::decodeVersionString( projectFileVersionString,
&majorVersion,
&minorVersion,
&patchNumber,
&developmentId );
EXPECT_EQ( 2017, majorVersion );
EXPECT_EQ( 5, minorVersion );
EXPECT_EQ( 2, patchNumber );
EXPECT_EQ( 23, developmentId );
}
{
int majorVersion = -1;
int minorVersion = -1;
int patchNumber = -1;
int developmentId = -1;
QString projectFileVersionString = "2017.05.2-dev.long.text..23";
RiaProjectFileVersionTools::decodeVersionString( projectFileVersionString,
&majorVersion,
&minorVersion,
&patchNumber,
&developmentId );
EXPECT_EQ( 2017, majorVersion );
EXPECT_EQ( 5, minorVersion );
EXPECT_EQ( 2, patchNumber );
EXPECT_EQ( 23, developmentId );
}
}
TEST( RiaProjectFileVersionTools, OrderKnownVersionStrings )
{
QStringList versionStrings;
{
// The following list is taken from traversing history of ResInsightVersion.cmake
versionStrings << "2017.05.2-dev.15";
versionStrings << "2017.05.2-dev.14";
versionStrings << "2017.05.2-dev.13";
versionStrings << "2017.05.2-dev.12";
versionStrings << "2017.05.2-dev.11";
versionStrings << "2017.05.2-dev.10";
versionStrings << "2017.05.2-dev.09";
versionStrings << "2017.05.2-dev.08";
versionStrings << "2017.05.2-dev.07";
versionStrings << "2017.05.2-dev.06";
versionStrings << "2017.05.2-dev.05";
versionStrings << "2017.05.2-dev.04";
versionStrings << "2017.05.2-dev.03";
versionStrings << "2017.05.2-dev.02";
versionStrings << "2017.05.2-fdev.02";
versionStrings << "2017.05.2-dev.1";
versionStrings << "2017.05.2-fdev.01";
versionStrings << "2017.05.2";
versionStrings << "2017.05.pre-proto.15";
versionStrings << "2017.05.1-dev";
versionStrings << "2017.05.1";
versionStrings << "2017.05.0";
versionStrings << "2016.11.flow.14";
versionStrings << "2016.11.flow.12";
versionStrings << "2016.11.flow.11";
versionStrings << "2016.11.flow.9";
versionStrings << "2016.11.flow.8";
versionStrings << "2016.11.flow.7";
versionStrings << "2016.11.flow.1";
versionStrings << "2016.11.m.1";
versionStrings << "2016.11.0";
versionStrings << "1.6.10-dev";
versionStrings << "1.6.9-dev";
versionStrings << "1.6.8-dev";
versionStrings << "1.6.7-gm-beta";
versionStrings << "1.6.6-dev";
versionStrings << "1.6.5-dev";
versionStrings << "1.6.4-dev";
versionStrings << "1.6.3-dev";
versionStrings << "1.6.1-dev";
versionStrings << "1.6.2-dev";
versionStrings << "1.6.0-RC";
versionStrings << "1.5.111-RC";
versionStrings << "1.5.110-RC";
versionStrings << "1.5.109-RC";
versionStrings << "1.5.108-RC";
versionStrings << "1.5.107-RC";
versionStrings << "1.5.106-RC";
versionStrings << "1.5.105-RC";
versionStrings << "1.5.104-RC";
versionStrings << "1.5.103-dev";
versionStrings << "1.5.102-dev";
versionStrings << "1.5.101-dev";
versionStrings << "1.5.100-dev";
versionStrings << "1.5.0";
}
// Additional dummy test versions
versionStrings << "2016.12";
versionStrings << "2015";
versionStrings << "2016.10.1.sd flkj....03";
versionStrings << "2016.10.1.sdf lkj. ...04";
QStringList sortedVersionList = versionStrings;
{
std::sort( sortedVersionList.begin(),
sortedVersionList.end(),
RiaProjectFileVersionTools::isCandidateVersionNewerThanOther );
}
/*
for (const auto& s : sortedVersionList)
{
std::cout << s.toStdString() << "\n";
}
*/
}

View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor 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 "RiaStatisticsTools.h"
#include <QDebug>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaStatisticsTools, NoCorrelation )
{
const int N = 1000;
std::vector<double> a, b;
a.reserve( N );
b.reserve( N );
for ( int i = 0; i < N; ++i )
{
a.push_back( (double)i );
}
for ( int i = 0; i < N; ++i )
{
b.push_back( (double)std::rand() );
}
double correlation = RiaStatisticsTools::pearsonCorrelation( a, b );
EXPECT_LE( correlation, 0.25 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaStatisticsTools, FullCorrelation )
{
const int N = 1000;
std::vector<double> a, b;
a.reserve( N );
b.reserve( N );
for ( int i = 0; i < N; ++i )
{
a.push_back( (double)i );
}
for ( int i = 0; i < N; ++i )
{
b.push_back( i * 2.0 + 1.0 );
}
double correlation = RiaStatisticsTools::pearsonCorrelation( a, b );
EXPECT_NEAR( correlation, 1.0, 1.0e-2 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaStatisticsTools, NegativeCorrelation )
{
const int N = 1000;
std::vector<double> a, b;
a.reserve( N );
b.reserve( N );
for ( int i = 0; i < N; ++i )
{
a.push_back( (double)i );
}
for ( int i = 0; i < N; ++i )
{
b.push_back( i * -2.0 + 1.0 );
}
double correlation = RiaStatisticsTools::pearsonCorrelation( a, b );
EXPECT_NEAR( correlation, -1.0, 1.0e-2 );
}

View File

@@ -0,0 +1,43 @@
#include "gtest/gtest.h"
#include "RiaStdStringTools.h"
#include <QLocale>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaStdStringToolsTest, ParseNumbers )
{
auto decimalPoint = QLocale::c().decimalPoint().toLatin1();
{
std::string text = "8.73705e+06";
EXPECT_TRUE( RiaStdStringTools::isNumber( text, decimalPoint ) );
}
{
std::string text = "-8.73705e-06";
EXPECT_TRUE( RiaStdStringTools::isNumber( text, decimalPoint ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaStdStringToolsTest, EditDistance )
{
// Equal string needs zero edits
EXPECT_EQ( 0, RiaStdStringTools::computeEditDistance( "same", "same" ) );
// Empty strings are also zero edits
EXPECT_EQ( 0, RiaStdStringTools::computeEditDistance( "", "" ) );
// Examples from wikipedia
EXPECT_EQ( 3, RiaStdStringTools::computeEditDistance( "kitten", "sitting" ) );
EXPECT_EQ( 3, RiaStdStringTools::computeEditDistance( "sitting", "kitten" ) );
EXPECT_EQ( 3, RiaStdStringTools::computeEditDistance( "Saturday", "Sunday" ) );
EXPECT_EQ( 3, RiaStdStringTools::computeEditDistance( "Sunday", "Saturday" ) );
}

View File

@@ -0,0 +1,140 @@
#include "gtest/gtest.h"
#include "RiaSummaryCurveAnalyzer.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, WellCompletions )
{
std::vector<RifEclipseSummaryAddress> addresses;
// Well A
std::string wellNameA = "well_name_a";
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameA, 1, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameA, 1, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameA, 5, 2, 3 );
addresses.push_back( adr );
}
// Well B
std::string wellNameB = "well_name_b";
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameB, 5, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameB, 5, 4, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr =
RifEclipseSummaryAddress::wellCompletionAddress( "quantity_name", wellNameB, 5, 4, 30 );
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAddresses( addresses );
EXPECT_EQ( 2u, analyzer.wellNames().size() );
auto completionsForA = analyzer.wellCompletions( wellNameA );
EXPECT_EQ( 2u, completionsForA.size() );
auto completionsForB = analyzer.wellCompletions( wellNameB );
EXPECT_EQ( 3u, completionsForB.size() );
std::string tupleToFind = "5, 4, 30";
EXPECT_TRUE( completionsForB.find( tupleToFind ) != completionsForB.end() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, WellSegments )
{
std::vector<RifEclipseSummaryAddress> addresses;
// Well A
std::string wellNameA = "well_name_a";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameA, 1 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameA, 1 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameA, 30 );
addresses.push_back( adr );
}
// Well B
std::string wellNameB = "well_name_b";
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameB, 1 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameB, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellSegmentAddress( "quantity_name", wellNameB, 10 );
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAddresses( addresses );
EXPECT_EQ( 2u, analyzer.wellNames().size() );
auto segmentsForA = analyzer.wellSegmentNumbers( wellNameA );
EXPECT_EQ( 2u, segmentsForA.size() );
auto segmentsForB = analyzer.wellSegmentNumbers( wellNameB );
EXPECT_EQ( 3u, segmentsForB.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSummaryCurveAnalyzer, CellBlocks )
{
std::vector<RifEclipseSummaryAddress> addresses;
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress( "quantity_name", 1, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress( "quantity_name", 1, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress( "quantity_name", 2, 2, 3 );
addresses.push_back( adr );
}
{
RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::blockAddress( "quantity_name", 5, 2, 3 );
addresses.push_back( adr );
}
RiaSummaryCurveAnalyzer analyzer;
analyzer.appendAddresses( addresses );
auto blocks = analyzer.blocks();
EXPECT_EQ( 3u, blocks.size() );
}

View File

@@ -0,0 +1,4 @@
// Test data directory used by unit tests
#define TEST_DATA_DIR "${CMAKE_CURRENT_LIST_DIR}/TestData"
#define TEST_MODEL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../TestModels"

View File

@@ -0,0 +1,86 @@
#include "gtest/gtest.h"
#include "RiaGitDiff.h"
#include "RiaRegressionTest.h"
#include "RiaTestDataDirectory.h"
#include "RiaTextFileCompare.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTextFileCompareTest, BasicCompareWithDiff )
{
RiaRegressionTest regTestConfig;
regTestConfig.readSettingsFromApplicationStore();
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
QString baseFolder = QString( "%1/TextCompare/base" ).arg( TEST_DATA_DIR );
QString referenceFolder = QString( "%1/TextCompare/reference" ).arg( TEST_DATA_DIR );
RiaTextFileCompare compare( folderContainingDiff );
bool noDifference = compare.runComparison( baseFolder, referenceFolder );
EXPECT_FALSE( noDifference );
QString diffOutput = compare.diffOutput();
EXPECT_FALSE( diffOutput.isEmpty() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTextFileCompareTest, BasicCompareNoDiff )
{
RiaRegressionTest regTestConfig;
regTestConfig.readSettingsFromApplicationStore();
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
QString baseFolder = QString( "%1/TextCompare/base/folderB" ).arg( TEST_DATA_DIR );
QString referenceFolder = QString( "%1/TextCompare/reference/folderB" ).arg( TEST_DATA_DIR );
RiaTextFileCompare compare( folderContainingDiff );
bool noDifference = compare.runComparison( baseFolder, referenceFolder );
EXPECT_TRUE( noDifference );
QString diffOutput = compare.diffOutput();
EXPECT_TRUE( diffOutput.isEmpty() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTextFileCompareTest, BasicCompareError )
{
RiaRegressionTest regTestConfig;
regTestConfig.readSettingsFromApplicationStore();
QString folderContainingDiff = regTestConfig.folderContainingDiffTool();
QString baseFolder = QString( "%1/TextCompare/baseDoesNotExist" ).arg( TEST_DATA_DIR );
QString referenceFolder = QString( "%1/TextCompare/reference/folderB" ).arg( TEST_DATA_DIR );
RiaTextFileCompare compare( folderContainingDiff );
bool noDifference = compare.runComparison( baseFolder, referenceFolder );
EXPECT_FALSE( noDifference );
QString error = compare.errorMessage();
EXPECT_FALSE( error.isEmpty() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaGitDiffTest, BasicCompare )
{
RiaRegressionTest regTestConfig;
regTestConfig.readSettingsFromApplicationStore();
QString folderContainingDiff = regTestConfig.folderContainingGitTool();
RiaGitDiff compare( folderContainingDiff );
QString baseFolder = QString( "d:/gitroot-ceesol/ResInsight-regression-test/ProjectFiles/CommandFileTests" );
compare.executeDiff( baseFolder );
compare.diffOutput();
}

View File

@@ -0,0 +1,520 @@
#include "gtest/gtest.h"
#include "RiaQDateTimeTools.h"
#include "RiaTimeHistoryCurveResampler.h"
//--------------------------------------------------------------------------------------------------
/// Constants
//--------------------------------------------------------------------------------------------------
static int SECS_PER_DAY = 60 * 60 * 24;
//--------------------------------------------------------------------------------------------------
/// Helpers
//--------------------------------------------------------------------------------------------------
static time_t toTime_t( const QString& timeString )
{
return RiaQDateTimeTools::fromString( timeString, "yyyy-MM-dd" ).toTime_t();
}
static std::vector<time_t> toTime_tVector( const std::vector<QString>& timeStrings )
{
std::vector<time_t> tv;
for ( auto& ts : timeStrings )
tv.push_back( toTime_t( ts ) );
return tv;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_NoPeriod )
{
std::vector<QString> timeStrings( { "2018-02-03", "2018-02-27" } );
std::vector<double> dataValues( { 3.0, 5.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps()[0] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Decade )
{
std::vector<QString> timeStrings( { "1989-02-03", "2005-06-06", "2012-02-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DECADE );
EXPECT_EQ( 4, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "1990-01-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2000-01-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2010-01-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2020-01-01" ), resampler.resampledTimeSteps()[3] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Year )
{
std::vector<QString> timeStrings( { "2014-06-06", "2015-12-02", "2018-02-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::YEAR );
EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2015-01-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2016-01-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2017-01-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2019-01-01" ), resampler.resampledTimeSteps()[4] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_HalfYear )
{
std::vector<QString> timeStrings( { "2016-06-06", "2017-03-02", "2018-02-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::HALFYEAR );
EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2016-07-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2017-01-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2017-07-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2018-07-01" ), resampler.resampledTimeSteps()[4] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Quarter )
{
std::vector<QString> timeStrings( { "2016-09-06", "2017-03-02", "2018-02-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::QUARTER );
EXPECT_EQ( 7, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2016-10-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2017-01-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2017-04-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2017-07-01" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2017-10-01" ), resampler.resampledTimeSteps()[4] );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[5] );
EXPECT_EQ( toTime_t( "2018-04-01" ), resampler.resampledTimeSteps()[6] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Month )
{
std::vector<QString> timeStrings( { "2017-09-06", "2017-12-02", "2018-02-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 6, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2017-10-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2017-11-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2017-12-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2018-02-01" ), resampler.resampledTimeSteps()[4] );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps()[5] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Week )
{
std::vector<QString> timeStrings( { "2017-11-02", "2017-12-24", "2018-01-07" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::WEEK );
EXPECT_EQ( 10, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2017-11-06" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2017-11-13" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2017-11-20" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2017-11-27" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2017-12-04" ), resampler.resampledTimeSteps()[4] );
EXPECT_EQ( toTime_t( "2017-12-11" ), resampler.resampledTimeSteps()[5] );
EXPECT_EQ( toTime_t( "2017-12-18" ), resampler.resampledTimeSteps()[6] );
EXPECT_EQ( toTime_t( "2017-12-25" ), resampler.resampledTimeSteps()[7] );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[8] );
EXPECT_EQ( toTime_t( "2018-01-08" ), resampler.resampledTimeSteps()[9] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_Resampling_NoSampleCrossingPeriodBoundary )
{
std::vector<QString> timeStrings( { "2017-01-02", "2017-06-15", "2017-12-24" } );
std::vector<double> dataValues( { 0.0, 0.0, 0.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::YEAR );
EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-01-01" ), resampler.resampledTimeSteps()[0] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SingleSample )
{
std::vector<QString> timeStrings( { "2018-02-07" } );
std::vector<double> dataValues( { 3.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps()[0] );
double value = 0.0;
EXPECT_NEAR( value, resampler.resampledValues()[0], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_Days )
{
std::vector<QString> timeStrings( { "2018-02-03", "2018-02-07" } );
std::vector<double> dataValues( { 3.0, 5.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DAY );
EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-02-03" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2018-02-04" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2018-02-05" ), resampler.resampledTimeSteps()[2] );
EXPECT_EQ( toTime_t( "2018-02-06" ), resampler.resampledTimeSteps()[3] );
EXPECT_EQ( toTime_t( "2018-02-07" ), resampler.resampledTimeSteps()[4] );
EXPECT_NEAR( 3.0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( 5.0, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( 5.0, resampler.resampledValues()[2], 1e-12 );
EXPECT_NEAR( 5.0, resampler.resampledValues()[3], 1e-12 );
EXPECT_NEAR( 5.0, resampler.resampledValues()[4], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_Decade )
{
std::vector<QString> timeStrings( { "1999-02-03", "2005-06-06", "2012-02-07" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0 } );
time_t t0 = toTime_t( "1999-02-03" );
time_t t1 = toTime_t( "2005-06-06" );
time_t t2 = toTime_t( "2012-02-07" );
time_t tp0 = toTime_t( "2000-01-01" );
time_t tp1 = toTime_t( "2010-01-01" );
time_t tp2 = toTime_t( "2020-01-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DECADE );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
EXPECT_EQ( tp2, resampler.resampledTimeSteps()[2] );
double value0 = 5.0 * ( tp0 - t0 ) / ( tp0 - toTime_t( "1990-01-01" ) );
double value1 = ( 5.0 * ( t1 - tp0 ) + 7.0 * ( tp1 - t1 ) ) / ( tp1 - tp0 );
double value2 = 7.0 * ( t2 - tp1 ) / ( tp2 - tp1 );
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartBeforePeriod )
{
std::vector<QString> timeStrings( { "2018-01-20", "2018-01-29", "2018-02-03", "2018-02-27", "2018-03-02" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0, 13.0 } );
time_t tp0 = toTime_t( "2018-02-01" );
time_t tp1 = toTime_t( "2018-03-01" );
time_t tp2 = toTime_t( "2018-04-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
EXPECT_EQ( tp2, resampler.resampledTimeSteps()[2] );
double value0 = ( 5.0 * 9 + 7.0 * 3 ) * SECS_PER_DAY / ( tp0 - toTime_t( "2018-01-01" ) );
double value1 = ( 7.0 * 2 + 11.0 * 24 + 13.0 * 2 ) * SECS_PER_DAY / ( tp1 - tp0 );
double value2 = 13.0 * 1 * SECS_PER_DAY / ( tp2 - tp1 );
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartBeforePeriod_TimeStepsMatchPeriod )
{
std::vector<QString> timeStrings( { "2018-01-20", "2018-02-01", "2018-02-03", "2018-03-01", "2018-03-02" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0, 13.0 } );
time_t tp0 = toTime_t( "2018-02-01" );
time_t tp1 = toTime_t( "2018-03-01" );
time_t tp2 = toTime_t( "2018-04-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
EXPECT_EQ( tp2, resampler.resampledTimeSteps()[2] );
double value0 = ( 5.0 * 12 ) * SECS_PER_DAY / ( tp0 - toTime_t( "2018-01-01" ) );
double value1 = ( 7.0 * 2 + 11.0 * 26 ) * SECS_PER_DAY / ( tp1 - tp0 );
double value2 = 13.0 * 1 * SECS_PER_DAY / ( tp2 - tp1 );
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartAndEndMatchPeriod )
{
std::vector<QString> timeStrings( { "2018-02-01", "2018-02-10", "2018-03-01" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-02-01" ), resampler.resampledTimeSteps().front() );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps().back() );
time_t timePeriod = toTime_t( "2018-03-01" ) - toTime_t( "2018-02-01" );
double value1 = 3.0;
double value2 = ( 5.0 * 9 + 7.0 * 19 ) * SECS_PER_DAY / timePeriod;
EXPECT_NEAR( value1, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[1], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartMatchPeriodStart )
{
std::vector<QString> timeStrings( { "2018-02-01", "2018-02-10", "2018-03-01", "2018-03-02" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0 } );
time_t tp0 = toTime_t( "2018-02-01" );
time_t tp1 = toTime_t( "2018-03-01" );
time_t tp2 = toTime_t( "2018-04-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
EXPECT_EQ( tp2, resampler.resampledTimeSteps()[2] );
double value0 = 3.0;
double value1 = ( 5.0 * 9 + 7.0 * 19 ) * SECS_PER_DAY / ( tp1 - tp0 );
double value2 = 11.0 * 1 * SECS_PER_DAY / ( tp2 - tp1 );
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_MultipleSamplesInLastPeriod )
{
std::vector<QString> timeStrings( { "2018-02-10", "2018-03-02", "2018-03-05", "2018-03-15" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0 } );
time_t tp0 = toTime_t( "2018-03-01" );
time_t tp1 = toTime_t( "2018-04-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
double value0 = 5.0 * 19 * SECS_PER_DAY / ( tp0 - toTime_t( "2018-02-01" ) );
double value1 = ( 0.0 * 17 + 11.0 * 10 + 7.0 * 3 + 5.0 * 1 ) * SECS_PER_DAY / ( tp1 - tp0 );
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SingleSample )
{
std::vector<QString> timeStrings( { "2018-02-10" } );
std::vector<double> dataValues( { 3.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_NEAR( 3.0, resampler.resampledValues()[0], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartBeforePeriod )
{
std::vector<QString> timeStrings( { "2018-01-30", "2018-02-10", "2018-03-05", "2018-03-02" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0 } );
time_t t0 = toTime_t( "2018-01-30" );
time_t t1 = toTime_t( "2018-02-10" );
time_t t2 = toTime_t( "2018-03-05" );
time_t tp0 = toTime_t( "2018-02-01" );
time_t tp1 = toTime_t( "2018-03-01" );
time_t tp2 = toTime_t( "2018-04-01" );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] );
EXPECT_EQ( tp1, resampler.resampledTimeSteps()[1] );
EXPECT_EQ( tp2, resampler.resampledTimeSteps()[2] );
double value0 = ( 5.0 - 3.0 ) * ( tp0 - t0 ) / ( t1 - t0 ) + 3.0;
double value1 = ( 7.0 - 5.0 ) * ( tp1 - t1 ) / ( t2 - t1 ) + 5.0;
double value2 = 11.0;
EXPECT_NEAR( value0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( value1, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( value2, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartMatchPeriod )
{
std::vector<QString> timeStrings( { "2018-02-01", "2018-02-10", "2018-03-01", "2018-03-02" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0, 11.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-02-01" ), resampler.resampledTimeSteps()[0] );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps()[1] );
EXPECT_EQ( toTime_t( "2018-04-01" ), resampler.resampledTimeSteps()[2] );
EXPECT_NEAR( 3.0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( 7.0, resampler.resampledValues()[1], 1e-12 );
EXPECT_NEAR( 11.0, resampler.resampledValues()[2], 1e-12 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartAndEndMatchPeriod )
{
std::vector<QString> timeStrings( { "2018-02-01", "2018-02-10", "2018-03-01" } );
std::vector<double> dataValues( { 3.0, 5.0, 7.0 } );
RiaTimeHistoryCurveResampler resampler;
resampler.setCurveData( dataValues, toTime_tVector( timeStrings ) );
resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH );
EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() );
EXPECT_EQ( toTime_t( "2018-02-01" ), resampler.resampledTimeSteps().front() );
EXPECT_EQ( toTime_t( "2018-03-01" ), resampler.resampledTimeSteps().back() );
EXPECT_NEAR( 3.0, resampler.resampledValues()[0], 1e-12 );
EXPECT_NEAR( 7.0, resampler.resampledValues()[1], 1e-12 );
}

View File

@@ -0,0 +1,57 @@
#include "gtest/gtest.h"
#include "RiaWeightedGeometricMeanCalculator.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaWeightedGeometricMeanCalculator, BasicUsage )
{
{
RiaWeightedGeometricMeanCalculator calc;
EXPECT_DOUBLE_EQ( 0.0, calc.aggregatedWeight() );
EXPECT_DOUBLE_EQ( 0.0, calc.weightedMean() );
}
{
RiaWeightedGeometricMeanCalculator calc;
std::vector<double> values{ 30.0, 60.0 };
std::vector<double> weights{ 1.5, 3.5 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
double expectedValue = std::pow( std::pow( 30.0, 1.5 ) * std::pow( 60.0, 3.5 ), 1 / ( 1.5 + 3.5 ) );
EXPECT_DOUBLE_EQ( 5.0, calc.aggregatedWeight() );
EXPECT_NEAR( expectedValue, calc.weightedMean(), 1e-10 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaWeightedGeometricMeanCalculator, BigValues )
{
RiaWeightedGeometricMeanCalculator calc;
std::vector<double> values{ 3000000.0, 6000000.0, 1250000, 2200000 };
std::vector<double> weights{ 1.5, 3.5, 7, 5 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
double expectedValue = std::pow( std::pow( 3000000.0, 1.5 ) * std::pow( 6000000.0, 3.5 ) *
std::pow( 1250000.0, 7 ) * std::pow( 2200000.0, 5 ),
1 / ( 1.5 + 3.5 + 7 + 5 ) );
EXPECT_DOUBLE_EQ( 17.0, calc.aggregatedWeight() );
EXPECT_NEAR( expectedValue, calc.weightedMean(), 1e-8 );
}

View File

@@ -0,0 +1,74 @@
#include "gtest/gtest.h"
#include "RiaWeightedHarmonicMeanCalculator.h"
#include <cmath>
#include <numeric>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaWeightedHarmonicMeanCalculator, BasicUsage )
{
{
RiaWeightedHarmonicMeanCalculator calc;
EXPECT_DOUBLE_EQ( 0.0, calc.aggregatedWeight() );
EXPECT_FALSE( calc.validAggregatedWeight() );
}
{
RiaWeightedHarmonicMeanCalculator calc;
std::vector<double> values{ 1, 4, 4 };
std::vector<double> weights{ 1, 1, 1 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
double expectedValue = 2.0;
EXPECT_DOUBLE_EQ( 3.0, calc.aggregatedWeight() );
EXPECT_NEAR( expectedValue, calc.weightedMean(), 1e-10 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaWeightedHarmonicMeanCalculator, WeightedValues )
{
{
RiaWeightedHarmonicMeanCalculator calc;
std::vector<double> values{ 10, 5, 4, 3 };
std::vector<double> weights{ 10, 5, 4, 3 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
double sumWeights = std::accumulate( weights.begin(), weights.end(), 0.0 );
EXPECT_DOUBLE_EQ( sumWeights, calc.aggregatedWeight() );
EXPECT_NEAR( sumWeights / weights.size(), calc.weightedMean(), 1e-8 );
}
{
RiaWeightedHarmonicMeanCalculator calc;
std::vector<double> values{ 2.0, 3.0, 1.0, 4.0 };
std::vector<double> weights{ 1.0, 2.0, 7.0, 3.0 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
double sumWeights = std::accumulate( weights.begin(), weights.end(), 0.0 );
double aggregatedWeightAndValues = 1.0 / 2.0 + 2.0 / 3.0 + 7.0 / 1.0 + 3.0 / 4.0;
double expectedValue = sumWeights / aggregatedWeightAndValues;
EXPECT_DOUBLE_EQ( sumWeights, calc.aggregatedWeight() );
EXPECT_NEAR( expectedValue, calc.weightedMean(), 1.0e-8 );
}
}

View File

@@ -0,0 +1,31 @@
#include "gtest/gtest.h"
#include "RiaWeightedMeanCalculator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaWeightedMeanCalculator, BasicUsage )
{
{
RiaWeightedMeanCalculator<double> calc;
EXPECT_DOUBLE_EQ( 0.0, calc.aggregatedWeight() );
EXPECT_FALSE( calc.validAggregatedWeight() );
}
{
RiaWeightedMeanCalculator<double> calc;
std::vector<double> values{ 3.0, 6.0 };
std::vector<double> weights{ 1.0, 2.0 };
for ( size_t i = 0; i < values.size(); i++ )
{
calc.addValueAndWeight( values[i], weights[i] );
}
EXPECT_TRUE( calc.validAggregatedWeight() );
EXPECT_DOUBLE_EQ( 3.0, calc.aggregatedWeight() );
EXPECT_DOUBLE_EQ( 5.0, calc.weightedMean() );
}
}

View File

@@ -0,0 +1,54 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifElementPropertyTableReader.h"
#include <QString>
#include <numeric>
static const QString TEST_DATA_DIRECTORY = QString( "%1/RifElementPropertyTableReader/" ).arg( TEST_DATA_DIR );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, BasicUsage )
{
RifElementPropertyMetadata metadata =
RifElementPropertyTableReader::readMetadata( TEST_DATA_DIRECTORY + "ELASTIC_TABLE.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( table.hasData );
EXPECT_EQ( 2, metadata.dataColumns.size() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[0].toStdString().c_str() );
EXPECT_STREQ( "RATIO", metadata.dataColumns[1].toStdString().c_str() );
EXPECT_EQ( 2, table.data.size() );
EXPECT_EQ( 4320, table.elementIds.size() );
EXPECT_EQ( 4320, table.data[0].size() );
EXPECT_EQ( 4320, table.data[1].size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, ParseFailed )
{
try
{
RifElementPropertyMetadata metadata =
RifElementPropertyTableReader::readMetadata( TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( false );
}
catch ( FileParseException e )
{
EXPECT_TRUE( e.message.startsWith( "Number of columns mismatch" ) );
}
}

View File

@@ -0,0 +1,77 @@
#include "gtest/gtest.h"
#include "RimSummaryCalculation.h"
#include "expressionparser/ExpressionParser.h"
#include <numeric>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicExpressionParserTest, BasicUsage )
{
std::vector<double> a( 10 );
std::iota( a.begin(), a.end(), 10 );
std::vector<double> b( 10 );
std::iota( b.begin(), b.end(), 100 );
std::vector<double> c( 10 );
ExpressionParser parser;
parser.assignVector( "a", a );
parser.assignVector( "b", b );
parser.assignVector( "c", c );
QString expr = "c := a + b";
EXPECT_TRUE( parser.evaluate( expr ) );
EXPECT_DOUBLE_EQ( c[0], 110.0 );
EXPECT_DOUBLE_EQ( c[9], 128.0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicExpressionParserTest, DetectVariables )
{
QString expr = "c := a + (x / y)";
std::vector<QString> variables = ExpressionParser::detectReferencedVariables( expr );
EXPECT_STREQ( variables[0].toStdString().data(), "c" );
EXPECT_STREQ( variables[1].toStdString().data(), "a" );
EXPECT_STREQ( variables[2].toStdString().data(), "x" );
EXPECT_STREQ( variables[3].toStdString().data(), "y" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicExpressionParserTest, FindLeftHandSide )
{
{
QString expr = "c := a";
QString s = RimSummaryCalculation::findLeftHandSide( expr );
EXPECT_STREQ( s.toStdString().data(), "c" );
}
{
QString expr = "c:=a";
QString s = RimSummaryCalculation::findLeftHandSide( expr );
EXPECT_STREQ( s.toStdString().data(), "c" );
}
{
QString expr = "\na:=b\n\nc:=a";
QString s = RimSummaryCalculation::findLeftHandSide( expr );
EXPECT_STREQ( s.toStdString().data(), "c" );
}
}

View File

@@ -0,0 +1,121 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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 "RiaStringEncodingTools.h"
#include "RiaTestDataDirectory.h"
#include "RifActiveCellsReader.h"
#include "ert/ecl/ecl_file.hpp"
#include "ert/ecl/ecl_grid.hpp"
#include <QDir>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifActiveCellsReaderTest, BasicTest10k )
{
QDir baseFolder( TEST_MODEL_DIR );
bool subFolderExists = baseFolder.cd( "TEST10K_FLT_LGR_NNC" );
EXPECT_TRUE( subFolderExists );
ecl_grid_type* mainEclGrid = nullptr;
{
QString filename( "TEST10K_FLT_LGR_NNC.EGRID" );
QString filePath = baseFolder.absoluteFilePath( filename );
mainEclGrid = ecl_grid_alloc( RiaStringEncodingTools::toNativeEncoded( filePath ).data() );
}
std::vector<std::vector<int>> activeCellsFromActnum;
std::vector<std::vector<int>> activeCellsFromPorv;
{
QString filename( "TEST10K_FLT_LGR_NNC.EGRID" );
QString filePath = baseFolder.absoluteFilePath( filename );
ecl_file_type* gridFile =
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( filePath ).data(), ECL_FILE_CLOSE_STREAM );
activeCellsFromActnum = RifActiveCellsReader::activeCellsFromActnumKeyword( gridFile );
EXPECT_EQ( (size_t)2, activeCellsFromActnum.size() );
ecl_file_close( gridFile );
}
{
QString filename( "TEST10K_FLT_LGR_NNC.INIT" );
QString filePath = baseFolder.absoluteFilePath( filename );
ecl_file_type* initFile =
ecl_file_open( RiaStringEncodingTools::toNativeEncoded( filePath ).data(), ECL_FILE_CLOSE_STREAM );
activeCellsFromPorv = RifActiveCellsReader::activeCellsFromPorvKeyword( initFile, false );
EXPECT_EQ( 2, (int)activeCellsFromPorv.size() );
ecl_file_close( initFile );
}
for ( size_t gridIndex = 0; gridIndex < activeCellsFromActnum.size(); gridIndex++ )
{
for ( size_t valueIndex = 0; valueIndex < activeCellsFromActnum[gridIndex].size(); valueIndex++ )
{
auto actnumValue = activeCellsFromActnum[gridIndex][valueIndex];
auto porvValue = activeCellsFromPorv[gridIndex][valueIndex];
if ( actnumValue > 0 )
{
EXPECT_TRUE( porvValue > 0 );
}
else
{
EXPECT_EQ( 0, porvValue );
}
}
}
std::vector<int> expectedActiveCellCountPerGrid;
expectedActiveCellCountPerGrid.push_back( 8517 );
expectedActiveCellCountPerGrid.push_back( 2608 );
for ( int gridIndex = 0; gridIndex < static_cast<int>( activeCellsFromActnum.size() ); gridIndex++ )
{
ecl_grid_type* currentGrid = nullptr;
if ( gridIndex == 0 )
{
currentGrid = mainEclGrid;
}
else
{
currentGrid = ecl_grid_iget_lgr( mainEclGrid, gridIndex - 1 );
}
auto activeCellsForGrid = activeCellsFromActnum[gridIndex];
if ( ecl_grid_get_global_size( currentGrid ) == static_cast<int>( activeCellsForGrid.size() ) )
{
int expectedCellCount = expectedActiveCellCountPerGrid[gridIndex];
EXPECT_EQ( expectedCellCount, ecl_grid_get_nactive( currentGrid ) );
int* actnum_values = activeCellsForGrid.data();
ecl_grid_reset_actnum( currentGrid, actnum_values );
EXPECT_EQ( expectedCellCount, ecl_grid_get_nactive( currentGrid ) );
}
}
ecl_grid_free( mainEclGrid );
}

View File

@@ -0,0 +1,77 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifCaseRealizationParametersReader.h"
#include "RifFileParseTools.h"
#include <QString>
#include <numeric>
static const QString CASE_REAL_TEST_DATA_DIRECTORY =
QString( "%1/RifCaseRealizationParametersReader/" ).arg( TEST_DATA_DIR );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifCaseRealizationParametersReaderTest, LocatorTestSuccess )
{
QString file = RifCaseRealizationParametersFileLocator::locate( CASE_REAL_TEST_DATA_DIRECTORY + "4/3/2" );
QString expected = CASE_REAL_TEST_DATA_DIRECTORY + "parameters.txt";
EXPECT_EQ( expected.toStdString(), file.toStdString() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifCaseRealizationParametersReaderTest, LocatorTestFailure )
{
QString file = RifCaseRealizationParametersFileLocator::locate( CASE_REAL_TEST_DATA_DIRECTORY + "4/3/2/1" );
QString expected = "";
EXPECT_EQ( expected.toStdString(), file.toStdString() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifCaseRealizationParametersReaderTest, SuccessfulParsing )
{
RifCaseRealizationParametersReader reader( CASE_REAL_TEST_DATA_DIRECTORY + "parameters.txt" );
try
{
reader.parse();
const std::shared_ptr<RigCaseRealizationParameters> parameters( reader.parameters() );
std::map<QString, RigCaseRealizationParameters::Value> params = parameters->parameters();
EXPECT_EQ( 1U, params.count( "LETSWOF:L_1OW" ) );
EXPECT_EQ( 1U, params.count( "LETSGOF:KRG1" ) );
EXPECT_EQ( 1U, params.count( "LOG10_MULTFLT:MULTFLT_F1" ) );
EXPECT_EQ( 1U, params.count( "TST:TEXT_PARAM" ) );
EXPECT_TRUE( params["LETSWOF:L_1OW"].isNumeric() );
EXPECT_EQ( 1.83555, params["LETSWOF:L_1OW"].numericValue() );
EXPECT_TRUE( params["LETSGOF:KRG1"].isNumeric() );
EXPECT_EQ( 0.97, params["LETSGOF:KRG1"].numericValue() );
EXPECT_TRUE( params["TST:TEXT_PARAM"].isText() );
EXPECT_EQ( std::string( "YES" ), params["TST:TEXT_PARAM"].textValue().toStdString() );
}
catch ( ... )
{
EXPECT_TRUE( false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifCaseRealizationParametersReaderTest, FindRealizationNumber )
{
QString filePath = "d:/gitroot-ceesol/ResInsight-regression-test/ModelData/ensemble_reek_with_params/realization-"
"7/iter-0/eclipse/model/3_R001_REEK-7.SMSPEC";
int realisationNumber = RifCaseRealizationParametersFileLocator::realizationNumber( filePath );
EXPECT_EQ( 7, realisationNumber );
}

View File

@@ -0,0 +1,130 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifColorLegendData.h"
#include "RigFormationNames.h"
#include "RimRegularLegendConfig.h"
#include "cvfColor3.h"
#include <QDir>
#include <QString>
#include <QStringList>
TEST( RifColorLegendData, ReadLYRFileWithoutColor )
{
QDir baseFolder( TEST_DATA_DIR );
const QString filename( "RifColorLegendData/Norne_ATW2013.lyr" );
const QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
QString errormessage;
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
EXPECT_TRUE( errormessage.isEmpty() );
QString formationName_K1 = fm->formationNameFromKLayerIdx( 0 );
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
EXPECT_TRUE( formationName_K1 == "Garn 3" );
EXPECT_EQ( 1, formationIndex );
}
TEST( RifColorLegendData, ReadLYRFileWithColorName )
{
QDir baseFolder( TEST_DATA_DIR );
const QString filename( "RifColorLegendData/Norne_ATW2013ColorName.lyr" );
const QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
QString errormessage;
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
EXPECT_TRUE( errormessage.isEmpty() );
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
cvf::Color3f formationColor;
bool colorPresent = fm->formationColorFromKLayerIdx( 1, &formationColor );
EXPECT_TRUE( colorPresent );
EXPECT_TRUE( formationName_K1 == "Garn 2" );
EXPECT_EQ( 1, formationIndex );
EXPECT_EQ( 1.0f, formationColor.r() );
EXPECT_EQ( 0.0f, formationColor.g() );
EXPECT_EQ( 0.0f, formationColor.b() );
}
TEST( RifColorLegendData, ReadLYRFileWithColorHTML )
{
QDir baseFolder( TEST_DATA_DIR );
const QString filename( "RifColorLegendData/Norne_ATW2013ColorHTML.lyr" );
const QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
QString errormessage;
cvf::ref<RigFormationNames> fm = RifColorLegendData::readFormationNamesFile( filePath, &errormessage );
EXPECT_TRUE( errormessage.isEmpty() );
QString formationName_K1 = fm->formationNameFromKLayerIdx( 1 );
int formationIndex = fm->formationIndexFromKLayerIdx( 1 );
cvf::Color3f formationColor;
bool colorPresent = fm->formationColorFromKLayerIdx( 1, &formationColor );
EXPECT_TRUE( colorPresent );
EXPECT_TRUE( formationName_K1 == "Garn 2" );
EXPECT_EQ( 1, formationIndex );
EXPECT_EQ( 1.0f, formationColor.r() );
EXPECT_EQ( 0.0f, formationColor.g() );
EXPECT_EQ( 0.0f, formationColor.b() );
}
TEST( RimRegularLegendConfig, LogTenFunctions )
{
{
// Negative values will return zero
double value = -0.0015;
auto exponentCeil = RimRegularLegendConfig::computeTenExponentCeil( value );
EXPECT_EQ( 0.0f, exponentCeil );
auto exponentFloor = RimRegularLegendConfig::computeTenExponentFloor( value );
EXPECT_EQ( 0.0f, exponentFloor );
}
{
double value = 0.15;
auto exponentCeil = RimRegularLegendConfig::computeTenExponentCeil( value );
EXPECT_EQ( 0.0f, exponentCeil );
auto exponentFloor = RimRegularLegendConfig::computeTenExponentFloor( value );
EXPECT_EQ( -1.0f, exponentFloor );
}
{
double value = 1.5;
auto exponentCeil = RimRegularLegendConfig::computeTenExponentCeil( value );
EXPECT_EQ( 1.0f, exponentCeil );
auto exponentFloor = RimRegularLegendConfig::computeTenExponentFloor( value );
EXPECT_EQ( 0.0f, exponentFloor );
}
{
double value = 15;
auto exponentCeil = RimRegularLegendConfig::computeTenExponentCeil( value );
EXPECT_EQ( 2.0f, exponentCeil );
auto exponentFloor = RimRegularLegendConfig::computeTenExponentFloor( value );
EXPECT_EQ( 1.0f, exponentFloor );
}
}

View File

@@ -0,0 +1,48 @@
#include "gtest/gtest.h"
#include "RifCsvDataTableFormatter.h"
#include <QString>
#include <QStringList>
TEST( RifCsvDataTableFormatter, BasicUsage )
{
QString tableText;
QTextStream stream( &tableText );
RifCsvDataTableFormatter formatter( stream, ";" );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "Well" ),
RifTextDataTableColumn( "Integer Number" ),
RifTextDataTableColumn( "sci", RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ),
RifTextDataTableColumn( "float", RifTextDataTableDoubleFormat::RIF_FLOAT ),
RifTextDataTableColumn( "consise", RifTextDataTableDoubleFormat::RIF_CONSISE ),
};
formatter.header( header );
formatter.add( "well a" );
formatter.add( 1 );
formatter.add( 2.123456789 );
formatter.add( 2.123456789 );
formatter.add( 2.123456789 );
formatter.rowCompleted();
formatter.add( "well B" );
formatter.add( 12 );
formatter.add( 0.3e-12 );
formatter.add( 0.3e-12 );
formatter.add( 0.3e-12 );
formatter.rowCompleted();
formatter.add( "well c" );
formatter.add( 123 );
formatter.add( 0.3e+12 );
formatter.add( 0.3e+12 );
formatter.add( 0.3e+12 );
formatter.rowCompleted();
formatter.tableCompleted();
std::cout << tableText.toStdString();
}

View File

@@ -0,0 +1,382 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifEclipseInputFileTools.h"
#include "RigEclipseCaseData.h"
#include "RigEquil.h"
#include <QDebug>
#include <QFile>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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 );
}
}
// Improved parsing handling some special cases
{
QStringList faceTexts;
faceTexts << "Z--"
<< "z--"
<< "z/"
<< " y /";
cvf::StructGridInterface::FaceEnum faceType;
foreach ( QString text, faceTexts )
{
faceType = RifEclipseInputFileTools::faceEnumFromText( text );
EXPECT_NE( cvf::StructGridInterface::NO_FACE, faceType );
}
}
// Invalid faces
{
QStringList faceTexts;
faceTexts << "-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 );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseInputFileToolsTest, EquilData )
{
static const QString testDataRootFolder = QString( "%1/ParsingOfDataKeywords/" ).arg( TEST_DATA_DIR );
{
QString fileName = testDataRootFolder + "simulation/MY_CASE.DATA";
QFile data( fileName );
if ( !data.open( QFile::ReadOnly ) )
{
return;
}
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
RifEclipseInputFileTools::parseAndReadPathAliasKeyword( fileName, &pathAliasDefinitions );
const QString keyword( "EQUIL" );
const QString keywordToStopParsing;
const qint64 startPositionInFile = 0;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
EXPECT_EQ( (int)10, keywordContent.size() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseInputFileToolsTest, FaultData )
{
static const QString testDataRootFolder = QString( "%1/ParsingOfDataKeywords/" ).arg( TEST_DATA_DIR );
{
QString fileName = testDataRootFolder + "simulation/MY_CASE.DATA";
QFile data( fileName );
if ( !data.open( QFile::ReadOnly ) )
{
return;
}
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
RifEclipseInputFileTools::parseAndReadPathAliasKeyword( fileName, &pathAliasDefinitions );
const QString keyword( "FAULTS" );
const QString keywordToStopParsing;
const qint64 startPositionInFile = 0;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
EXPECT_EQ( (int)977, keywordContent.size() );
/*
for (const auto& s : keywordContent)
{
qDebug() << s;
}
*/
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseInputFileToolsTest, StopAtKeyword )
{
static const QString testDataRootFolder = QString( "%1/ParsingOfDataKeywords/" ).arg( TEST_DATA_DIR );
QString fileName = testDataRootFolder + "simulation/MY_CASE_2.DATA";
QFile data( fileName );
if ( !data.open( QFile::ReadOnly ) )
{
return;
}
{
const QString keyword( "FAULTS" );
const QString keywordToStopParsing( "EDIT" );
const qint64 startPositionInFile = 0;
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
EXPECT_TRUE( isStopParsingKeywordDetected );
EXPECT_TRUE( keywordContent.isEmpty() );
}
{
const QString keyword( "EQUIL" );
const QString keywordToStopParsing( "SCHEDULE" );
const qint64 startPositionInFile = 0;
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
EXPECT_TRUE( isStopParsingKeywordDetected );
EXPECT_TRUE( keywordContent.isEmpty() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseInputFileToolsTest, DISABLED_FindFilesWithVfp )
{
QString fileName = "d:/gitroot-ceesol/ResInsight-regression-test/ModelData/norne/NORNE_ATW2013.DATA";
{
QFile data( fileName );
if ( !data.open( QFile::ReadOnly ) )
{
return;
}
const QString keyword( "VFPPROD" );
const QString keywordToStopParsing;
const qint64 startPositionInFile = 0;
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
// EXPECT_TRUE( isStopParsingKeywordDetected );
// EXPECT_TRUE( keywordContent.isEmpty() );
}
{
QFile data( fileName );
if ( !data.open( QFile::ReadOnly ) )
{
return;
}
const QString keyword( "VFPINJ" );
const QString keywordToStopParsing;
const qint64 startPositionInFile = 0;
std::vector<std::pair<QString, QString>> pathAliasDefinitions;
QStringList keywordContent;
std::vector<QString> fileNamesContainingKeyword;
bool isStopParsingKeywordDetected = false;
const QString includeStatementAbsolutePathPrefix;
RifEclipseInputFileTools::readKeywordAndParseIncludeStatementsRecursively( keyword,
keywordToStopParsing,
data,
startPositionInFile,
pathAliasDefinitions,
&keywordContent,
&fileNamesContainingKeyword,
&isStopParsingKeywordDetected,
includeStatementAbsolutePathPrefix );
// EXPECT_TRUE( isStopParsingKeywordDetected );
// EXPECT_TRUE( keywordContent.isEmpty() );
}
}

View File

@@ -0,0 +1,325 @@
#include "gtest/gtest.h"
#include "RifEclipseSummaryAddress.h"
#include <QString>
#include <string>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Field )
{
std::string addrString = "FOPT";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_FIELD, addr.category() );
EXPECT_EQ( "FOPT", addr.quantityName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Aquifer )
{
std::string addrString = "AAQR:456";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() );
EXPECT_EQ( "AAQR", addr.quantityName() );
EXPECT_EQ( 456, addr.aquiferNumber() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Network )
{
std::string addrString = "NETW";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_NETWORK, addr.category() );
EXPECT_EQ( "NETW", addr.quantityName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, DISABLED_TestEclipseAddressParsing_Misc )
{
std::string addrString = "CPU";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_MISC, addr.category() );
EXPECT_EQ( "CPU", addr.quantityName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Region )
{
std::string addrString = "RPR:7081";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION, addr.category() );
EXPECT_EQ( "RPR", addr.quantityName() );
EXPECT_EQ( 7081, addr.regionNumber() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_RegionToRegion )
{
std::string addrString = "ROFR:7081-8001";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, addr.category() );
EXPECT_EQ( "ROFR", addr.quantityName() );
EXPECT_EQ( 7081, addr.regionNumber() );
EXPECT_EQ( 8001, addr.regionNumber2() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellGroup )
{
std::string addrString = "GOPR:WELLS1";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, addr.category() );
EXPECT_EQ( "GOPR", addr.quantityName() );
EXPECT_EQ( "WELLS1", addr.wellGroupName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Well )
{
std::string addrString = "WOPR:B-2H";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL, addr.category() );
EXPECT_EQ( "WOPR", addr.quantityName() );
EXPECT_EQ( "B-2H", addr.wellName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletion )
{
std::string addrString = "COFRL:B-1H:15,13,14";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, addr.category() );
EXPECT_EQ( "COFRL", addr.quantityName() );
EXPECT_EQ( "B-1H", addr.wellName() );
EXPECT_EQ( 15, addr.cellI() );
EXPECT_EQ( 13, addr.cellJ() );
EXPECT_EQ( 14, addr.cellK() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellLgr )
{
std::string addrString = "LWABC:LGRNA:B-10H";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_LGR, addr.category() );
EXPECT_EQ( "LWABC", addr.quantityName() );
EXPECT_EQ( "LGRNA", addr.lgrName() );
EXPECT_EQ( "B-10H", addr.wellName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletionLgr )
{
std::string addrString = "LCGAS:LGR1:B-1H:11,12,13";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() );
EXPECT_EQ( "LCGAS", addr.quantityName() );
EXPECT_EQ( "LGR1", addr.lgrName() );
EXPECT_EQ( "B-1H", addr.wellName() );
EXPECT_EQ( 11, addr.cellI() );
EXPECT_EQ( 12, addr.cellJ() );
EXPECT_EQ( 13, addr.cellK() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellSegment )
{
std::string addrString = "SOFR:B-5H:32";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, addr.category() );
EXPECT_EQ( "SOFR", addr.quantityName() );
EXPECT_EQ( "B-5H", addr.wellName() );
EXPECT_EQ( 32, addr.wellSegmentNumber() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Block )
{
std::string addrString = "BPR:123,122,121";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK, addr.category() );
EXPECT_EQ( "BPR", addr.quantityName() );
EXPECT_EQ( 123, addr.cellI() );
EXPECT_EQ( 122, addr.cellJ() );
EXPECT_EQ( 121, addr.cellK() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_BlockLgr )
{
std::string addrString = "LBABC:LGRN:45,47,49";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, addr.category() );
EXPECT_EQ( "LBABC", addr.quantityName() );
EXPECT_EQ( "LGRN", addr.lgrName() );
EXPECT_EQ( 45, addr.cellI() );
EXPECT_EQ( 47, addr.cellJ() );
EXPECT_EQ( 49, addr.cellK() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Imported )
{
std::string addrString = "FAULT (Imp)";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() );
EXPECT_EQ( "FAULT (Imp)", addr.quantityName() );
EXPECT_FALSE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult1 )
{
std::string addrString = "ER:AAQR:456";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() );
EXPECT_EQ( "AAQR", addr.quantityName() );
EXPECT_EQ( 456, addr.aquiferNumber() );
EXPECT_TRUE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult2 )
{
std::string addrString = "ERR:LCGAS:LGR1:B-1H:11,12,13";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() );
EXPECT_EQ( "LCGAS", addr.quantityName() );
EXPECT_EQ( "LGR1", addr.lgrName() );
EXPECT_EQ( "B-1H", addr.wellName() );
EXPECT_EQ( 11, addr.cellI() );
EXPECT_EQ( 12, addr.cellJ() );
EXPECT_EQ( 13, addr.cellK() );
EXPECT_TRUE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult3 )
{
std::string addrString = "ERROR:FAULT (Imp)";
RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddress( addrString );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() );
EXPECT_EQ( "FAULT (Imp)", addr.quantityName() );
EXPECT_TRUE( addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressIjkParsing )
{
RifEclipseSummaryAddress::SummaryVarCategory cat = RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION;
std::map<RifEclipseSummaryAddress::SummaryIdentifierType, std::string> identifiers( {
{ RifEclipseSummaryAddress::INPUT_WELL_NAME, "1-BH" },
{ RifEclipseSummaryAddress::INPUT_CELL_IJK, "6, 7, 8" },
{ RifEclipseSummaryAddress::INPUT_VECTOR_NAME, "WOPR" },
} );
RifEclipseSummaryAddress addr( cat, identifiers );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, addr.category() );
EXPECT_EQ( "WOPR", addr.quantityName() );
EXPECT_EQ( "1-BH", addr.wellName() );
EXPECT_EQ( 6, addr.cellI() );
EXPECT_EQ( 7, addr.cellJ() );
EXPECT_EQ( 8, addr.cellK() );
EXPECT_TRUE( !addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestEclipseAddressRegToRegParsing )
{
RifEclipseSummaryAddress::SummaryVarCategory cat = RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION;
std::map<RifEclipseSummaryAddress::SummaryIdentifierType, std::string> identifiers( {
{ RifEclipseSummaryAddress::INPUT_REGION_2_REGION, "123 - 456" },
{ RifEclipseSummaryAddress::INPUT_VECTOR_NAME, "ROFR" },
} );
RifEclipseSummaryAddress addr( cat, identifiers );
EXPECT_TRUE( addr.isValid() );
EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, addr.category() );
EXPECT_EQ( "ROFR", addr.quantityName() );
EXPECT_EQ( 123, addr.regionNumber() );
EXPECT_EQ( 456, addr.regionNumber2() );
EXPECT_TRUE( !addr.isErrorResult() );
}
TEST( RifEclipseSummaryAddressTest, TestQuantityNameManipulations )
{
{
auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPT" );
EXPECT_EQ( "FOPT", s.toStdString() );
}
{
auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPT_1" );
EXPECT_EQ( "FOPT", s.toStdString() );
}
{
auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPR" );
EXPECT_EQ( "FOPR", s.toStdString() );
}
{
auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPR_1" );
EXPECT_EQ( "FOPR", s.toStdString() );
}
{
// https://github.com/OPM/ResInsight/issues/6481
auto s = RifEclipseSummaryAddress::baseQuantityName( "FCMIT_1" );
EXPECT_EQ( "FCMIT", s.toStdString() );
}
}

View File

@@ -0,0 +1,273 @@
#include "gtest/gtest.h"
#include "RifEclipseUserDataKeywordTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, TestIdentifierItemsPerLine )
{
{
std::string s = "AA";
EXPECT_EQ( size_t( 0 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s ).size() );
}
{
std::string s = "BB";
EXPECT_EQ( size_t( 3 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
}
{
std::string s = "CC";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
EXPECT_EQ( size_t( 3 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[1] );
}
{
std::string s = "FF";
EXPECT_EQ( size_t( 0 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s ).size() );
}
{
std::string s = "GG";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
}
{
std::string s = "NN";
EXPECT_EQ( size_t( 0 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s ).size() );
}
{
std::string s = "RR";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
}
{
std::string s = "SS";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[1] );
}
{
std::string s = "WW";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
}
{
std::string s = "LB";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
EXPECT_EQ( size_t( 3 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[1] );
}
{
std::string s = "LC";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[1] );
EXPECT_EQ( size_t( 3 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[2] );
}
{
std::string s = "LW";
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[0] );
EXPECT_EQ( size_t( 1 ), RifEclipseUserDataKeywordTools::requiredItemsPerLineForKeyword( s )[1] );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, BuildTableHeaderText )
{
std::vector<std::string> keywordNames = { "TIME", "YEARX", "WGT1", "WR42" };
std::vector<std::string> firstheader = { "OP-1", "OP-1" };
std::vector<std::vector<std::string>> headerLines = { firstheader };
auto tableHeaderData = RifEclipseUserDataKeywordTools::buildColumnHeaderText( keywordNames, headerLines );
EXPECT_EQ( size_t( 4 ), tableHeaderData.size() );
EXPECT_EQ( size_t( 1 ), tableHeaderData[0].size() );
EXPECT_EQ( size_t( 1 ), tableHeaderData[1].size() );
EXPECT_EQ( size_t( 2 ), tableHeaderData[2].size() );
EXPECT_EQ( size_t( 2 ), tableHeaderData[3].size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, BuildTableHeaderTextComplex )
{
std::vector<std::string> keywordNames = { "TIME", "WGT1", "FVIR", "RPR", "GOPR", "CWIR", "FTPTS36", "CWIR" };
std::vector<std::string> firstheader = { "OP-1", "8", "MANI-D2", "F-2H", "2H" };
std::vector<std::string> secondHeader = { "18", "83", "3", "9", "8", "7" };
std::vector<std::vector<std::string>> headerLines = { firstheader, secondHeader };
auto tableHeaderData = RifEclipseUserDataKeywordTools::buildColumnHeaderText( keywordNames, headerLines );
EXPECT_EQ( size_t( 8 ), tableHeaderData.size() );
EXPECT_EQ( size_t( 1 ), tableHeaderData[0].size() );
EXPECT_EQ( size_t( 2 ), tableHeaderData[1].size() );
EXPECT_EQ( size_t( 1 ), tableHeaderData[2].size() );
EXPECT_EQ( size_t( 2 ), tableHeaderData[3].size() );
EXPECT_EQ( size_t( 2 ), tableHeaderData[4].size() );
EXPECT_EQ( size_t( 5 ), tableHeaderData[5].size() );
EXPECT_EQ( size_t( 1 ), tableHeaderData[6].size() );
EXPECT_EQ( size_t( 5 ), tableHeaderData[7].size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, MissingHeaderData )
{
{
std::vector<std::string> keywordNames = { "TIME", "WGT1" };
std::vector<std::string> firstheader = {}; // Missing well name
std::vector<std::vector<std::string>> headerLines = { firstheader };
auto tableHeaderData = RifEclipseUserDataKeywordTools::buildColumnHeaderText( keywordNames, headerLines );
EXPECT_EQ( size_t( 0 ), tableHeaderData.size() );
}
{
std::vector<std::string> keywordNames = { "TIME", "WGT1", "FVIR", "RPR", "GOPR", "CWIR", "FTPTS36", "CWIR" };
std::vector<std::string> firstheader = { "OP-1", "8", "MANI-D2", "F-2H", "2H" };
std::vector<std::string> secondHeader = { "18", "83", "3", "9", "8" }; // Missing value from last triplet
std::vector<std::vector<std::string>> headerLines = { firstheader, secondHeader };
auto tableHeaderData = RifEclipseUserDataKeywordTools::buildColumnHeaderText( keywordNames, headerLines );
EXPECT_EQ( size_t( 0 ), tableHeaderData.size() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, CreationOfSummaryAddresses )
{
// Region
{
std::string quantity = "RGT1";
std::vector<std::string> columnData = { "1" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_REGION );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_EQ( 1, address.regionNumber() );
}
// Well group
{
std::string quantity = "GT1";
std::vector<std::string> columnData = { "OP-1" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_GROUP );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellGroupName().data() );
}
// Well
{
std::string quantity = "WGT1";
std::vector<std::string> columnData = { "OP-1" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellName().data() );
}
// Well completion
{
std::string quantity = "CWIT";
std::vector<std::string> columnData = { "F-3H", "1", "2", "3" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellName().data() );
EXPECT_EQ( 1, address.cellI() );
EXPECT_EQ( 2, address.cellJ() );
EXPECT_EQ( 3, address.cellK() );
}
// Well LGR
{
std::string quantity = "LWGT1";
std::vector<std::string> columnData = { "OP-1", "LGR-NAME" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_LGR );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellName().data() );
EXPECT_STREQ( columnData[1].data(), address.lgrName().data() );
}
// Well completion LGR
{
std::string quantity = "LC";
std::vector<std::string> columnData = { "F-3H", "LGR-NAME", "1", "2", "3" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellName().data() );
EXPECT_STREQ( columnData[1].data(), address.lgrName().data() );
EXPECT_EQ( 1, address.cellI() );
EXPECT_EQ( 2, address.cellJ() );
EXPECT_EQ( 3, address.cellK() );
}
// Well segment
{
std::string quantity = "SCWIT";
std::vector<std::string> columnData = { "F-3H", "1" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.wellName().data() );
EXPECT_EQ( 1, address.wellSegmentNumber() );
}
// Block
{
std::string quantity = "BWIT";
std::vector<std::string> columnData = { "1", "2", "3" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_BLOCK );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_EQ( 1, address.cellI() );
EXPECT_EQ( 2, address.cellJ() );
EXPECT_EQ( 3, address.cellK() );
}
// Block LGR
{
std::string quantity = "LBWIT";
std::vector<std::string> columnData = { "LGR-name", "1", "2", "3" };
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
EXPECT_STREQ( columnData[0].data(), address.lgrName().data() );
EXPECT_EQ( 1, address.cellI() );
EXPECT_EQ( 2, address.cellJ() );
EXPECT_EQ( 3, address.cellK() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseUserDataKeywordToolsTest, CreationOfMisc )
{
// Misc
{
std::string quantity = "JI-NOT-REQOGNIZED";
std::vector<std::string> columnData = {};
auto address = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnData );
EXPECT_EQ( address.category(), RifEclipseSummaryAddress::SUMMARY_MISC );
EXPECT_STREQ( quantity.data(), address.quantityName().data() );
}
}

View File

@@ -0,0 +1,265 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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 "RifElasticPropertiesReader.h"
#include "RifFileParseTools.h"
#include <QStringList>
#include <QTemporaryFile>
#include <QTextStream>
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadCorrectInputFile )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.4\n"
<< "Norne,Not,Sand,0.10,19,0.27,2099,0.3,0.4,0.5,0.2,0.5,0.55\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifElasticProperties> elasticProperties;
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths );
ASSERT_EQ( 2u, elasticProperties.size() );
ASSERT_EQ( "Norne", elasticProperties[0].fieldName.toStdString() );
ASSERT_EQ( "Norne", elasticProperties[1].fieldName.toStdString() );
ASSERT_EQ( "Not", elasticProperties[0].formationName.toStdString() );
ASSERT_EQ( "Not", elasticProperties[1].formationName.toStdString() );
ASSERT_EQ( "Sand", elasticProperties[0].faciesName.toStdString() );
ASSERT_EQ( "Sand", elasticProperties[1].faciesName.toStdString() );
ASSERT_DOUBLE_EQ( 0.0, elasticProperties[0].porosity );
ASSERT_DOUBLE_EQ( 0.1, elasticProperties[1].porosity );
ASSERT_DOUBLE_EQ( 25.0, elasticProperties[0].youngsModulus );
ASSERT_DOUBLE_EQ( 19.0, elasticProperties[1].youngsModulus );
ASSERT_DOUBLE_EQ( 0.25, elasticProperties[0].poissonsRatio );
ASSERT_DOUBLE_EQ( 0.27, elasticProperties[1].poissonsRatio );
ASSERT_DOUBLE_EQ( 2000.0, elasticProperties[0].K_Ic );
ASSERT_DOUBLE_EQ( 2099.0, elasticProperties[1].K_Ic );
ASSERT_DOUBLE_EQ( 0.2, elasticProperties[0].proppantEmbedment );
ASSERT_DOUBLE_EQ( 0.3, elasticProperties[1].proppantEmbedment );
ASSERT_DOUBLE_EQ( 0.4, elasticProperties[0].immobileFluidSaturation );
ASSERT_DOUBLE_EQ( 0.55, elasticProperties[1].immobileFluidSaturation );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadCorrectInputFileWithTrailingSeparator )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.4,\n"
<< "Norne,Not,Sand,0.10,19,0.27,2099,0.3,0.4,0.5,0.2,0.5,0.55,\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifElasticProperties> elasticProperties;
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths );
ASSERT_EQ( 2u, elasticProperties.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadCorrectInputFileWithCustomSeparator )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne;Not;Sand;0.00;25;0.25;2000;0.2;0.3;0.4;0.5;0.6;0.4;\n"
<< "Norne;Not;Sand;0.10;19;0.27;2099;0.3;0.4;0.5;0.2;0.5;0.55;\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifElasticProperties> elasticProperties;
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths, ";" );
ASSERT_EQ( 2u, elasticProperties.size() );
}
//--------------------------------------------------------------------------------------------------
/// Helper to check exception messages when reading invalid files
//--------------------------------------------------------------------------------------------------
::testing::AssertionResult readingElasticPropertiesThrowsException( const QStringList& filePaths,
const QString& expectedMessage )
{
std::vector<RifElasticProperties> elasticProperties;
try
{
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths );
// No exception thrown: fail!
return ::testing::AssertionFailure() << "readElasticProperties did not throw exception";
}
catch ( FileParseException& error )
{
// Should always have cleaned up on failure
EXPECT_EQ( 0u, elasticProperties.size() );
// Check that we get the expected message
EXPECT_EQ( expectedMessage.toStdString(), error.message.toStdString() );
return ::testing::AssertionSuccess();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadMissingFileThrows )
{
QStringList filePaths;
QString nonExistingFile( "this/is/a/file/which/does/not/exist.csv" );
filePaths.append( nonExistingFile );
ASSERT_TRUE( readingElasticPropertiesThrowsException( filePaths,
QString( "Unable to open file: %1" ).arg( nonExistingFile ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadShortLinesFileThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.7\n"
<< "Norne,Not,Sand,0.10,19,0.27\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE(
readingElasticPropertiesThrowsException( filePaths,
QString( "Incomplete data on line 2: %1" ).arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadEmptyFieldNameThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.89\n"
<< ",Not,Sand,0.10,19,0.27,2099,0.3,0.3,0.4,0.5,0.6,0.89\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingElasticPropertiesThrowsException( filePaths,
QString( "Unexpected empty 'Field Name' on line 2: %1" )
.arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, ReadInvalidMeasureDepthThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.9\n"
<< "Norne,Not,Sand, not a number,23.4,0.27,2099,0.3,0.3,0.4,0.5,0.6,0.77\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingElasticPropertiesThrowsException( filePaths,
QString( "Invalid number for 'Porosity' on line 2: %1" )
.arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifElasticPropertiesReaderTest, CommentsAndEmptyLinesAreIgnored )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
// Comment should be ignored
out << "# This is a comment.\n";
out << "#This is also a comment.\n";
out << " # This is also a comment which does not start on first character.\n";
// Should skip empty lines
out << "\n";
out << "\t\n";
out << " \n";
// Then some data
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.7\n";
// Comment in-between data should be ignored
out << "# One more comment in-between the data\n";
out << "Norne,Not,Silt,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.7\n";
// Empty line in-between data should be ignored
out << "\n";
// Data with comment sign inside it is not ignored
out << "Norne,Not,Shale,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.8\n";
// Trailing empty lines should be ignored
out << "\n\n\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifElasticProperties> elasticProperties;
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths );
ASSERT_EQ( 3u, elasticProperties.size() );
ASSERT_EQ( "Sand", elasticProperties[0].faciesName.toStdString() );
ASSERT_EQ( "Silt", elasticProperties[1].faciesName.toStdString() );
ASSERT_EQ( "Shale", elasticProperties[2].faciesName.toStdString() );
}

View File

@@ -0,0 +1,119 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifElementPropertyTableReader.h"
#include "RifFileParseTools.h"
#include <QString>
#include <numeric>
static const QString ELEM_PROP_TEST_DATA_DIRECTORY = QString( "%1/RifElementPropertyTableReader/" ).arg( TEST_DATA_DIR );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, BasicUsage )
{
RifElementPropertyMetadata metadata =
RifElementPropertyTableReader::readMetadata( ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( table.hasData );
EXPECT_EQ( 2u, metadata.dataColumns.size() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[0].toStdString().c_str() );
EXPECT_STREQ( "RATIO", metadata.dataColumns[1].toStdString().c_str() );
EXPECT_EQ( 2u, table.data.size() );
EXPECT_EQ( 4320u, table.elementIds.size() );
EXPECT_EQ( 4320u, table.data[0].size() );
EXPECT_EQ( 4320u, table.data[1].size() );
EXPECT_FLOAT_EQ( 11198814808.2538f, table.data[0].front() );
EXPECT_FLOAT_EQ( 13250853676.3636f, table.data[0].back() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, ParseFailedForTooManyColumns )
{
try
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(
ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error_too_many_columns.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( false );
}
catch ( FileParseException e )
{
EXPECT_TRUE( e.message.startsWith( "Number of columns mismatch" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, ParseFailedForTooFewColumns )
{
try
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(
ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error_too_few_columns.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( false );
}
catch ( FileParseException e )
{
EXPECT_TRUE( e.message.startsWith( "Number of columns mismatch" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, MoreThanEightColumns )
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(
ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_morethan8columns.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( table.hasData );
EXPECT_EQ( 9u, metadata.dataColumns.size() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[0].toStdString().c_str() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[1].toStdString().c_str() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[2].toStdString().c_str() );
EXPECT_STREQ( "RATIO", metadata.dataColumns[3].toStdString().c_str() );
EXPECT_STREQ( "RATIO", metadata.dataColumns[4].toStdString().c_str() );
EXPECT_STREQ( "RATIO", metadata.dataColumns[5].toStdString().c_str() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[6].toStdString().c_str() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[7].toStdString().c_str() );
EXPECT_STREQ( "MODULUS", metadata.dataColumns[8].toStdString().c_str() );
EXPECT_EQ( 9u, table.data.size() );
EXPECT_EQ( 8u, table.elementIds.size() );
EXPECT_EQ( 8u, table.data[0].size() );
EXPECT_EQ( 8u, table.data[1].size() );
EXPECT_EQ( 8u, table.data[2].size() );
EXPECT_EQ( 8u, table.data[3].size() );
EXPECT_EQ( 8u, table.data[4].size() );
EXPECT_EQ( 8u, table.data[5].size() );
EXPECT_EQ( 8u, table.data[6].size() );
EXPECT_EQ( 8u, table.data[7].size() );
EXPECT_EQ( 8u, table.data[8].size() );
EXPECT_FLOAT_EQ( 4998669605.36f, table.data[0].front() );
EXPECT_FLOAT_EQ( 4998444377.89f, table.data[0].back() );
}

View File

@@ -0,0 +1,22 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifPerforationIntervalReader.h"
#include <cmath> // Needed for HUGE_VAL on Linux
#include <numeric>
static const QString PERFORATION_TEST_DATA_DIRECTORY = QString( "%1/RifPerforationIntervalReader/" ).arg( TEST_DATA_DIR );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifPerforationIntervalReaderTest, SpacesInWellNameHandledSuccessfully )
{
std::map<QString, std::vector<RifPerforationInterval>> perforationIntervals =
RifPerforationIntervalReader::readPerforationIntervals( PERFORATION_TEST_DATA_DIRECTORY +
"perforations_with_space_after_well_name.ev" );
EXPECT_EQ( size_t( 10 ), perforationIntervals["A1_RI_HZX"].size() );
}

View File

@@ -0,0 +1,582 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "RigEclipseCaseData.h"
#include "ert/ecl/ecl_kw_magic.h"
#include <ert/ecl/ecl_file.h>
#include "RiaStringEncodingTools.h"
#include "RiaTestDataDirectory.h"
#include "RifEclipseOutputFileTools.h"
#include "RifEclipseUnifiedRestartFileAccess.h"
#include "RifReaderEclipseOutput.h"
#include "RifReaderSettings.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RimEclipseResultCase.h"
#include <QDebug>
#include <QDir>
#include <memory>
using namespace RiaDefines;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigReservoirTest, BasicTest10k )
{
QDir baseFolder( TEST_MODEL_DIR );
bool subFolderExists = baseFolder.cd( "TEST10K_FLT_LGR_NNC" );
EXPECT_TRUE( subFolderExists );
QString filename( "TEST10K_FLT_LGR_NNC.EGRID" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
std::unique_ptr<RimEclipseResultCase> resultCase( new RimEclipseResultCase );
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData( resultCase.get() );
{
RigCaseCellResultsData* cellData = reservoir->results( PorosityModelType::MATRIX_MODEL );
QStringList staticResults = cellData->resultNames( ResultCatType::STATIC_NATIVE );
EXPECT_EQ( 0, staticResults.size() );
// qDebug() << "Static results\n" << staticResults;
QStringList dynamicResults = cellData->resultNames( ResultCatType::DYNAMIC_NATIVE );
EXPECT_EQ( 0, dynamicResults.size() );
// qDebug() << "Dynamic results\n" << dynamicResults;
int numTimeSteps = static_cast<int>( cellData->maxTimeStepCount() );
EXPECT_EQ( 0, numTimeSteps );
}
{
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
bool result = readerInterfaceEcl->open( filePath, reservoir.p() );
EXPECT_TRUE( result );
int numTimeSteps = static_cast<int>( readerInterfaceEcl->allTimeSteps().size() );
EXPECT_EQ( 9, numTimeSteps );
}
{
RigCaseCellResultsData* cellData = reservoir->results( PorosityModelType::MATRIX_MODEL );
QStringList staticResults = cellData->resultNames( ResultCatType::STATIC_NATIVE );
EXPECT_EQ( 44, staticResults.size() );
// qDebug() << "Static results\n" << staticResults;
QStringList dynamicResults = cellData->resultNames( ResultCatType::DYNAMIC_NATIVE );
EXPECT_EQ( 23, dynamicResults.size() );
// qDebug() << "Dynamic results\n" << dynamicResults;
int numTimeSteps = static_cast<int>( cellData->maxTimeStepCount() );
EXPECT_EQ( 9, numTimeSteps );
}
}
TEST( RigReservoirTest, BasicTest10kRestart )
{
RifEclipseUnifiedRestartFileAccess unrstAccess;
QDir baseFolder( TEST_MODEL_DIR );
bool subFolderExists = baseFolder.cd( "TEST10K_FLT_LGR_NNC" );
EXPECT_TRUE( subFolderExists );
QString filename( "TEST10K_FLT_LGR_NNC.UNRST" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
QStringList filenames;
filenames << filePath;
unrstAccess.setRestartFiles( filenames );
QStringList resultNames;
std::vector<size_t> dataItemCount;
unrstAccess.resultNames( &resultNames, &dataItemCount );
EXPECT_EQ( resultNames.size(), (int)dataItemCount.size() );
EXPECT_EQ( 83, resultNames.size() );
/* for (int i = 0; i < resultNames.size(); i++)
{
qDebug() << resultNames[i] << "\t" << dataItemCount[i];
} */
auto reportNums = unrstAccess.reportNumbers();
EXPECT_EQ( (size_t)9, reportNums.size() );
/* for (auto reportNum : reportNums)
{
qDebug() << reportNum;
} */
}
TEST( RigReservoirTest, BasicTest10k_NativeECL )
{
QDir baseFolder( TEST_MODEL_DIR );
bool subFolderExists = baseFolder.cd( "TEST10K_FLT_LGR_NNC" );
EXPECT_TRUE( subFolderExists );
QString filename( "TEST10K_FLT_LGR_NNC.EGRID" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
ecl_grid_type* grid = ecl_grid_alloc( RiaStringEncodingTools::toNativeEncoded( filePath ).data() );
EXPECT_TRUE( grid );
QString subDir( "RifReaderEclipseOutput" );
QDir dataDir( TEST_DATA_DIR );
dataDir.mkdir( subDir );
dataDir.cd( subDir );
QString outFilePath = dataDir.absoluteFilePath( "TEST10K_FLT_LGR_NNC_OUT.GRDECL" );
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4996 )
#endif
FILE* filePtr = fopen( RiaStringEncodingTools::toNativeEncoded( outFilePath ).data(), "w" );
EXPECT_TRUE( filePtr != nullptr );
ecl_grid_fprintf_grdecl( grid, filePtr );
fclose( filePtr );
EXPECT_TRUE( QFile::exists( outFilePath ) );
#ifdef _WIN32
QString expectedMd5( QByteArray::fromHex( "e993b85140568f13f4c3849604700a0f" ) );
#else
QString expectedMd5( QByteArray::fromHex( "274e44fe51299c1f9ca6645c384e237d" ) );
#endif
QByteArray generatedMd5 = RifEclipseOutputFileTools::md5sum( outFilePath );
// Enable to produce text string so expectedMd5 can be updated
// Qt4 doesn't take a parameter for toHex()
// qDebug() << expectedMd5.toLatin1().toHex(0) << " " << generatedMd5.toHex(0);
EXPECT_TRUE( generatedMd5 == expectedMd5 );
#ifdef _MSC_VER
#pragma warning( pop )
#endif
}
TEST( RigReservoirTest, Test10k_ReadThenWriteToECL )
{
QDir baseFolder( TEST_MODEL_DIR );
bool subFolderExists = baseFolder.cd( "TEST10K_FLT_LGR_NNC" );
EXPECT_TRUE( subFolderExists );
QString filename( "TEST10K_FLT_LGR_NNC.EGRID" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
std::unique_ptr<RimEclipseResultCase> resultCase( new RimEclipseResultCase );
resultCase->setGridFileName( filePath );
resultCase->importGridAndResultMetaData( false );
QString subDir( "RifReaderEclipseOutput" );
QDir dataDir( TEST_DATA_DIR );
dataDir.mkdir( subDir );
dataDir.cd( subDir );
QString outFilePath = dataDir.absoluteFilePath( "TEST10K_FLT_LGR_NNC_OUT_FROM_RES.GRDECL" );
/* bool worked = RifReaderEclipseOutput::saveEclipseGrid(outFilePath, resultCase->eclipseCaseData());
EXPECT_TRUE(worked);
EXPECT_TRUE(QFile::exists(outFilePath));
QString dataFilePath = dataDir.absoluteFilePath("TEST10K_FLT_LGR_NNC_OUT_FROM_RES.VARS");
QStringList allStaticResults =
resultCase->eclipseCaseData()->results(MATRIX_MODEL)->resultNames(RiaDefines::STATIC_NATIVE);
std::vector<QString> keywords;
for (QString keyword : allStaticResults)
{
keywords.push_back(keyword);
}
worked = RifReaderEclipseOutput::saveEclipseResults(dataFilePath, resultCase->eclipseCaseData(), keywords);
EXPECT_TRUE(worked);
EXPECT_TRUE(QFile::exists(dataFilePath)); */
}
#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 = nullptr;
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, RiaDefines::PorosityModelType porosityModel, RiaDefines::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(), RiaDefines::MATRIX_MODEL, RiaDefines::DYNAMIC_NATIVE);
qDebug() << "\n\n" <<
"Matrix porosities, STATIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RiaDefines::MATRIX_MODEL, RiaDefines::STATIC_NATIVE);
qDebug() << "\n\n" <<
"Fracture porosities, DYNAMIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::DYNAMIC_NATIVE);
qDebug() << "\n\n" <<
"Fracture porosities, STATIC results" <<
"----------------------------------";
buildResultInfoString(reservoir.p(), RiaDefines::FRACTURE_MODEL, RiaDefines::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<RigEclipseCaseData> reservoir = new RigEclipseCaseData;
// 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
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RigReservoirTest, WellTest )
{
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData( nullptr );
// 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/soursim/PKMUNK_NOV_TEST_SS.GRID" );
QString sourSim( "d:/Models/Statoil/soursim/result.sourres.00001" );
#else
QString filename( "/mnt/hgfs/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.EGRID" );
QString sourSim( "d:/Models/Statoil/soursim/result.sourres" );
#endif
bool result = readerInterfaceEcl->open( filename, reservoir.p() );
EXPECT_TRUE( result );
readerInterfaceEcl->setHdf5FileName( sourSim );
}

View File

@@ -0,0 +1,760 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 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 "RiaTestDataDirectory.h"
#include "RifEclipseSummaryTools.h"
#include "RifReaderEclipseSummary.h"
#include <QDateTime>
#include <QDir>
#include <memory>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifEclipseSummaryTest, BasicTestSetCurrentFolder )
{
RifReaderEclipseSummary eclSummary;
static const QString testDataRootFolder = QString( "%1/SummaryData/Reek/" ).arg( TEST_DATA_DIR );
QString summaryFileName = testDataRootFolder + "3_R001_REEK-1.SMSPEC";
bool hasWarning = false;
std::vector<RifRestartFileInfo> originFileInfos = eclSummary.getRestartFiles( summaryFileName, &hasWarning );
EXPECT_TRUE( originFileInfos.empty() );
}
/*
void printDateAndValues(const std::vector<QDateTime>& dates, const std::vector<double>& values)
{
EXPECT_TRUE(dates.size() == values.size());
for (size_t i = 0; i < values.size(); i++)
{
std::string dateStr = dates[i].toString("dd/MMM/yyyy").toStdString();
std::cout << dateStr << " " << values[i] << std::endl;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, SummaryToolsFindSummaryFiles)
{
{
// std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010";
std::string filename = "g:\\Models\\Statoil\\testcase_juli_2011\\data\\TEST10K_FLT_LGR_NNC";
{
std::string headerFile;
bool isFormatted = false;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFile, &isFormatted);
EXPECT_FALSE(isFormatted);
EXPECT_FALSE(headerFile.empty());
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(filename);
EXPECT_TRUE(dataFiles.size() > 0);
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
// Create a vector of summary addresses based on type, item name and variable name, and compare the
resulting
// resultAddressString to the original string
std::vector<RifEclipseSummaryAddress> addresses = eclSummary->allResultAddresses();
std::vector<RifEclipseSummaryAddress> myAddresses;
for (size_t i = 0; i < addresses.size(); i++)
{
RifEclipseSummaryAddress adr(addresses[i].category(), addresses[i].simulationItemName(),
addresses[i].quantityName()); myAddresses.push_back(adr);
}
for (size_t i = 0; i < addresses.size(); i++)
{
EXPECT_TRUE(addresses[i].ertSummaryVarId().compare(myAddresses[i].ertSummaryVarId()) == 0);
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, SummaryToolsFindSummaryFiles)
{
{
std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010";
{
std::string headerFile;
bool isFormatted = false;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFile, &isFormatted);
EXPECT_FALSE(isFormatted);
EXPECT_FALSE(headerFile.empty());
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(filename);
EXPECT_TRUE(dataFiles.size() > 0);
}
}
{
std::string filename = "g:\\Models\\Statoil\\testcase_juli_2011\\data\\TEST10K_FLT_LGR_NNC";
{
std::string headerFile;
bool isFormatted = false;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFile, &isFormatted);
EXPECT_FALSE(isFormatted);
EXPECT_FALSE(headerFile.empty());
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(filename);
EXPECT_TRUE(dataFiles.size() > 0);
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
}
}
{
// MSJ TODO: Formatted output does not work now, should be reported?
/ *
std::string filename = "g:\\Models\\Statoil\\Brillig\\BRILLIG_FMTOUT";
{
std::string headerFile;
bool isFormatted = false;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFile, &isFormatted);
EXPECT_FALSE(isFormatted);
EXPECT_FALSE(headerFile.empty());
std::vector<std::string> dataFiles = RifEclipseSummaryTools::findSummaryDataFiles(filename);
EXPECT_TRUE(dataFiles.size() > 0);
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary); eclSummary->open(headerFile, dataFiles);
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
}
* /
}
/ *
{
std::string path;
std::string base;
bool isFormatted = false;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &path, &base, &isFormatted);
}
* /
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, BasicReadKeywordTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary);
std::string filename = "g:\\Models\\Statoil\\testcase_juli_2011\\data\\TEST10K_FLT_LGR_NNC";
std::string headerFileName;
RifEclipseSummaryTools::findSummaryHeaderFile(filename, &headerFileName, NULL);
std::vector<std::string> dataFileNames = RifEclipseSummaryTools::findSummaryDataFiles(filename);
eclSummary->open(headerFileName, dataFileNames);
RifEclipseSummaryTools::dumpMetaData(eclSummary.get());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, DISABLE_BasicReadKeywordTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary);
std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.SMSPEC";
std::vector<std::string> dataFileNames;
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0001");
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0002");
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0003");
eclSummary->open(filename, dataFileNames);
std::cout << " -- Well names --" << std::endl;
{
std::vector<std::string> names = eclSummary->wellNames();
for (size_t i = 0; i < names.size(); i++)
{
std::cout << names[i] << std::endl;
}
}
std::cout << " -- Well variable names --" << std::endl;
{
std::vector<std::string> names = eclSummary->wellVariableNames();
for (size_t i = 0; i < names.size(); i++)
{
std::cout << names[i] << std::endl;
}
}
std::cout << " -- Group names --" << std::endl;
{
std::vector<std::string> names = eclSummary->wellGroupNames();
for (size_t i = 0; i < names.size(); i++)
{
std::cout << names[i] << std::endl;
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, BasicReadDataTest)
{
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary);
std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.SMSPEC";
std::vector<std::string> dataFileNames;
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0001");
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0012");
dataFileNames.push_back("g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010.S0023");
eclSummary->open(filename, dataFileNames);
std::vector<QDateTime> dateTimes;
{
std::vector<time_t> times = eclSummary->timeSteps();
dateTimes = RifReaderEclipseSummary::fromTimeT(times);
}
{
std::string keyword = "YEARS";
std::cout << std::endl << keyword << std::endl;
std::vector<double> values;
eclSummary->values(keyword, &values);
printDateAndValues(dateTimes, values);
}
{
std::string keyword = "WWPR:P20";
std::cout << std::endl << keyword << std::endl;
std::vector<double> values;
eclSummary->values(keyword, &values);
printDateAndValues(dateTimes, values);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, DISABLED_StringlistSelectMatchingFiles)
{
std::string currentFolderName = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10";
//QDir::setCurrent(currentFolderName);
//std::string filename = "";
//std::string filepattern = "BRUGGE_0010.S[0-9][0-9][0-9][0-9]";
std::string filepattern = "BRUGGE_0010.S*";
//std::string filepattern = "*";
stringlist_type* names = stringlist_alloc_new();
stringlist_select_matching_files(names, currentFolderName.data(), filepattern.data());
for (int i = 0; i < stringlist_get_size(names); i++)
{
std::cout << stringlist_iget(names, i) << std::endl;
}
stringlist_free(names);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, DISABLED_StringlistSelectMatchingFilesQuestion)
{
std::string currentFolderName = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10";
std::string filepattern = "BRUGGE_0010.S????";
stringlist_type* names = stringlist_alloc_new();
stringlist_select_matching_files(names, currentFolderName.data(), filepattern.data());
for (int i = 0; i < stringlist_get_size(names); i++)
{
std::cout << stringlist_iget(names, i) << std::endl;
}
stringlist_free(names);
}
/ *
WBHP:I01-01
WBHP:I01-02
WBHP:I01-03
WBHP:I02
WBHP:I02-01
WBHP:I02-02
WBHP:I02-03
WBHP:I03
WBHP:I03-01
WBHP:I03-02
WBHP:I03-03
WBHP:I04
WBHP:I04-01
WBHP:I04-02
WBHP:I04-03
WBHP:I05
WBHP:I05-01
WBHP:I05-02
WBHP:I05-03
WBHP:I06
WBHP:I06-01
WBHP:I06-02
WBHP:I06-03
WBHP:I07
WBHP:I07-01
WBHP:I07-02
WBHP:I07-03
WBHP:I08
WBHP:I08-01
WBHP:I08-02
WBHP:I08-03
WBHP:I09
WBHP:I09-01
WBHP:I09-02
WBHP:I09-03
WBHP:I10
WBHP:I10-01
WBHP:I10-02
WBHP:I10-03
WBHP:P01
WBHP:P01-01
WBHP:P01-02
WBHP:P01-03
WBHP:P02
WBHP:P02-01
WBHP:P02-02
WBHP:P02-03
WBHP:P03
WBHP:P03-01
WBHP:P03-02
WBHP:P03-03
WBHP:P04
WBHP:P04-01
WBHP:P04-02
WBHP:P04-03
WBHP:P05
WBHP:P05-01
WBHP:P05-02
WBHP:P06
WBHP:P06-01
WBHP:P06-02
WBHP:P07
WBHP:P07-01
WBHP:P07-02
WBHP:P07-03
WBHP:P08
WBHP:P08-01
WBHP:P08-02
WBHP:P08-03
WBHP:P09
WBHP:P09-01
WBHP:P10
WBHP:P10-01
WBHP:P10-02
WBHP:P11
WBHP:P11-01
WBHP:P11-02
WBHP:P11-03
WBHP:P12
WBHP:P12-01
WBHP:P12-02
WBHP:P12-03
WBHP:P13
WBHP:P13-01
WBHP:P13-02
WBHP:P13-03
WBHP:P14
WBHP:P14-01
WBHP:P14-02
WBHP:P15
WBHP:P15-01
WBHP:P15-02
WBHP:P16
WBHP:P16-01
WBHP:P16-02
WBHP:P16-03
WBHP:P17
WBHP:P17-01
WBHP:P17-02
WBHP:P17-03
WBHP:P18
WBHP:P18-01
WBHP:P18-02
WBHP:P18-03
WBHP:P19
WBHP:P19-01
WBHP:P19-02
WBHP:P19-03
WBHP:P20
WBHP:P20-01
WBHP:P20-02
WBHP:P20-03
WOPR:P01
WOPR:P01-01
WOPR:P01-02
WOPR:P01-03
WOPR:P02
WOPR:P02-01
WOPR:P02-02
WOPR:P02-03
WOPR:P03
WOPR:P03-01
WOPR:P03-02
WOPR:P03-03
WOPR:P04
WOPR:P04-01
WOPR:P04-02
WOPR:P04-03
WOPR:P05
WOPR:P05-01
WOPR:P05-02
WOPR:P06
WOPR:P06-01
WOPR:P06-02
WOPR:P07
WOPR:P07-01
WOPR:P07-02
WOPR:P07-03
WOPR:P08
WOPR:P08-01
WOPR:P08-02
WOPR:P08-03
WOPR:P09
WOPR:P09-01
WOPR:P10
WOPR:P10-01
WOPR:P10-02
WOPR:P11
WOPR:P11-01
WOPR:P11-02
WOPR:P11-03
WOPR:P12
WOPR:P12-01
WOPR:P12-02
WOPR:P12-03
WOPR:P13
WOPR:P13-01
WOPR:P13-02
WOPR:P13-03
WOPR:P14
WOPR:P14-01
WOPR:P14-02
WOPR:P15
WOPR:P15-01
WOPR:P15-02
WOPR:P16
WOPR:P16-01
WOPR:P16-02
WOPR:P16-03
WOPR:P17
WOPR:P17-01
WOPR:P17-02
WOPR:P17-03
WOPR:P18
WOPR:P18-01
WOPR:P18-02
WOPR:P18-03
WOPR:P19
WOPR:P19-01
WOPR:P19-02
WOPR:P19-03
WOPR:P20
WOPR:P20-01
WOPR:P20-02
WOPR:P20-03
WWIR:I01
WWIR:I01-01
WWIR:I01-02
WWIR:I01-03
WWIR:I02
WWIR:I02-01
WWIR:I02-02
WWIR:I02-03
WWIR:I03
WWIR:I03-01
WWIR:I03-02
WWIR:I03-03
WWIR:I04
WWIR:I04-01
WWIR:I04-02
WWIR:I04-03
WWIR:I05
WWIR:I05-01
WWIR:I05-02
WWIR:I05-03
WWIR:I06
WWIR:I06-01
WWIR:I06-02
WWIR:I06-03
WWIR:I07
WWIR:I07-01
WWIR:I07-02
WWIR:I07-03
WWIR:I08
WWIR:I08-01
WWIR:I08-02
WWIR:I08-03
WWIR:I09
WWIR:I09-01
WWIR:I09-02
WWIR:I09-03
WWIR:I10
WWIR:I10-01
WWIR:I10-02
WWIR:I10-03
WWPR:P01
WWPR:P01-01
WWPR:P01-02
WWPR:P01-03
WWPR:P02
WWPR:P02-01
WWPR:P02-02
WWPR:P02-03
WWPR:P03
WWPR:P03-01
WWPR:P03-02
WWPR:P03-03
WWPR:P04
WWPR:P04-01
WWPR:P04-02
WWPR:P04-03
WWPR:P05
WWPR:P05-01
WWPR:P05-02
WWPR:P06
WWPR:P06-01
WWPR:P06-02
WWPR:P07
WWPR:P07-01
WWPR:P07-02
WWPR:P07-03
WWPR:P08
WWPR:P08-01
WWPR:P08-02
WWPR:P08-03
WWPR:P09
WWPR:P09-01
WWPR:P10
WWPR:P10-01
WWPR:P10-02
WWPR:P11
WWPR:P11-01
WWPR:P11-02
WWPR:P11-03
WWPR:P12
WWPR:P12-01
WWPR:P12-02
WWPR:P12-03
WWPR:P13
WWPR:P13-01
WWPR:P13-02
WWPR:P13-03
WWPR:P14
WWPR:P14-01
WWPR:P14-02
WWPR:P15
WWPR:P15-01
WWPR:P15-02
WWPR:P16
WWPR:P16-01
WWPR:P16-02
WWPR:P16-03
WWPR:P17
WWPR:P17-01
WWPR:P17-02
WWPR:P17-03
WWPR:P18
WWPR:P18-01
WWPR:P18-02
WWPR:P18-03
WWPR:P19
WWPR:P19-01
WWPR:P19-02
WWPR:P19-03
WWPR:P20
WWPR:P20-01
WWPR:P20-02
WWPR:P20-03
YEARS
* /
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, DISABLED_BasicTestSetCurrentFolder)
{
/ *
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary);
QString currentFolderName = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10";
QDir::setCurrent(currentFolderName);
std::string filename = "BRUGGE_0010";
eclSummary->open(filename);
std::vector<std::string> keywords;
eclSummary->keywords(&keywords);
for (size_t i = 0; i < keywords.size(); i++)
{
std::cout << keywords[i] << std::endl;
}
* /
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RifEclipseSummaryTest, DISABLED_BasicTest)
{
/ *
std::unique_ptr<RifReaderEclipseSummary> eclSummary = std::unique_ptr<RifReaderEclipseSummary>(new
RifReaderEclipseSummary);
std::string filename = "g:\\Models\\Statoil\\MultipleRealisations\\Case_without_p9\\Real10\\BRUGGE_0010";
eclSummary->open(filename);
std::vector<std::string> keywords;
eclSummary->keywords(&keywords);
for (size_t i = 0; i < keywords.size(); i++)
{
std::cout << keywords[i] << std::endl;
}
* /
}
*/

View File

@@ -0,0 +1,87 @@
#include "gtest/gtest.h"
#include "RifRoffReader.h"
#include "RiaTestDataDirectory.h"
#include <QDir>
#include <QString>
TEST( RifRoffReader, ReadValidFile )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifRoffReader/facies_info.roff" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
std::map<int, QString> codeNames;
RifRoffReader::readCodeNames( filePath, codeNames );
ASSERT_EQ( 6u, codeNames.size() );
for ( int i = 0; i < 6; i++ )
{
ASSERT_TRUE( codeNames.find( i ) != codeNames.end() );
ASSERT_EQ( codeNames.find( i )->second.toStdString(), QString( "code name %1" ).arg( i + 1 ).toStdString() );
}
}
std::string readIncorrectFile( const QString filename )
{
QDir baseFolder( TEST_DATA_DIR );
QString filePath = baseFolder.absoluteFilePath( filename );
std::map<int, QString> codeNames;
try
{
RifRoffReader::readCodeNames( filePath, codeNames );
return "";
}
catch ( RifRoffReaderException& ex )
{
return ex.message;
}
}
TEST( RifRoffReader, ReadWrongFileType )
{
// Read a surface file: no expected to work
QString filename( "RifSurfaceImporter/test.ptl" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Unexpected file type: roff-asc header missing." ) );
}
TEST( RifRoffReader, ReadNonExistingFileType )
{
// Read a non-existing file
QString filename( "RifRoffReader/this_file_does_not_exist.roff" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Unable to open roff file." ) );
}
TEST( RifRoffReader, ReadFileWithIncorrectInteger )
{
// Read a file with incorrect integer for code values
QString filename( "RifRoffReader/code_values_integer_wrong.roff" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Unexpected value: not an integer." ) );
}
TEST( RifRoffReader, ReadFileCodeNamesMissing )
{
// Read a file without code names
QString filename( "RifRoffReader/code_names_missing.roff" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Code names not found." ) );
}
TEST( RifRoffReader, ReadFileCodeValuesMissing )
{
// Read a file without code values
QString filename( "RifRoffReader/code_values_missing.roff" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Code values not found." ) );
}
TEST( RifRoffReader, ReadFileCodeNamesAndValuesMismatch )
{
// Read a file without code values
QString filename( "RifRoffReader/code_names_and_values_mismatch.roff" );
ASSERT_EQ( readIncorrectFile( filename ), std::string( "Inconsistent code names and values: must be equal length." ) );
}

View File

@@ -0,0 +1,29 @@
#include "gtest/gtest.h"
#include "RifStimPlanModelDeviationFrkExporter.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifStimPlanModelDeviationFrkExporterTest, TvdFixup )
{
std::vector<double> tvd =
{ 475.722, 492.126, 508.53, 524.934, 541.338, 557.743, 574.147, 590.551, 606.955, 623.359, 639.764, 656.168, 672.572 };
std::vector<double> md =
{ 475.722, 492.126, 508.53, 524.934, 541.339, 557.743, 574.147, 590.551, 606.955, 623.36, 639.764, 656.168, 672.572 };
std::vector<double> exportTvd;
std::vector<double> exportMd;
RifStimPlanModelDeviationFrkExporter::fixupDepthValuesForExport( tvd, md, exportTvd, exportMd );
EXPECT_EQ( tvd.size(), exportTvd.size() );
EXPECT_EQ( md.size(), exportMd.size() );
for ( size_t i = 1; i < exportMd.size(); i++ )
{
double changeMd = exportMd[i] - exportMd[i - 1];
double changeTvd = exportTvd[i] - exportTvd[i - 1];
ASSERT_GE( changeMd, changeTvd );
}
}

View File

@@ -0,0 +1,83 @@
#include "gtest/gtest.h"
#include "RiaTestDataDirectory.h"
#include "RifStimPlanXmlReader.h"
#include "RigStimPlanFractureDefinition.h"
static const QString CASE_REAL_TEST_DATA_DIRECTORY = QString( "%1/RifStimPlanXmlReader/" ).arg( TEST_DATA_DIR );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifStimPlanXmlReaderTest, LoadFile )
{
QString fileName = CASE_REAL_TEST_DATA_DIRECTORY + "small_fracture.xml";
double conductivityScaleFactor = 1.0;
double halfLengthScaleFactor = 1.0;
double heightScaleFactor = 1.0;
double wellPathDepthAtFracture = 100.0;
RiaEclipseUnitTools::UnitSystem unit = RiaEclipseUnitTools::UnitSystem::UNITS_METRIC;
QString errorMessage;
RifStimPlanXmlReader::MirrorMode mode = RifStimPlanXmlReader::MIRROR_AUTO;
cvf::ref<RigStimPlanFractureDefinition> fractureData;
fractureData = RifStimPlanXmlReader::readStimPlanXMLFile( fileName,
conductivityScaleFactor,
halfLengthScaleFactor,
heightScaleFactor,
-wellPathDepthAtFracture,
mode,
unit,
&errorMessage );
EXPECT_TRUE( errorMessage.isEmpty() );
EXPECT_TRUE( fractureData.notNull() );
size_t xSamplesIncludingMirrorValues = 7;
EXPECT_EQ( xSamplesIncludingMirrorValues, fractureData->xCount() );
EXPECT_EQ( size_t( 5 ), fractureData->yCount() );
EXPECT_EQ( size_t( 1 ), fractureData->timeSteps().size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifStimPlanXmlReaderTest, LoadFileNewFormat )
{
QString fileName = CASE_REAL_TEST_DATA_DIRECTORY + "contour_Metric.xml";
double conductivityScaleFactor = 1.0;
double halfLengthScaleFactor = 1.0;
double heightScaleFactor = 1.0;
double wellPathDepthAtFracture = 100.0;
RiaEclipseUnitTools::UnitSystem unit = RiaEclipseUnitTools::UnitSystem::UNITS_METRIC;
QString errorMessage;
RifStimPlanXmlReader::MirrorMode mode = RifStimPlanXmlReader::MIRROR_AUTO;
cvf::ref<RigStimPlanFractureDefinition> fractureData;
fractureData = RifStimPlanXmlReader::readStimPlanXMLFile( fileName,
conductivityScaleFactor,
halfLengthScaleFactor,
heightScaleFactor,
-wellPathDepthAtFracture,
mode,
unit,
&errorMessage );
EXPECT_TRUE( errorMessage.isEmpty() );
EXPECT_TRUE( fractureData.notNull() );
size_t xSamplesIncludingMirrorValues = 49;
EXPECT_EQ( xSamplesIncludingMirrorValues, fractureData->xCount() );
EXPECT_EQ( size_t( 23 ), fractureData->yCount() );
EXPECT_EQ( size_t( 1 ), fractureData->timeSteps().size() );
EXPECT_DOUBLE_EQ( 2773.680, fractureData->topPerfTvd() );
EXPECT_DOUBLE_EQ( 2773.680, fractureData->bottomPerfTvd() );
EXPECT_DOUBLE_EQ( 2804.160, fractureData->topPerfMd() );
EXPECT_DOUBLE_EQ( 2804.770, fractureData->bottomPerfMd() );
}

View File

@@ -0,0 +1,262 @@
#include "gtest/gtest.h"
#include "RifSurfaceImporter.h"
#include "RiaTestDataDirectory.h"
#include "RigGocadData.h"
#include "QDir"
#include <QString>
#include <QStringList>
TEST( RifSurfaceImporter, GocadReadValidFile )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/tsurf_eks.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
auto surface = gocadData.gocadGeometry();
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)159, vertices.size() );
EXPECT_EQ( (size_t)759, indices.size() );
EXPECT_EQ( (size_t)4, indices.front() );
EXPECT_EQ( (size_t)64, indices.back() );
}
TEST( RifSurfaceImporter, GocadReadWrongIndices )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/tsurf_invalid.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
auto surface = gocadData.gocadGeometry();
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)18, vertices.size() );
EXPECT_EQ( (size_t)15, indices.size() );
}
TEST( RifSurfaceImporter, GocadReadProperties )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/geom_with_properties.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
auto surface = gocadData.gocadGeometry();
auto vertices = surface.first;
auto indices = surface.second;
std::vector<QString> propNames = gocadData.propertyNames();
EXPECT_TRUE( propNames.size() == 3 );
EXPECT_TRUE( propNames[0] == "SX" );
std::vector<float> propValues_SX = gocadData.propertyValues( propNames[0] );
float SX_first = propValues_SX[0];
float SX_second = propValues_SX[1];
float SX_last = propValues_SX[propValues_SX.size() - 1];
EXPECT_NEAR( 0.000907, SX_first, 1e-4 );
EXPECT_NEAR( 0.000972, SX_second, 1e-4 );
EXPECT_NEAR( 0.004293, SX_last, 1e-4 );
std::vector<float> propValues_SY = gocadData.propertyValues( "SY" );
float SY_first = propValues_SY[0];
float SY_second = propValues_SY[1];
float SY_last = propValues_SY[propValues_SX.size() - 1];
EXPECT_NEAR( 0.001550, SY_first, 1e-4 );
EXPECT_NEAR( 0.001620, SY_second, 1e-4 );
EXPECT_NEAR( 0.010476, SY_last, 1e-4 );
}
TEST( RifSurfaceImporter, GocadReadNoProperty )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/tsurf_eks.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
std::vector<QString> propNames = gocadData.propertyNames();
std::vector<float> propValues = gocadData.propertyValues( "" );
EXPECT_TRUE( propNames.size() == 0 );
EXPECT_TRUE( propValues.size() == 0 );
}
TEST( RifSurfaceImporter, GocadReadNonExistingProperty )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/geom_with_properties.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
std::vector<float> propValues = gocadData.propertyValues( "NonExistingProperty" );
EXPECT_TRUE( propValues.size() == 0 );
}
TEST( RifSurfaceImporter, ReadWrongFileType )
{
QDir baseFolder( TEST_DATA_DIR );
{
QString filename( "RifSurfaceImporter/test.ptl" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
RigGocadData gocadData;
RifSurfaceImporter::readGocadFile( filePath, &gocadData );
auto surface = gocadData.gocadGeometry();
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)0, vertices.size() );
EXPECT_EQ( (size_t)0, indices.size() );
}
{
QString filename( "RifSurfaceImporter/tsurf_eks.ts" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
auto surface = RifSurfaceImporter::readPetrelFile( filePath );
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)0, vertices.size() );
EXPECT_EQ( (size_t)0, indices.size() );
}
}
TEST( RifSurfaceImporter, ReadPetrelData )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/test.ptl" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
auto surface = RifSurfaceImporter::readPetrelFile( filePath );
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)3441, vertices.size() );
EXPECT_EQ( (size_t)19872, indices.size() );
EXPECT_EQ( (size_t)0, indices.front() );
EXPECT_EQ( (size_t)3439, indices.back() );
}
TEST( RifSurfaceImporter, ReadClippedPetrelData )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/test_small_flipped_clipped.ptl" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
auto surface = RifSurfaceImporter::readPetrelFile( filePath );
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)8, vertices.size() );
EXPECT_EQ( (size_t)18, indices.size() );
EXPECT_EQ( (size_t)0, indices.front() );
EXPECT_EQ( (size_t)2, indices.back() );
for ( size_t i = 0; i < indices.size(); i++ )
{
EXPECT_TRUE( indices[i] != ( (unsigned)-1 ) );
}
}
TEST( RifSurfaceImporter, ReadTinyOpenWorksXyzFile )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/tiny-test.dat" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
auto surface = RifSurfaceImporter::readOpenWorksXyzFile( filePath, 0.1 );
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)15, vertices.size() );
EXPECT_EQ( (size_t)24, indices.size() );
if ( indices.size() > 0 )
{
EXPECT_EQ( (size_t)0, indices.front() );
EXPECT_EQ( (size_t)11, indices.back() );
for ( size_t i = 0; i < indices.size(); i++ )
{
EXPECT_TRUE( indices[i] != ( (unsigned)-1 ) );
}
}
}
TEST( RifSurfaceImporter, ReadLargeOpenWorksXyzFile )
{
QDir baseFolder( TEST_DATA_DIR );
QString filename( "RifSurfaceImporter/norne_xyz.dat" );
QString filePath = baseFolder.absoluteFilePath( filename );
EXPECT_TRUE( QFile::exists( filePath ) );
auto surface = RifSurfaceImporter::readOpenWorksXyzFile( filePath, 0.1 );
auto vertices = surface.first;
auto indices = surface.second;
EXPECT_EQ( (size_t)60805, vertices.size() );
EXPECT_EQ( (size_t)360792, indices.size() );
if ( indices.size() > 0 )
{
EXPECT_EQ( (size_t)0, indices.front() );
EXPECT_EQ( (size_t)60802, indices.back() );
for ( size_t i = 0; i < indices.size(); i++ )
{
EXPECT_TRUE( indices[i] != ( (unsigned)-1 ) );
}
}
}

View File

@@ -0,0 +1,212 @@
#include "gtest/gtest.h"
#include "RifTextDataTableFormatter.h"
#include <QString>
#include <QStringList>
TEST( RifTextDataTableFormatter, BasicUsage )
{
QString tableText;
QTextStream stream( &tableText );
RifTextDataTableFormatter formatter( stream );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "Well" ),
RifTextDataTableColumn( "Integer Number" ),
RifTextDataTableColumn( "IntNumer 2" ),
RifTextDataTableColumn( "IntNumer 3" ),
};
formatter.header( header );
formatter.add( "well a" );
formatter.add( 1 );
formatter.add( 2 );
formatter.add( 3 );
formatter.rowCompleted();
formatter.add( "well B" );
formatter.add( 12 );
formatter.add( 23 );
formatter.add( 233 );
formatter.rowCompleted();
formatter.tableCompleted();
std::cout << tableText.toStdString();
}
TEST( RifTextDataTableFormatter, NoPrefix )
{
QString tableText;
QTextStream stream( &tableText );
RifTextDataTableFormatter formatter( stream );
formatter.setTableRowPrependText( " " );
formatter.setTableRowLineAppendText( "" );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "Well" ),
RifTextDataTableColumn( "Integer Number", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "IntNumer 2", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "IntNumer 3", RifTextDataTableDoubleFormatting(), RIGHT ),
};
formatter.header( header );
formatter.add( "well a" );
formatter.add( 1 );
formatter.add( 2 );
formatter.add( 3 );
formatter.rowCompleted();
formatter.add( "well B" );
formatter.add( 12 );
formatter.add( 231 );
formatter.add( 23123 );
formatter.rowCompleted();
formatter.tableCompleted();
std::cout << tableText.toStdString();
}
TEST( RifTextDataTableFormatter, LongLine )
{
QString tableText;
QTextStream stream( &tableText );
RifTextDataTableFormatter formatter( stream );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "50 Character Well Name" ),
RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #8", RifTextDataTableDoubleFormatting(), RIGHT ),
};
formatter.header( header );
QString fiftyCharacterWellName = "01234567890123456789012345678901234567890123456789";
formatter.add( fiftyCharacterWellName );
for ( int i = 0; i < 8; ++i )
{
formatter.add( std::numeric_limits<int>::max() ); // 10 characters
}
int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 50 + 8 * 10 +
formatter.tableRowAppendText().length();
int tableWidth = formatter.tableWidth();
EXPECT_EQ( tableWidth, fullLineLength );
EXPECT_GT( tableWidth, formatter.maxDataRowWidth() );
formatter.rowCompleted();
formatter.tableCompleted();
QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts );
for ( QString line : tableLines )
{
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
if ( !line.startsWith( formatter.commentPrefix() ) )
{
EXPECT_LE( line.length(), formatter.maxDataRowWidth() );
}
}
}
TEST( RifTextDataTableFormatter, LongLine132 )
{
QString tableText;
QTextStream stream( &tableText );
RifTextDataTableFormatter formatter( stream );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "10 Char" ),
RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "I", RifTextDataTableDoubleFormatting(), RIGHT ),
};
formatter.header( header );
QString tenCharacterWellName = "0123456789";
formatter.add( tenCharacterWellName );
for ( int i = 0; i < 7; ++i )
{
formatter.add( std::numeric_limits<int>::max() ); // 10 characters
}
formatter.add( 11 );
int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 2 +
formatter.tableRowAppendText().length();
int tableWidth = formatter.tableWidth();
EXPECT_GE( tableWidth, fullLineLength );
EXPECT_EQ( formatter.maxDataRowWidth(), fullLineLength );
formatter.rowCompleted();
formatter.tableCompleted();
QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts );
for ( QString line : tableLines )
{
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
if ( line.startsWith( "0" ) )
{
EXPECT_EQ( line.length(), formatter.maxDataRowWidth() );
}
}
}
TEST( RifTextDataTableFormatter, LongLine133 )
{
QString tableText;
QTextStream stream( &tableText );
RifTextDataTableFormatter formatter( stream );
std::vector<RifTextDataTableColumn> header = {
RifTextDataTableColumn( "10 Char" ),
RifTextDataTableColumn( "10 Int #1", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #2", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #3", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #4", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #5", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #6", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "10 Int #7", RifTextDataTableDoubleFormatting(), RIGHT ),
RifTextDataTableColumn( "I", RifTextDataTableDoubleFormatting(), RIGHT ),
};
formatter.header( header );
QString fiftyCharacterWellName = "0123456789";
formatter.add( fiftyCharacterWellName );
for ( int i = 0; i < 7; ++i )
{
formatter.add( std::numeric_limits<int>::max() ); // 10 characters
}
formatter.add( 111 );
int fullLineLength = formatter.tableRowPrependText().length() + 9 * formatter.columnSpacing() + 10 + 7 * 10 + 3 +
formatter.tableRowAppendText().length();
int tableWidth = formatter.tableWidth();
EXPECT_GE( tableWidth, fullLineLength );
EXPECT_LT( formatter.maxDataRowWidth(), fullLineLength );
formatter.rowCompleted();
formatter.tableCompleted();
QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts );
for ( QString line : tableLines )
{
std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl;
if ( line.startsWith( "0" ) )
{
EXPECT_LE( line.length(), formatter.maxDataRowWidth() );
}
}
}

View File

@@ -0,0 +1,285 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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 "RifFileParseTools.h"
#include "RifWellMeasurementReader.h"
#include <QStringList>
#include <QTemporaryFile>
#include <QTextStream>
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadCorrectInputFile )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "NO 1234/5-6, 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n"
<< "NO 4321/7-8, 4321.79, 2024-12-24, DP, 88.8, 1, Poor test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifWellMeasurement> wellMeasurements;
RifWellMeasurementReader::readWellMeasurements( wellMeasurements, filePaths );
ASSERT_EQ( 2u, wellMeasurements.size() );
ASSERT_EQ( "NO 1234/5-6", wellMeasurements[0].wellName.toStdString() );
ASSERT_EQ( "NO 4321/7-8", wellMeasurements[1].wellName.toStdString() );
ASSERT_DOUBLE_EQ( 1234.56, wellMeasurements[0].MD );
ASSERT_DOUBLE_EQ( 4321.79, wellMeasurements[1].MD );
QDate date0( 2019, 11, 13 );
ASSERT_EQ( date0.year(), wellMeasurements[0].date.year() );
ASSERT_EQ( date0.month(), wellMeasurements[0].date.month() );
ASSERT_EQ( date0.day(), wellMeasurements[0].date.day() );
QDate date1( 2024, 12, 24 );
ASSERT_EQ( date1.year(), wellMeasurements[1].date.year() );
ASSERT_EQ( date1.month(), wellMeasurements[1].date.month() );
ASSERT_EQ( date1.day(), wellMeasurements[1].date.day() );
ASSERT_DOUBLE_EQ( 99.9, wellMeasurements[0].value );
ASSERT_DOUBLE_EQ( 88.8, wellMeasurements[1].value );
ASSERT_EQ( "XLOT", wellMeasurements[0].kind.toStdString() );
ASSERT_EQ( "DP", wellMeasurements[1].kind.toStdString() );
ASSERT_EQ( 3, wellMeasurements[0].quality );
ASSERT_EQ( 1, wellMeasurements[1].quality );
ASSERT_EQ( "Good test", wellMeasurements[0].remark.toStdString() );
ASSERT_EQ( "Poor test", wellMeasurements[1].remark.toStdString() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, KindsAreUppercased )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "NO 1234/1-2, 1234.56, 2019-11-13, LOT, 99.9, 3, Good test\n"
<< "NO 1234/3-4, 2345.67, 2024-12-24, lot, 88.8, 1, Poor test\n"
<< "NO 1234/5-6, 3456.78, 2026-12-24, lOt, 77.7, 2, Poor test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifWellMeasurement> wellMeasurements;
RifWellMeasurementReader::readWellMeasurements( wellMeasurements, filePaths );
ASSERT_EQ( 3u, wellMeasurements.size() );
for ( unsigned int i = 0; i < wellMeasurements.size(); i++ )
{
ASSERT_EQ( "LOT", wellMeasurements[i].kind.toStdString() );
}
}
//--------------------------------------------------------------------------------------------------
/// Helper to check exception messages when reading invalid files
//--------------------------------------------------------------------------------------------------
::testing::AssertionResult readingThrowsException( const QStringList& filePaths, const QString& expectedMessage )
{
std::vector<RifWellMeasurement> wellMeasurements;
try
{
RifWellMeasurementReader::readWellMeasurements( wellMeasurements, filePaths );
// No exception thrown: fail!
return ::testing::AssertionFailure() << "readWellMeasurements did not throw exception";
}
catch ( FileParseException& error )
{
// Should always have cleaned up the well measurements on failure
EXPECT_EQ( 0u, wellMeasurements.size() );
// Check that we get the expected message
EXPECT_EQ( expectedMessage.toStdString(), error.message.toStdString() );
return ::testing::AssertionSuccess();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadMissingFileThrows )
{
QStringList filePaths;
QString nonExistingFile( "this/is/a/file/which/does/not/exist.csv" );
filePaths.append( nonExistingFile );
ASSERT_TRUE( readingThrowsException( filePaths, QString( "Unable to open file: %1" ).arg( nonExistingFile ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadShortLinesFileThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "NO 1234/5-6, 1234.56\n"
<< "NO 4321/7-8, 4321.79, 2024-12-24\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingThrowsException( filePaths, QString( "Incomplete data on line 1: %1" ).arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadEmptyWellNameThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "NO 1234/5-6, 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n";
out << ", 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingThrowsException( filePaths,
QString( "Unexpected empty 'Well Name' on line 2: %1" ).arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadInvalidMeasureDepthThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "well 1, 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n";
out << "well 2, this is should be a number, 2019-11-13, XLOT, 99.9, 3, Good test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE(
readingThrowsException( filePaths,
QString( "Invalid number for 'Measured Depth' on line 2: %1" ).arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadInvalidQualityThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "well 1, 1234.56, 2019-11-13, XLOT, 99.9, this is not an int, Good test\n";
out << "well 2, 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingThrowsException( filePaths,
QString( "Invalid number for 'Quality' on line 1: %1" ).arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, ReadInvalidDateFormateThrows )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
out << "well 1, 1234.56, 17th May 1814, XLOT, 99.9, 1, Good test\n";
out << "well 2, 1234.56, 2019-11-13, XLOT, 99.9, 3, Good test\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
ASSERT_TRUE( readingThrowsException( filePaths,
QString( "Invalid date format (must be ISO 8601) for 'Date' on line 1: %1" )
.arg( file.fileName() ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RifWellMeasurementReaderTest, CommentsAndEmptyLinesAreIgnored )
{
QTemporaryFile file;
EXPECT_TRUE( file.open() );
{
QTextStream out( &file );
// Comment should be ignored
out << "# This is a comment.\n";
out << "#This is also a comment.\n";
out << " # This is also a comment which does not start on first character.\n";
// Should skip empty lines
out << "\n";
out << "\t\n";
out << " \n";
// Then some data
out << "well 1, 1234.56, 2019-11-11, XLOT, 199.9, 1, Good test\n";
// Comment in-between data should be ignored
out << "# One more comment in-between the data\n";
out << "well 2, 2234.56, 2019-11-12, XLOT, 299.9, 2, Good test\n";
// Empty line in-between data should be ignored
out << "\n";
// Data with comment sign inside it is not ignored
out << "well #3, 3234.56, 2019-11-13, XLOT, 399.9, 3, Good test\n";
// Trailing empty lines should be ignored
out << "\n\n\n";
}
QStringList filePaths;
filePaths.append( file.fileName() );
std::vector<RifWellMeasurement> wellMeasurements;
RifWellMeasurementReader::readWellMeasurements( wellMeasurements, filePaths );
ASSERT_EQ( 3u, wellMeasurements.size() );
ASSERT_EQ( "well 1", wellMeasurements[0].wellName.toStdString() );
ASSERT_EQ( "well 2", wellMeasurements[1].wellName.toStdString() );
ASSERT_EQ( "well #3", wellMeasurements[2].wellName.toStdString() );
}

View File

@@ -0,0 +1,334 @@
#include "gtest/gtest.h"
#include "RicfCommandFileExecutor.h"
#include "RicfCommandObject.h"
#include "RifcCommandFileReader.h"
#include "cafPdmField.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmScriptIOMessages.h"
class TestCommand1 : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
TestCommand1()
{
CAF_PDM_InitScriptableField( &m_textArgument, "TextArgument", QString(), "TextArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_doubleArgument, "DoubleArgument", 0.0, "DoubleArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_intArgument, "IntArgument", 0, "IntArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_boolArgument, "BoolArgument", false, "BoolArgument", "", "", "" );
}
caf::PdmScriptResponse execute() override
{
std::cout << "TestCommand1::execute("
<< "\"" << m_textArgument().toStdString() << "\", " << m_doubleArgument() << ", " << m_intArgument
<< ", " << m_boolArgument << ");" << std::endl;
return caf::PdmScriptResponse();
}
caf::PdmField<QString> m_textArgument;
caf::PdmField<double> m_doubleArgument;
caf::PdmField<int> m_intArgument;
caf::PdmField<bool> m_boolArgument;
};
CAF_PDM_SOURCE_INIT( TestCommand1, "TestCommand1" );
class TC2 : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
TC2()
{
CAF_PDM_InitScriptableField( &m_textArgument, "ta", QString(), "TextArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_doubleArgument, "da", 0.0, "DoubleArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_intArgument, "ia", 0, "IntArgument", "", "", "" );
CAF_PDM_InitScriptableField( &m_boolArgument, "ba", false, "BoolArgument", "", "", "" );
}
caf::PdmScriptResponse execute() override
{
std::cout << "TC2::execute("
<< "\"" << m_textArgument().toStdString() << "\", " << m_doubleArgument() << ", " << m_intArgument()
<< ", " << m_boolArgument() << ");" << std::endl;
return caf::PdmScriptResponse();
}
caf::PdmField<QString> m_textArgument;
caf::PdmField<double> m_doubleArgument;
caf::PdmField<int> m_intArgument;
caf::PdmField<bool> m_boolArgument;
};
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.\", BoolArgument=true) \n"
"TC2( ia = -12, ba=True, ta = \"Floff\", da =-662.518)\n"
"TC2 ( ta = \"Hepp\", ia = 3, ba = false, da= 0.123)" );
// std::cout << commandString.toStdString() << std::endl;
QTextStream inputStream( &commandString );
caf::PdmScriptIOMessages errors;
auto objects = RicfCommandFileReader::readCommands( inputStream, caf::PdmDefaultObjectFactory::instance(), &errors );
EXPECT_EQ( (size_t)5, objects.size() );
auto tc1 = dynamic_cast<TestCommand1*>( objects[0] );
EXPECT_EQ( 39, tc1->m_textArgument().size() );
EXPECT_EQ( 5.0e3, tc1->m_doubleArgument() );
EXPECT_FALSE( tc1->m_boolArgument() );
tc1 = dynamic_cast<TestCommand1*>( objects[1] );
EXPECT_EQ( 39, tc1->m_textArgument().size() );
EXPECT_EQ( 5e-3, tc1->m_doubleArgument() );
EXPECT_FALSE( tc1->m_boolArgument() );
tc1 = dynamic_cast<TestCommand1*>( objects[2] );
EXPECT_EQ( 19, tc1->m_textArgument().size() );
EXPECT_EQ( 0.0, tc1->m_doubleArgument() );
EXPECT_TRUE( tc1->m_boolArgument() );
auto tc2 = dynamic_cast<TC2*>( objects[3] );
EXPECT_EQ( 5, tc2->m_textArgument().size() );
EXPECT_EQ( -662.518, tc2->m_doubleArgument() );
EXPECT_EQ( -12, tc2->m_intArgument() );
EXPECT_TRUE( tc2->m_boolArgument() );
tc2 = dynamic_cast<TC2*>( objects[4] );
EXPECT_EQ( 4, tc2->m_textArgument().size() );
EXPECT_EQ( 0.123, tc2->m_doubleArgument() );
EXPECT_EQ( 3, tc2->m_intArgument() );
EXPECT_FALSE( tc2->m_boolArgument() );
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 );
caf::PdmScriptIOMessages 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 within 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 == caf::PdmScriptIOMessages::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 );
caf::PdmScriptIOMessages 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 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicfCommands, TransformFileCommandObjectsToExecutableCommandObjects )
{
QString commandString = R"(
replaceCase(newGridFile="/1.EGRID", caseId=1)
replaceCase(newGridFile="/2.EGRID", caseId=2)
openProject(path="/home/user/ResInsightProject.rsp")
replaceCase(newGridFile="/3.EGRID", caseId=3)
replaceCase(newGridFile="/4.EGRID", caseId=4)
exportSnapshots()
replaceCase(newGridFile="/6.EGRID", caseId=6)
replaceCase(newGridFile="/7.EGRID", caseId=7)
closeProject()
)";
QTextStream inputStream( &commandString );
caf::PdmScriptIOMessages errors;
auto objects = RicfCommandFileReader::readCommands( inputStream, caf::PdmDefaultObjectFactory::instance(), &errors );
EXPECT_TRUE( errors.m_messages.empty() );
EXPECT_EQ( (size_t)9, objects.size() );
auto exeObjects = RicfCommandFileExecutor::prepareFileCommandsForExecution( objects );
EXPECT_EQ( (size_t)6, exeObjects.size() );
for ( auto obj : exeObjects )
{
delete ( obj );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicfCommands, IgnoreCommentLines )
{
QString commandString = R"(
replaceCase(newGridFile="/1.EGRID", caseId=1)
# replaceCase(newGridFile="/2.EGRID", caseId=2)
openProject(path="/home/user/ResInsightProject.rsp")
replaceCase(newGridFile="/3.EGRID", caseId=3)
# replaceCase(newGridFile="/4.EGRID", caseId=4)
exportSnapshots()
replaceCase(newGridFile="/6.EGRID", caseId=6)
replaceCase(newGridFile="/7.EGRID", caseId=7)
closeProject()
)";
QTextStream inputStream( &commandString );
caf::PdmScriptIOMessages errors;
auto objects = RicfCommandFileReader::readCommands( inputStream, caf::PdmDefaultObjectFactory::instance(), &errors );
EXPECT_TRUE( errors.m_messages.empty() );
EXPECT_EQ( (size_t)7, objects.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicfCommands, IgnoreCommentLinesShowErrorLine )
{
QString commandString = R"(
replaceCase(newGridFile="/1.EGRID", caseId=1)
# replaceCase(newGridFile="/2.EGRID", caseId=2)
openProject(path="/home/user/ResInsightProject.rsp")
replaceCase(newGridFile="/3.EGRID", caseId=3)
# replaceCase(newGridFile="/4.EGRID", caseId=4)
exportSnapshots()
sdareplaceCase(newGridFile="/6.EGRID", caseId=6)
replaceCase(newGridFile="/7.EGRID", caseId=7)
closeProject()
)";
QTextStream inputStream( &commandString );
caf::PdmScriptIOMessages errors;
auto objects = RicfCommandFileReader::readCommands( inputStream, caf::PdmDefaultObjectFactory::instance(), &errors );
EXPECT_EQ( (size_t)1, errors.m_messages.size() );
EXPECT_EQ( (size_t)6, objects.size() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicfCommands, WriteCommand )
{
TestCommand1 testCmd;
testCmd.m_textArgument = "My Test";
testCmd.m_doubleArgument = 1.123;
testCmd.m_intArgument = -123;
testCmd.m_boolArgument = true;
QString commandString;
{
QTextStream inputStream( &commandString );
std::vector<RicfCommandObject*> cmdObjects;
cmdObjects.push_back( &testCmd );
RicfCommandFileReader::writeCommands( inputStream, cmdObjects );
EXPECT_FALSE( commandString.isEmpty() );
}
{
QTextStream inputStream( &commandString );
caf::PdmScriptIOMessages errors;
auto objects =
RicfCommandFileReader::readCommands( inputStream, caf::PdmDefaultObjectFactory::instance(), &errors );
EXPECT_EQ( (size_t)1, objects.size() );
TestCommand1* myObj = dynamic_cast<TestCommand1*>( objects.front() );
EXPECT_TRUE( myObj != nullptr );
EXPECT_STREQ( testCmd.m_textArgument().toStdString().data(), myObj->m_textArgument().toStdString().data() );
EXPECT_EQ( testCmd.m_doubleArgument, myObj->m_doubleArgument );
EXPECT_EQ( testCmd.m_intArgument, myObj->m_intArgument );
EXPECT_EQ( testCmd.m_boolArgument, myObj->m_boolArgument );
}
}

View File

@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "RigActiveCellInfo.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigActiveCellInfo, BasicTest )
{
RigActiveCellInfo rigActiveCellInfo;
size_t globalActiveCellCount = 10;
rigActiveCellInfo.setReservoirCellCount( globalActiveCellCount );
for ( size_t i = 0; i < globalActiveCellCount; i++ )
{
EXPECT_TRUE( rigActiveCellInfo.cellResultIndex( i ) == cvf::UNDEFINED_SIZE_T );
EXPECT_FALSE( rigActiveCellInfo.isActive( i ) );
}
rigActiveCellInfo.setCellResultIndex( 3, 1 );
EXPECT_TRUE( rigActiveCellInfo.cellResultIndex( 3 ) == 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigActiveCellInfo, GridCellCounts )
{
{
RigActiveCellInfo rigActiveCellInfo;
rigActiveCellInfo.setGridCount( 3 );
rigActiveCellInfo.setGridActiveCellCounts( 0, 0 );
rigActiveCellInfo.setGridActiveCellCounts( 1, 1 );
rigActiveCellInfo.setGridActiveCellCounts( 2, 2 );
rigActiveCellInfo.computeDerivedData();
EXPECT_TRUE( rigActiveCellInfo.reservoirActiveCellCount() == 3 );
}
{
RigActiveCellInfo rigActiveCellInfo;
rigActiveCellInfo.setGridCount( 3 );
rigActiveCellInfo.setGridActiveCellCounts( 0, 3 );
rigActiveCellInfo.setGridActiveCellCounts( 1, 4 );
rigActiveCellInfo.setGridActiveCellCounts( 2, 5 );
rigActiveCellInfo.computeDerivedData();
EXPECT_TRUE( rigActiveCellInfo.reservoirActiveCellCount() == 12 );
}
}

View File

@@ -0,0 +1,653 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RigCellGeometryTools.h"
#include "RigMainGrid.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, calculateCellVolumeTest )
{
cvf::BoundingBox bbox( cvf::Vec3d( 1.0, -2.0, 5.0 ), cvf::Vec3d( 500.0, 3.0, 1500.0 ) );
cvf::Vec3d extent = bbox.extent();
double bboxVolume = extent.x() * extent.y() * extent.z();
std::array<cvf::Vec3d, 8> cornerVertices;
bbox.cornerVertices( cornerVertices.data() );
// This is a cuboid. The result should be exact
EXPECT_DOUBLE_EQ( bboxVolume, RigCellGeometryTools::calculateCellVolume( cornerVertices ) );
// Distort it by adding a tetrahedron to the volume
cornerVertices[1].x() += bbox.extent().x() / 3.0;
cornerVertices[2].x() += bbox.extent().x() / 3.0;
double extraVolume = 0.5 * extent.z() * bbox.extent().x() / 3.0 * extent.y();
EXPECT_DOUBLE_EQ( bboxVolume + extraVolume, RigCellGeometryTools::calculateCellVolume( cornerVertices ) );
// The overlap with the original bounding box should just yield the original bounding box
cvf::BoundingBox overlapBoundingBox;
std::array<cvf::Vec3d, 8> overlapVertices;
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices, bbox, &overlapVertices, &overlapBoundingBox );
EXPECT_DOUBLE_EQ( bboxVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
cvf::Vec3d overlapExtent = overlapBoundingBox.extent();
double overlapBBoxVolume = overlapExtent.x() * overlapExtent.y() * overlapExtent.z();
EXPECT_DOUBLE_EQ( bboxVolume, overlapBBoxVolume );
// Shift bounding box by half the original extent in x-direction.
// It should now contain the full tetrahedron + half the original bounding box
std::array<cvf::Vec3d, 8> tetrahedronBoxVertices;
bbox.cornerVertices( tetrahedronBoxVertices.data() );
cvf::BoundingBox tetrahedronBBox;
for ( cvf::Vec3d& corner : tetrahedronBoxVertices )
{
corner.x() += 0.5 * bbox.extent().x();
tetrahedronBBox.add( corner );
}
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices,
tetrahedronBBox,
&overlapVertices,
&overlapBoundingBox );
EXPECT_DOUBLE_EQ( bboxVolume * 0.5 + extraVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
// Shift it the rest of the original extent in x-direction.
// The bounding box should now contain only the tetrahedron.
tetrahedronBBox = cvf::BoundingBox();
for ( cvf::Vec3d& corner : tetrahedronBoxVertices )
{
corner.x() += 0.5 * bbox.extent().x();
tetrahedronBBox.add( corner );
}
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices,
tetrahedronBBox,
&overlapVertices,
&overlapBoundingBox );
EXPECT_DOUBLE_EQ( extraVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
// Expand original bounding box to be much larger than the hex
bbox.expand( 2000 );
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices, bbox, &overlapVertices, &overlapBoundingBox );
EXPECT_DOUBLE_EQ( bboxVolume + extraVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, calculateCellVolumeTest2 )
{
cvf::BoundingBox bbox( cvf::Vec3d( 0.0, 0.0, 0.0 ), cvf::Vec3d( 100.0, 100.0, 100.0 ) );
std::array<cvf::Vec3d, 8> cornerVertices;
bbox.cornerVertices( cornerVertices.data() );
cornerVertices[5].z() = cornerVertices[1].z();
cornerVertices[6].z() = cornerVertices[2].z();
double totalCellVolume = 0.5 * 100.0 * 100.0 * 100.0;
EXPECT_DOUBLE_EQ( totalCellVolume, RigCellGeometryTools::calculateCellVolume( cornerVertices ) );
cvf::BoundingBox innerBBox( cvf::Vec3d( 25.0, 25.0, -10.0 ), cvf::Vec3d( 75.0, 75.0, 110.0 ) );
double expectedOverlap = 50 * 50 * 25 + 0.5 * 50 * 50 * 50;
cvf::BoundingBox overlapBoundingBox;
std::array<cvf::Vec3d, 8> overlapVertices;
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices, innerBBox, &overlapVertices, &overlapBoundingBox );
EXPECT_DOUBLE_EQ( expectedOverlap, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
cvf::BoundingBox smallerInnerBBox( cvf::Vec3d( 25.0, 25.0, -10.0 ), cvf::Vec3d( 75.0, 75.0, 25.0 ) );
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices,
smallerInnerBBox,
&overlapVertices,
&overlapBoundingBox );
EXPECT_DOUBLE_EQ( 50 * 50 * 25, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
cvf::BoundingBox smallerBBox( cvf::Vec3d( 50.0, 50.0, 0.0 ), cvf::Vec3d( 100.0, 100.0, 100.0 ) );
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices, smallerBBox, &overlapVertices, &overlapBoundingBox );
double tipVolume = 50 * 50 * 50 * 0.5;
EXPECT_DOUBLE_EQ( tipVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
cvf::BoundingBox smallerBBox2( cvf::Vec3d( 0.0, 0.0, 0.0 ), cvf::Vec3d( 50.0, 50.0, 100.0 ) );
RigCellGeometryTools::estimateHexOverlapWithBoundingBox( cornerVertices,
smallerBBox2,
&overlapVertices,
&overlapBoundingBox );
double expectedVolume = ( totalCellVolume - 2 * tipVolume ) * 0.5;
EXPECT_DOUBLE_EQ( expectedVolume, RigCellGeometryTools::calculateCellVolume( overlapVertices ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, createPolygonTest )
{
cvf::Vec3d a = cvf::Vec3d( 1, 1, 1 );
cvf::Vec3d b = cvf::Vec3d( 1, 3.14159265359, 1 );
cvf::Vec3d b2 = cvf::Vec3d( 1, 3.1415926536, 1 );
cvf::Vec3d c = cvf::Vec3d( 5, 5, 1 );
cvf::Vec3d d = cvf::Vec3d( -2, 8, 1 );
std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> intersectionLineSegments;
intersectionLineSegments.push_back( { a, b } );
intersectionLineSegments.push_back( { b2, c } );
intersectionLineSegments.push_back( { c, d } );
intersectionLineSegments.push_back( { a, d } );
std::vector<std::vector<cvf::Vec3d>> polygons;
RigCellGeometryTools::createPolygonFromLineSegments( intersectionLineSegments, polygons );
EXPECT_EQ( polygons.size(), (size_t)1 );
EXPECT_EQ( polygons[0].size(), (size_t)5 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, createMultiplePolygonTest )
{
cvf::Vec3d a1 = cvf::Vec3d( 5, 4, 1 );
cvf::Vec3d b1 = cvf::Vec3d( 6, 3, 1 );
cvf::Vec3d c1 = cvf::Vec3d( 6, 4, 1 );
cvf::Vec3d a2 = cvf::Vec3d( 2, 1, 1 );
cvf::Vec3d b2 = cvf::Vec3d( 1, 3, 1 );
cvf::Vec3d c2 = cvf::Vec3d( 1, 5, 1 );
std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> intersectionLineSegments;
intersectionLineSegments.push_back( { a1, b1 } );
intersectionLineSegments.push_back( { b1, c1 } );
intersectionLineSegments.push_back( { a2, b2 } );
intersectionLineSegments.push_back( { b2, c2 } );
std::vector<std::vector<cvf::Vec3d>> polygons;
RigCellGeometryTools::createPolygonFromLineSegments( intersectionLineSegments, polygons );
EXPECT_EQ( polygons.size(), (size_t)2 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, createPolygonTestRealCase )
{
std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> intersectionLineSegments;
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900632511830, 20.000000000000000, -0.011799300447865143 ),
cvf::Vec3d( 13.498900632515129, 20.000000000000000, -0.011874744050458887 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900633056895, 20.000000000000000, -0.024268930302180504 ),
cvf::Vec3d( 13.498900632515127, 20.000000000000000, -0.011874744050458887 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900632511830, 20.000000000000000, -0.011799300447865143 ),
cvf::Vec3d( 13.498900631970063, 20.000000000000000, 0.00059488709383226715 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900195597713, 10.000000000000000, -0.016369358494277231 ),
cvf::Vec3d( 13.498900195056242, 10.000000000000000, -0.0039819325234285293 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900195597711, 10.000000000000000, -0.016369358494277241 ),
cvf::Vec3d( 13.498900195600806, 10.000000000000000, -0.016440172032184591 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900196142280, 10.000000000000000, -0.028827609381707260 ),
cvf::Vec3d( 13.498900195600807, 10.000000000000000, -0.016440172032184591 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900196142280, 10.000000000000000, -0.028827609381707260 ),
cvf::Vec3d( 13.498900414562046, 14.999139949621291, -0.026549475935230070 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900414637365, 15.000863944878075, -0.026548599914369600 ),
cvf::Vec3d( 13.498900633056895, 20.000000000000000, -0.024268930302180504 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900414637365, 15.000863944878075, -0.026548599914369600 ),
cvf::Vec3d( 13.498900414562046, 14.999139949621291, -0.026549475935230073 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900413511738, 14.999966890459870, -0.0016942968682188385 ),
cvf::Vec3d( 13.498900413514638, 15.000033259475705, -0.0016942630763332898 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900631970063, 20.000000000000000, 0.00059488709383226715 ),
cvf::Vec3d( 13.498900413514637, 15.000033259475705, -0.0016942630763332901 ) } );
intersectionLineSegments.push_back( { cvf::Vec3d( 13.498900413511738, 14.999966890459870, -0.0016942968682188385 ),
cvf::Vec3d( 13.498900195056240, 10.000000000000000, -0.0039819325234285319 ) } );
std::vector<std::vector<cvf::Vec3d>> polygons;
RigCellGeometryTools::createPolygonFromLineSegments( intersectionLineSegments, polygons );
EXPECT_EQ( polygons.size(), (size_t)1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, findCellAverageZTest )
{
std::array<cvf::Vec3d, 8> hexCorners;
hexCorners[0] = cvf::Vec3d( 0, 0, 0 );
hexCorners[1] = cvf::Vec3d( 1, 0, 0 );
hexCorners[2] = cvf::Vec3d( 1, 1, 0 );
hexCorners[3] = cvf::Vec3d( 0, 1, 0 );
hexCorners[4] = cvf::Vec3d( 0, 0, 1 );
hexCorners[5] = cvf::Vec3d( 1, 0, 1 );
hexCorners[6] = cvf::Vec3d( 1, 1, 1 );
hexCorners[7] = cvf::Vec3d( 0, 1, 1 );
cvf::Vec3d localX;
cvf::Vec3d localY;
cvf::Vec3d localZ;
RigCellGeometryTools::findCellLocalXYZ( hexCorners, localX, localY, localZ );
EXPECT_DOUBLE_EQ( localX[0], 1 );
EXPECT_DOUBLE_EQ( localX[1], 0 );
EXPECT_DOUBLE_EQ( localX[2], 0 );
EXPECT_DOUBLE_EQ( localY[0], 0 );
EXPECT_DOUBLE_EQ( localY[1], 1 );
EXPECT_DOUBLE_EQ( localY[2], 0 );
EXPECT_DOUBLE_EQ( localZ[0], 0 );
EXPECT_DOUBLE_EQ( localZ[1], 0 );
EXPECT_DOUBLE_EQ( localZ[2], 1 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, lengthCalcTest )
{
std::vector<cvf::Vec3d> polygonExample;
polygonExample.push_back( cvf::Vec3d( 0.00, 0.00, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 0.00, 2.50, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 1.50, 2.50, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 1.50, 0.00, 0.0 ) );
double length = RigCellGeometryTools::polygonLengthInLocalXdirWeightedByArea( polygonExample );
EXPECT_DOUBLE_EQ( length, 1.5 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, lengthCalcTestTriangle )
{
std::vector<cvf::Vec3d> trianglePolygonExample;
trianglePolygonExample.push_back( cvf::Vec3d( 0.00, 0.00, 0.0 ) );
trianglePolygonExample.push_back( cvf::Vec3d( 2.50, 2.50, 0.0 ) );
trianglePolygonExample.push_back( cvf::Vec3d( 2.50, 0.00, 0.0 ) );
double length = RigCellGeometryTools::polygonLengthInLocalXdirWeightedByArea( trianglePolygonExample );
EXPECT_GT( length, 1.7 );
EXPECT_LT( length, 1.8 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, polylinePolygonIntersectionTest )
{
std::vector<cvf::Vec3d> polygonExample;
polygonExample.push_back( cvf::Vec3d( 0.00, 0.00, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 0.00, 2.50, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 1.50, 2.50, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 1.50, 0.00, 0.0 ) );
std::vector<cvf::Vec3d> polyLine;
polyLine.push_back( cvf::Vec3d( -1.00, 0.00, 1.0 ) );
polyLine.push_back( cvf::Vec3d( 1.00, 2.0, 2.0 ) );
polyLine.push_back( cvf::Vec3d( 1.00, 3.00, 3.0 ) );
{
std::vector<std::vector<cvf::Vec3d>> clippedLines =
RigCellGeometryTools::clipPolylineByPolygon( polyLine, polygonExample, RigCellGeometryTools::INTERPOLATE_LINE_Z );
EXPECT_EQ( (size_t)1, clippedLines.size() );
EXPECT_EQ( (size_t)3, clippedLines.front().size() );
EXPECT_EQ( 0.0, clippedLines.front()[0].x() );
EXPECT_EQ( 1.0, clippedLines.front()[0].y() );
EXPECT_EQ( 1.5, clippedLines.front()[0].z() );
EXPECT_EQ( 1.0, clippedLines.front()[1].x() );
EXPECT_EQ( 2.0, clippedLines.front()[1].y() );
EXPECT_EQ( 2.0, clippedLines.front()[1].z() );
EXPECT_EQ( 1.0, clippedLines.front()[2].x() );
EXPECT_EQ( 2.5, clippedLines.front()[2].y() );
EXPECT_EQ( 2.5, clippedLines.front()[2].z() );
}
{
std::vector<std::vector<cvf::Vec3d>> clippedLines =
RigCellGeometryTools::clipPolylineByPolygon( polyLine, polygonExample, RigCellGeometryTools::USE_HUGEVAL );
EXPECT_EQ( (size_t)1, clippedLines.size() );
EXPECT_EQ( (size_t)3, clippedLines.front().size() );
EXPECT_EQ( 0.0, clippedLines.front()[0].x() );
EXPECT_EQ( 1.0, clippedLines.front()[0].y() );
EXPECT_EQ( HUGE_VAL, clippedLines.front()[0].z() );
EXPECT_EQ( 1.0, clippedLines.front()[1].x() );
EXPECT_EQ( 2.0, clippedLines.front()[1].y() );
EXPECT_EQ( 2.0, clippedLines.front()[1].z() );
EXPECT_EQ( 1.0, clippedLines.front()[2].x() );
EXPECT_EQ( 2.5, clippedLines.front()[2].y() );
EXPECT_EQ( HUGE_VAL, clippedLines.front()[2].z() );
}
polyLine.push_back( { -0.5, 1.5, 0.0 } );
{
std::vector<std::vector<cvf::Vec3d>> clippedLines =
RigCellGeometryTools::clipPolylineByPolygon( polyLine, polygonExample, RigCellGeometryTools::USE_HUGEVAL );
EXPECT_EQ( (size_t)2, clippedLines.size() );
EXPECT_EQ( (size_t)2, clippedLines.front().size() );
EXPECT_EQ( (size_t)3, clippedLines.back().size() );
EXPECT_EQ( 0.5, clippedLines.front()[0].x() );
EXPECT_EQ( 2.5, clippedLines.front()[0].y() );
EXPECT_EQ( HUGE_VAL, clippedLines.front()[0].z() );
EXPECT_EQ( 0.0, clippedLines.front()[1].x() );
EXPECT_EQ( 2.0, clippedLines.front()[1].y() );
EXPECT_EQ( HUGE_VAL, clippedLines.front()[1].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigCellGeometryTools, polylinePolygonIntersectionTest2 )
// Recreating bug...
{
std::vector<cvf::Vec3d> polygonExample;
polygonExample.push_back( cvf::Vec3d( 1.00, 0.00, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 0.00, 1.00, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( -1.00, 0.00, 0.0 ) );
polygonExample.push_back( cvf::Vec3d( 0.00, -1.00, 0.0 ) );
std::vector<cvf::Vec3d> polyLine1;
polyLine1.push_back( cvf::Vec3d( 2.0, 2.0, 0.0 ) );
polyLine1.push_back( cvf::Vec3d( 0.0, 0.0, 0.0 ) );
polyLine1.push_back( cvf::Vec3d( -2.0, -2.0, 0.0 ) );
std::vector<std::vector<cvf::Vec3d>> clippedLines1 =
RigCellGeometryTools::clipPolylineByPolygon( polyLine1, polygonExample, RigCellGeometryTools::INTERPOLATE_LINE_Z );
EXPECT_EQ( (size_t)1, clippedLines1.size() );
EXPECT_EQ( 0.0, clippedLines1.front()[0].z() );
std::vector<cvf::Vec3d> polyLine2;
polyLine2.push_back( cvf::Vec3d( 2.0, 0.0, 0.0 ) );
polyLine2.push_back( cvf::Vec3d( 0.0, 0.0, 0.0 ) );
polyLine2.push_back( cvf::Vec3d( -2.0, 0.0, 0.0 ) );
std::vector<std::vector<cvf::Vec3d>> clippedLines2 =
RigCellGeometryTools::clipPolylineByPolygon( polyLine2, polygonExample, RigCellGeometryTools::INTERPOLATE_LINE_Z );
EXPECT_EQ( (size_t)1, clippedLines2.size() );
EXPECT_EQ( 0.0, clippedLines2.front()[0].z() );
// Since both the line and the polygon is in the z=0 plane, the expected clipped line should be in this plane
}
#include "Completions/RigWellPathStimplanIntersector.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigWellPathStimplanIntersector, intersection )
{
{
cvf::Mat4d fractureXf = cvf::Mat4d::IDENTITY;
fractureXf.setTranslation( { 50.0f, 0.0f, 0.0f } );
// std::vector<cvf::Vec3f> fracturePolygon ={ {0.0f, 0.0f, 0.0f}, {5.0f, 10.0f, 0.0f}, {10.0f, 0.0f, 0.0f} };
double perforationLength = 25.0;
std::vector<cvf::Vec3d> wellPathPoints = { { 50.0f - 4.0f, 6.0f, 10.0f },
{ 50.0f + 6.0f, 6.0f, 0.0f },
{ 50.0f + 10.0f, 10.0f, -100.0f } };
double wellRadius = 1.5;
std::vector<std::vector<cvf::Vec3d>> stpCellPolygons = {
{ { 0.0f, 0.0f, 0.0f }, { 0.0f, 5.0f, 0.0f }, { 5.0f, 5.0f, 0.0f }, { 5.0f, 0.0f, 0.0f } },
{ { 0.5f, 0.0f, 0.0f }, { 0.5f, 5.0f, 0.0f }, { 10.0f, 5.0f, 0.0f }, { 10.0f, 0.0f, 0.0f } },
{ { 0.0f, 5.0f, 0.0f }, { 0.0f, 10.0f, 0.0f }, { 5.0f, 10.0f, 0.0f }, { 5.0f, 5.0f, 0.0f } },
{ { 5.0f, 5.0f, 0.0f }, { 5.0f, 10.0f, 0.0f }, { 10.0f, 10.0f, 0.0f }, { 10.0f, 5.0f, 0.0f } },
};
std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection> stimPlanCellIdxToIntersectionInfoMap;
RigWellPathStimplanIntersectorTester::testCalculate( fractureXf,
wellPathPoints,
wellRadius,
perforationLength,
stpCellPolygons,
stimPlanCellIdxToIntersectionInfoMap );
EXPECT_EQ( (size_t)2, stimPlanCellIdxToIntersectionInfoMap.size() );
auto it = stimPlanCellIdxToIntersectionInfoMap.begin();
EXPECT_EQ( (size_t)2, it->first );
EXPECT_EQ( 1, it->second.endpointCount );
++it;
EXPECT_EQ( (size_t)3, it->first );
EXPECT_EQ( 1, it->second.endpointCount );
}
{
cvf::Mat4d fractureXf = cvf::Mat4d::IDENTITY;
// std::vector<cvf::Vec3f> fracturePolygon ={ {0.0f, 0.0f, 0.0f}, {5.0f, 10.0f, 0.0f}, {10.0f, 0.0f,
// 0.0f} };
double perforationLength = 10;
double wellRadius = 1.5;
std::vector<std::vector<cvf::Vec3d>> stpCellPolygons = {
{ { 0.0f, 0.0f, 0.0f }, { 0.0f, 5.0f, 0.0f }, { 5.0f, 5.0f, 0.0f }, { 5.0f, 0.0f, 0.0f } },
{ { 5.0f, 0.0f, 0.0f }, { 5.0f, 5.0f, 0.0f }, { 10.0f, 5.0f, 0.0f }, { 10.0f, 0.0f, 0.0f } },
{ { 0.0f, 5.0f, 0.0f }, { 0.0f, 10.0f, 0.0f }, { 5.0f, 10.0f, 0.0f }, { 5.0f, 5.0f, 0.0f } },
{ { 5.0f, 5.0f, 0.0f }, { 5.0f, 10.0f, 0.0f }, { 10.0f, 10.0f, 0.0f }, { 10.0f, 5.0f, 0.0f } },
};
{
std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection> stimPlanCellIdxToIntersectionInfoMap;
std::vector<cvf::Vec3d> wellPathPoints = { { 1.0f, 0.5f, 10.0f }, { 1.0f, 1.5f, -10.0f } };
RigWellPathStimplanIntersectorTester::testCalculate( fractureXf,
wellPathPoints,
wellRadius,
perforationLength,
stpCellPolygons,
stimPlanCellIdxToIntersectionInfoMap );
EXPECT_EQ( (size_t)1, stimPlanCellIdxToIntersectionInfoMap.size() );
auto it = stimPlanCellIdxToIntersectionInfoMap.begin();
EXPECT_EQ( (size_t)0, it->first );
EXPECT_EQ( 2, it->second.endpointCount );
}
{
std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection> stimPlanCellIdxToIntersectionInfoMap;
std::vector<cvf::Vec3d> wellPathPoints = { { 1.0f, 0.5f, 10.0f }, { 1.0f, 1.0f, 0.5f } };
RigWellPathStimplanIntersectorTester::testCalculate( fractureXf,
wellPathPoints,
wellRadius,
perforationLength,
stpCellPolygons,
stimPlanCellIdxToIntersectionInfoMap );
EXPECT_EQ( (size_t)1, stimPlanCellIdxToIntersectionInfoMap.size() );
auto it = stimPlanCellIdxToIntersectionInfoMap.begin();
EXPECT_EQ( (size_t)0, it->first );
EXPECT_EQ( 2, it->second.endpointCount );
}
{
std::map<size_t, RigWellPathStimplanIntersector::WellCellIntersection> stimPlanCellIdxToIntersectionInfoMap;
std::vector<cvf::Vec3d> wellPathPoints = { { 1.0f, 0.5f, 10.0f },
{ 1.0f, 1.0f, 0.5f },
{ 1.0f, 1.5f, -0.5f },
{ 1.0f, 2.0f, -10.0f } };
RigWellPathStimplanIntersectorTester::testCalculate( fractureXf,
wellPathPoints,
wellRadius,
perforationLength,
stpCellPolygons,
stimPlanCellIdxToIntersectionInfoMap );
EXPECT_EQ( (size_t)1, stimPlanCellIdxToIntersectionInfoMap.size() );
auto it = stimPlanCellIdxToIntersectionInfoMap.begin();
EXPECT_EQ( (size_t)0, it->first );
EXPECT_EQ( 2, it->second.endpointCount );
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Test of whether we can transport edge information trough clipper clipping
// Seems as if it might be possible, but clipper will ignore the edge information
// processed by the callback if one of the edges is horizontal
//
#include "clipper/clipper.hpp"
double clipperConversionFactor2 = 10000; // For transform to clipper int
ClipperLib::IntPoint toClipperEdgePoint( const cvf::Vec3d& cvfPoint )
{
int xInt = cvfPoint.x() * clipperConversionFactor2;
int yInt = cvfPoint.y() * clipperConversionFactor2;
int zInt = cvfPoint.z();
return ClipperLib::IntPoint( xInt, yInt, zInt );
}
cvf::Vec3d fromClipperEdgePoint( const ClipperLib::IntPoint& clipPoint )
{
double zDValue;
if ( clipPoint.Z == std::numeric_limits<int>::max() )
{
zDValue = HUGE_VAL;
}
else
{
zDValue = clipPoint.Z;
}
return cvf::Vec3d( clipPoint.X / clipperConversionFactor2, clipPoint.Y / clipperConversionFactor2, zDValue );
}
void swapPointsIfNeedeed( ClipperLib::IntPoint*& p1, ClipperLib::IntPoint*& p2 )
{
if ( p1->Z > p2->Z )
{
std::swap( p1, p2 );
}
if ( ( p2->Z - p1->Z ) > 1 ) // End edge of polygon
{
std::swap( p1, p2 ); // Swap back
}
}
void clipperEdgeIntersectCallback( ClipperLib::IntPoint& e1bot,
ClipperLib::IntPoint& e1top,
ClipperLib::IntPoint& e2bot,
ClipperLib::IntPoint& e2top,
ClipperLib::IntPoint& pt )
{
ClipperLib::IntPoint* e11 = &e1bot;
ClipperLib::IntPoint* e12 = &e1top;
ClipperLib::IntPoint* e21 = &e2bot;
ClipperLib::IntPoint* e22 = &e2top;
swapPointsIfNeedeed( e11, e12 );
swapPointsIfNeedeed( e21, e22 );
cvf::Vec3f e1( e12->X - e11->X, e12->Y - e11->Y, 0.0 );
cvf::Vec3f e2( e22->X - e21->X, e22->Y - e21->Y, 0.0 );
cvf::Vec3f up = e1 ^ e2;
if ( up.z() > 0 )
{
pt.Z = e12->Z;
std::cout << "E1 :" << e11->Z << " " << e12->Z << std::endl;
std::cout << "E2 :" << e21->Z << " " << e22->Z << std::endl << std::endl;
}
else
{
pt.Z = e22->Z;
std::cout << "E1 :" << e21->Z << " " << e22->Z << std::endl;
std::cout << "E2 :" << e11->Z << " " << e12->Z << std::endl << std::endl;
}
}
TEST( RigCellGeometryTools, ClipperEdgeTracking )
{
// If the first edges of the polygons are horizontal, the edge tracking will fail.
// Encode polygon and edge into Z coordinate of the vertex
std::vector<cvf::Vec3d> polygon1 = { { 0.0, 0.51, 1002.0 }, { 1.0, 0.5, 1000.0 }, { 0.0, 1.0, 1001.0 } };
std::vector<cvf::Vec3d> polygon2 = { { 0.5, 0.01, 2002.0 }, { 1.0, 0.0, 2000.0 }, { 0.5, 1.0, 2001.0 } };
std::vector<std::vector<cvf::Vec3d>> clippedPolygons;
// Convert to int for clipper library and store as clipper "path"
ClipperLib::Path polygon1path;
for ( const cvf::Vec3d& v : polygon1 )
{
polygon1path.push_back( toClipperEdgePoint( v ) );
}
ClipperLib::Path polygon2path;
for ( const cvf::Vec3d& v : polygon2 )
{
polygon2path.push_back( toClipperEdgePoint( v ) );
}
ClipperLib::Clipper clpr;
clpr.AddPath( polygon1path, ClipperLib::ptSubject, true );
clpr.AddPath( polygon2path, ClipperLib::ptClip, true );
clpr.ZFillFunction( &clipperEdgeIntersectCallback );
ClipperLib::Paths solution;
clpr.Execute( ClipperLib::ctIntersection, solution, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd );
// Convert back to std::vector<std::vector<cvf::Vec3d> >
for ( ClipperLib::Path pathInSol : solution )
{
std::vector<cvf::Vec3d> clippedPolygon;
for ( ClipperLib::IntPoint IntPosition : pathInSol )
{
clippedPolygon.push_back( fromClipperEdgePoint( IntPosition ) );
}
clippedPolygons.push_back( clippedPolygon );
}
int pIdx = 1;
for ( auto& polygon : clippedPolygons )
{
std::cout << "Polygon: " << pIdx << std::endl;
for ( auto& point : polygon )
{
std::cout << " [ " << point[0] << ", " << point[1] << ", " << point[2] << " ]" << std::endl;
}
pIdx++;
}
}

View File

@@ -0,0 +1,548 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "RigHexGradientTools.h"
#include "../cafHexInterpolator/cafHexInterpolator.h"
#include "cvfMatrix4.h"
//--------------------------------------------------------------------------------------------------
/// GTEST_FILTER="Test_RigHexGradientTools*"
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForIdentityElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
std::array<double, 8> cornerValues = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
for ( int i = 0; i < 8; i++ )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[i].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForScaledIdentityElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
for ( auto& v : hexCorners )
v *= 2.5;
std::array<double, 8> cornerValues = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
for ( int i = 0; i < 8; i++ )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[i].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForTranslatedIdentityElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
for ( auto& v : hexCorners )
v += { 3.2, 9.5, -20.3 };
std::array<double, 8> cornerValues = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
for ( int i = 0; i < 8; i++ )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[i].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForRotatedIdentityElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
cvf::Mat4d rot = cvf::Mat4d::fromRotation( { 1, 1, 0 }, 3.0 );
for ( auto& v : hexCorners )
v.transformPoint( rot );
std::array<double, 8> cornerValues = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
for ( int i = 0; i < 8; i++ )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[i].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[i].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
// Set a higher value in the first corner
std::array<double, 8> cornerValues = { 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
// The adjacent corners should a non-zero gradient in the direction
// towards the first corner
EXPECT_DOUBLE_EQ( -0.5, gradients[0].x() );
EXPECT_DOUBLE_EQ( -0.5, gradients[0].y() );
EXPECT_DOUBLE_EQ( -0.5, gradients[0].z() );
EXPECT_DOUBLE_EQ( -0.5, gradients[1].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[1].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[1].z() );
EXPECT_DOUBLE_EQ( 0.0, gradients[3].x() );
EXPECT_DOUBLE_EQ( -0.5, gradients[3].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[3].z() );
EXPECT_DOUBLE_EQ( 0.0, gradients[4].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[4].y() );
EXPECT_DOUBLE_EQ( -0.5, gradients[4].z() );
// Non-adjacent should be unaffected
std::array<int, 4> independentCorners = { 2, 5, 7, 6 };
for ( auto c : independentCorners )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[c].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[c].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[c].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForLongElement )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 2.0, -1.0, 1.0 ),
cvf::Vec3d( 2.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
// Set a higher value in the first corner
std::array<double, 8> cornerValues = { 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
// The adjacent corners should a non-zero gradient in the direction
// towards the first corner
EXPECT_DOUBLE_EQ( -1.0 / 3.0, gradients[0].x() );
EXPECT_DOUBLE_EQ( -0.5, gradients[0].y() );
EXPECT_DOUBLE_EQ( -0.5, gradients[0].z() );
EXPECT_DOUBLE_EQ( -1.0 / 3.0, gradients[1].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[1].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[1].z() );
EXPECT_DOUBLE_EQ( 0.0, gradients[3].x() );
EXPECT_DOUBLE_EQ( -0.5, gradients[3].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[3].z() );
EXPECT_DOUBLE_EQ( 0.0, gradients[4].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[4].y() );
EXPECT_DOUBLE_EQ( -0.5, gradients[4].z() );
// Non-adjacent should be unaffected
std::array<int, 4> independentCorners = { 2, 5, 7, 6 };
for ( auto c : independentCorners )
{
EXPECT_DOUBLE_EQ( 0.0, gradients[c].x() );
EXPECT_DOUBLE_EQ( 0.0, gradients[c].y() );
EXPECT_DOUBLE_EQ( 0.0, gradients[c].z() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GenerateJacobianForIdentity )
{
// Identity element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
for ( int i = 0; i < 8; i++ )
{
cvf::Mat3d actualJacobian = caf::HexInterpolator::jacobi( hexCorners, hexCorners[i] );
// Calculate expected jacobian
double dx = 2.0;
double dy = 2.0;
double dz = 2.0;
double di = 2.0;
double dj = 2.0;
double dk = 2.0;
cvf::Mat3d expectedJacobian( dx / di, 0.0, 0.0, 0.0, dy / dj, 0.0, 0.0, 0.0, dz / dk );
cvf::Mat3d identityMat = cvf::Mat3d::IDENTITY;
for ( int col = 0; col < 3; col++ )
{
for ( int row = 0; row < 3; row++ )
{
EXPECT_DOUBLE_EQ( expectedJacobian.rowCol( row, col ), actualJacobian.rowCol( row, col ) );
EXPECT_DOUBLE_EQ( identityMat.rowCol( row, col ), actualJacobian.rowCol( row, col ) );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GenerateJacobianForIdentityScaled )
{
// Identity element
std::array<cvf::Vec3d, 8> normalizedCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
double scale = 2.5;
std::array<cvf::Vec3d, 8> hexCorners;
for ( int i = 0; i < 8; i++ )
{
hexCorners[i] = normalizedCorners[i] * scale;
}
for ( int i = 0; i < 8; i++ )
{
cvf::Mat3d actualJacobian = caf::HexInterpolator::jacobi( hexCorners, normalizedCorners[i] );
// Calculate expected jacobian
double dx = 5.0;
double dy = 5.0;
double dz = 5.0;
double di = 2.0;
double dj = 2.0;
double dk = 2.0;
cvf::Mat3d expectedJacobian( dx / di, 0.0, 0.0, 0.0, dy / dj, 0.0, 0.0, 0.0, dz / dk );
cvf::Mat3d identityMat = cvf::Mat3d::IDENTITY;
for ( int col = 0; col < 3; col++ )
{
for ( int row = 0; row < 3; row++ )
{
EXPECT_DOUBLE_EQ( expectedJacobian.rowCol( row, col ), actualJacobian.rowCol( row, col ) );
EXPECT_DOUBLE_EQ( identityMat.rowCol( row, col ) * scale, actualJacobian.rowCol( row, col ) );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GenerateJacobianForLongElement )
{
// Try a more complex element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 2.0, -1.0, 1.0 ),
cvf::Vec3d( 2.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
cvf::Vec3d corner0( -1.0, -1.0, -1.0 );
cvf::Mat3d actualJacobian = caf::HexInterpolator::jacobi( hexCorners, corner0 );
// Calculate expected jacobian
double dx = 3.0;
double dy = 2.0;
double dz = 2.0;
double di = 2.0;
double dj = 2.0;
double dk = 2.0;
cvf::Mat3d expectedJacobian( dx / di, 0.0, 0.0, 0.0, dy / dj, 0.0, 0.0, 0.0, dz / dk );
for ( int col = 0; col < 3; col++ )
{
for ( int row = 0; row < 3; row++ )
{
EXPECT_DOUBLE_EQ( expectedJacobian.rowCol( row, col ), actualJacobian.rowCol( row, col ) );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForRotatedElement )
{
// Try a more complex element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, -1.0, 1.0 ),
cvf::Vec3d( 1.0, 1.0, 1.0 ),
cvf::Vec3d( -1.0, 1.0, 1.0 ) };
cvf::Vec3d corner0( -1.0, -1.0, -1.0 );
cvf::Mat4d rot = cvf::Mat4d::fromRotation( { 1, 0, 0 }, cvf::PI_D / 2.0 );
for ( auto& v : hexCorners )
v.transformPoint( rot );
EXPECT_DOUBLE_EQ( 1.0, hexCorners[0].y() );
EXPECT_DOUBLE_EQ( -1.0, hexCorners[4].z() );
// Set a higher value in the first corner
std::array<double, 8> cornerValues = { 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
EXPECT_NEAR( -0.5, gradients[0].x(), 1.0e-10 );
EXPECT_NEAR( 0.5, gradients[0].y(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[0].z(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[1].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[1].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[1].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[3].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[3].y(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[3].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[4].x(), 1.0e-10 );
EXPECT_NEAR( 0.5, gradients[4].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[4].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].z(), 1.0e-10 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GradientsForRotatedAndStretchedElement )
{
// Try a more complex element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, -1.0, -1.0 ),
cvf::Vec3d( 1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, 1.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 3.0 ),
cvf::Vec3d( 1.0, -1.0, 3.0 ),
cvf::Vec3d( 1.0, 1.0, 3.0 ),
cvf::Vec3d( -1.0, 1.0, 3.0 ) };
cvf::Vec3d corner0( -1.0, -1.0, -1.0 );
cvf::Mat4d rot = cvf::Mat4d::fromRotation( { 1, 0, 0 }, cvf::PI_D / 2.0 );
for ( auto& v : hexCorners )
v.transformPoint( rot );
EXPECT_DOUBLE_EQ( 1.0, hexCorners[0].y() );
EXPECT_DOUBLE_EQ( -1.0, hexCorners[4].z() );
// Set a higher value in the first corner
std::array<double, 8> cornerValues = { 2.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
std::array<cvf::Vec3d, 8> gradients = RigHexGradientTools::gradients( hexCorners, cornerValues );
EXPECT_NEAR( -0.5, gradients[0].x(), 1.0e-10 );
EXPECT_NEAR( 0.25, gradients[0].y(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[0].z(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[1].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[1].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[1].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[2].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[3].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[3].y(), 1.0e-10 );
EXPECT_NEAR( -0.5, gradients[3].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[4].x(), 1.0e-10 );
EXPECT_NEAR( 0.25, gradients[4].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[4].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[5].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[6].z(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].x(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].y(), 1.0e-10 );
EXPECT_NEAR( 0.0, gradients[7].z(), 1.0e-10 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexGradientTools, GenerateJacobianForRotatedElement )
{
// Try a more complex element
std::array<cvf::Vec3d, 8> hexCorners = { cvf::Vec3d( -1.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, -1.0, -1.0 ),
cvf::Vec3d( 2.0, 3.0, -1.0 ),
cvf::Vec3d( -1.0, 3.0, -1.0 ),
cvf::Vec3d( -1.0, -1.0, 4.0 ),
cvf::Vec3d( 2.0, -1.0, 4.0 ),
cvf::Vec3d( 2.0, 3.0, 4.0 ),
cvf::Vec3d( -1.0, 3.0, 4.0 ) };
cvf::Vec3d corner0( -1.0, -1.0, -1.0 );
cvf::Mat4d rot = cvf::Mat4d::fromRotation( { 1, 0, 0 }, cvf::PI_D / 2.0 );
for ( auto& v : hexCorners )
v.transformPoint( rot );
cvf::Mat3d actualJacobian = caf::HexInterpolator::jacobi( hexCorners, corner0 );
// Calculate expected jacobian
cvf::Vec3d dx_rot = ( hexCorners[1] - hexCorners[0] );
cvf::Vec3d dy_rot = ( hexCorners[3] - hexCorners[0] );
cvf::Vec3d dz_rot = ( hexCorners[4] - hexCorners[0] );
double di = 2.0;
double dj = 2.0;
double dk = 2.0;
cvf::Mat3d expectedJacobian( dx_rot.x() / di,
dx_rot.y() / di,
dx_rot.z() / di,
dy_rot.x() / dj,
dy_rot.y() / dj,
dy_rot.z() / dj,
dz_rot.x() / dk,
dz_rot.y() / dk,
dz_rot.z() / dk );
expectedJacobian.transpose();
for ( int row = 0; row < 3; row++ )
{
for ( int col = 0; col < 3; col++ )
{
EXPECT_DOUBLE_EQ( expectedJacobian.rowCol( row, col ), actualJacobian.rowCol( row, col ) );
}
}
}

View File

@@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "QDateTime"
#include "QDebug"
#include "RigHexIntersectionTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexIntersectionTools, planeHexCellIntersectionTest )
{
cvf::Vec3d hexCorners[8];
hexCorners[0] = cvf::Vec3d( 0, 0, 0 );
hexCorners[1] = cvf::Vec3d( 1, 0, 0 );
hexCorners[2] = cvf::Vec3d( 0, 1, 0 );
hexCorners[3] = cvf::Vec3d( 0, 0, 1 );
hexCorners[4] = cvf::Vec3d( 0, 1, 1 );
hexCorners[5] = cvf::Vec3d( 1, 1, 0 );
hexCorners[6] = cvf::Vec3d( 1, 0, 1 );
hexCorners[7] = cvf::Vec3d( 1, 1, 1 );
std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> intersectionLineSegments;
bool isCellIntersected = false;
cvf::Plane fracturePlane;
fracturePlane.setFromPointAndNormal( cvf::Vec3d( 0.5, 0.5, 0.5 ), cvf::Vec3d( 1, 0, 0 ) );
isCellIntersected =
RigHexIntersectionTools::planeHexCellIntersection( hexCorners, fracturePlane, intersectionLineSegments );
EXPECT_TRUE( isCellIntersected );
fracturePlane.setFromPointAndNormal( cvf::Vec3d( 1.5, 1.5, 1.5 ), cvf::Vec3d( 1, 0, 0 ) );
isCellIntersected =
RigHexIntersectionTools::planeHexCellIntersection( hexCorners, fracturePlane, intersectionLineSegments );
EXPECT_FALSE( isCellIntersected );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigHexIntersectionTools, DISABLED_planeHexCellIntersectionPerformanceTest )
{
cvf::Vec3d hexCorners[8];
hexCorners[0] = cvf::Vec3d( 0, 0, 0 );
hexCorners[1] = cvf::Vec3d( 1, 0, 0 );
hexCorners[2] = cvf::Vec3d( 0, 1, 0 );
hexCorners[3] = cvf::Vec3d( 0, 0, 1 );
hexCorners[4] = cvf::Vec3d( 0, 1, 1 );
hexCorners[5] = cvf::Vec3d( 1, 1, 0 );
hexCorners[6] = cvf::Vec3d( 1, 0, 1 );
hexCorners[7] = cvf::Vec3d( 1, 1, 1 );
bool isCellIntersected = false;
cvf::Plane fracturePlaneIntersecting;
cvf::Plane fracturePlaneNotIntersecting;
fracturePlaneNotIntersecting.setFromPointAndNormal( cvf::Vec3d( 1.5, 1.5, 1.5 ), cvf::Vec3d( 1, 0, 0 ) );
fracturePlaneIntersecting.setFromPointAndNormal( cvf::Vec3d( 0.5, 0.5, 0.5 ), cvf::Vec3d( 1, 0, 0 ) );
QTime timeTotal;
timeTotal.start();
for ( int run = 0; run < 5; run++ )
{
QTime timeLocal;
timeLocal.start();
for ( int i = 0; i < 2000000; i++ )
{
std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> intersectionLineSegments;
isCellIntersected = RigHexIntersectionTools::planeHexCellIntersection( hexCorners,
fracturePlaneIntersecting,
intersectionLineSegments );
isCellIntersected = RigHexIntersectionTools::planeHexCellIntersection( hexCorners,
fracturePlaneNotIntersecting,
intersectionLineSegments );
}
qDebug() << "Time rim elapsed: " << timeLocal.elapsed();
}
qDebug() << "Time total elapsed: " << timeTotal.elapsed() << " intersected: " << static_cast<int>( isCellIntersected );
}

View File

@@ -0,0 +1,128 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "RigEclipseCaseData.h"
#include "RigGridManager.h"
#include "RigMainGrid.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigGridManager, BasicTest )
{
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( nullptr );
eclipseCase->setMainGrid( mainGridA.p() );
EXPECT_EQ( mainGridA->refCount(), 2 );
RigGridManager gridCollection;
gridCollection.addCase( eclipseCase.p() );
EXPECT_EQ( mainGridA->refCount(), 2 );
cvf::ref<RigMainGrid> mainGridB = mainGridA;
EXPECT_EQ( mainGridA->refCount(), 3 );
cvf::ref<RigMainGrid> existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
EXPECT_TRUE( existingGrid.notNull() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigGridManager, EqualTests )
{
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
mainGridA->nodes().push_back( cvf::Vec3d( 0, 0, 0 ) );
mainGridA->nodes().push_back( cvf::Vec3d( 0, 0, 1 ) );
mainGridA->nodes().push_back( cvf::Vec3d( 0, 0, 2 ) );
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( nullptr );
eclipseCase->setMainGrid( mainGridA.p() );
RigGridManager gridCollection;
gridCollection.addCase( eclipseCase.p() );
cvf::ref<RigMainGrid> mainGridB = new RigMainGrid;
cvf::ref<RigMainGrid> existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
EXPECT_TRUE( existingGrid.isNull() );
mainGridB->nodes().push_back( cvf::Vec3d( 0, 0, 0 ) );
existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
EXPECT_TRUE( existingGrid.isNull() );
// Insert nodes in opposite direction
mainGridB->nodes().push_back( cvf::Vec3d( 0, 0, 2 ) );
mainGridB->nodes().push_back( cvf::Vec3d( 0, 0, 1 ) );
existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
EXPECT_TRUE( existingGrid.isNull() );
// Overwrite to match the node structure of mainGridA
mainGridB->nodes()[1] = cvf::Vec3d( 0, 0, 1 );
mainGridB->nodes()[2] = cvf::Vec3d( 0, 0, 2 );
existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
EXPECT_TRUE( existingGrid.notNull() );
}
/*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, BasicTest)
{
cvf::ref<RigSingleWellResultsData> wellCellTimeHistory = new RigSingleWellResultsData;
QDateTime wellStartTime = QDateTime::currentDateTime();
int wellTimeStepCount = 5;
wellCellTimeHistory->m_wellCellsTimeSteps.resize(wellTimeStepCount);
int i;
for (i = 0; i < wellTimeStepCount; i++)
{
wellCellTimeHistory->m_wellCellsTimeSteps[i].m_timestamp = QDateTime(wellStartTime).addYears(i);
}
int resultTimeStepCount = 2 * wellTimeStepCount;
std::vector<QDateTime> resultTimes;
for (i = 0; i < resultTimeStepCount; i++)
{
resultTimes.push_back(QDateTime(wellStartTime).addMonths(i * 6));
}
wellCellTimeHistory->computeMappingFromResultTimeIndicesToWellTimeIndices(resultTimes);
for (i = 0; i < resultTimeStepCount; i++)
{
qDebug() << "Index" << i << "is " << wellCellTimeHistory->m_resultTimeStepIndexToWellTimeStepIndex[i];
const RigWellResultFrame& wellCells =
wellCellTimeHistory->wellResultFrame(wellCellTimeHistory->m_resultTimeStepIndexToWellTimeStepIndex[i]); qDebug() <<
wellCells.m_timestamp;
}
}
*/

View File

@@ -0,0 +1,293 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "RigStatisticsMath.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, BasicTest )
{
std::vector<double> values;
values.push_back( HUGE_VAL );
values.push_back( 2788.2723335651900 );
values.push_back( -22481.0927881701000 );
values.push_back( 68778.6851686236000 );
values.push_back( -76092.8157632591000 );
values.push_back( 6391.97999909729003 );
values.push_back( 65930.1200169780000 );
values.push_back( -27696.2320267235000 );
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 96161.7546348456000 );
values.push_back( 73875.6716288563000 );
values.push_back( 80720.4378655615000 );
values.push_back( -98649.8109937874000 );
values.push_back( 99372.9362079615000 );
values.push_back( -HUGE_VAL );
values.push_back( -57020.4389966513000 );
double min, max, sum, range, mean, stdev;
RigStatisticsMath::calculateBasicStatistics( values, &min, &max, &sum, &range, &mean, &stdev );
EXPECT_DOUBLE_EQ( -98649.8109937874000, min );
EXPECT_DOUBLE_EQ( 99372.9362079615000, max );
EXPECT_DOUBLE_EQ( 212079.46728689762, sum );
EXPECT_DOUBLE_EQ( 198022.7472017490000, range );
EXPECT_DOUBLE_EQ( 16313.8051759152000, mean );
EXPECT_DOUBLE_EQ( 66104.391542887200, stdev );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, RankPercentiles )
{
std::vector<double> values;
values.push_back( -HUGE_VAL );
values.push_back( 2788.2723335651900 );
values.push_back( -22481.0927881701000 );
values.push_back( 68778.6851686236000 );
values.push_back( -76092.8157632591000 );
values.push_back( 6391.97999909729003 );
values.push_back( 65930.1200169780000 );
values.push_back( -27696.2320267235000 );
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 96161.7546348456000 );
values.push_back( 73875.6716288563000 );
values.push_back( 80720.4378655615000 );
values.push_back( -98649.8109937874000 );
values.push_back( 99372.9362079615000 );
values.push_back( HUGE_VAL );
values.push_back( -57020.4389966513000 );
std::vector<double> pValPos;
pValPos.push_back( 10 );
pValPos.push_back( 40 );
pValPos.push_back( 50 );
pValPos.push_back( 90 );
std::vector<double> pVals = RigStatisticsMath::calculateNearestRankPercentiles( values, pValPos );
EXPECT_DOUBLE_EQ( -76092.8157632591000, pVals[0] );
EXPECT_DOUBLE_EQ( 2788.2723335651900, pVals[1] );
EXPECT_DOUBLE_EQ( 6391.979999097290, pVals[2] );
EXPECT_DOUBLE_EQ( 96161.7546348456000, pVals[3] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, HistogramPercentiles )
{
std::vector<double> values;
values.push_back( HUGE_VAL );
values.push_back( 2788.2723335651900 );
values.push_back( -22481.0927881701000 );
values.push_back( 68778.6851686236000 );
values.push_back( -76092.8157632591000 );
values.push_back( 6391.97999909729003 );
values.push_back( 65930.1200169780000 );
values.push_back( -27696.2320267235000 );
values.push_back( -HUGE_VAL );
values.push_back( -HUGE_VAL );
values.push_back( 96161.7546348456000 );
values.push_back( 73875.6716288563000 );
values.push_back( 80720.4378655615000 );
values.push_back( -98649.8109937874000 );
values.push_back( 99372.9362079615000 );
values.push_back( HUGE_VAL );
values.push_back( -57020.4389966513000 );
double min, max, range, mean, stdev;
RigStatisticsMath::calculateBasicStatistics( values, &min, &max, nullptr, &range, &mean, &stdev );
std::vector<size_t> histogram;
RigHistogramCalculator histCalc( min, max, 100, &histogram );
histCalc.addData( values );
double p10, p50, p90;
p10 = histCalc.calculatePercentil( 0.1 );
p50 = histCalc.calculatePercentil( 0.5 );
p90 = histCalc.calculatePercentil( 0.9 );
EXPECT_DOUBLE_EQ( -76273.240559989776, p10 );
EXPECT_DOUBLE_EQ( 5312.1312871307755, p50 );
EXPECT_DOUBLE_EQ( 94818.413022321271, p90 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, InterpolatedPercentiles )
{
std::vector<double> values;
values.push_back( HUGE_VAL );
values.push_back( 2788.2723335651900 );
values.push_back( -22481.0927881701000 );
values.push_back( 68778.6851686236000 );
values.push_back( -76092.8157632591000 );
values.push_back( 6391.97999909729003 );
values.push_back( 65930.1200169780000 );
values.push_back( -27696.2320267235000 );
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 96161.7546348456000 );
values.push_back( 73875.6716288563000 );
values.push_back( 80720.4378655615000 );
values.push_back( -98649.8109937874000 );
values.push_back( 99372.9362079615000 );
values.push_back( HUGE_VAL );
values.push_back( -57020.4389966513000 );
std::vector<double> pValPos;
pValPos.push_back( 10 );
pValPos.push_back( 40 );
pValPos.push_back( 50 );
pValPos.push_back( 90 );
std::vector<double> pVals = RigStatisticsMath::calculateInterpolatedPercentiles( values, pValPos );
EXPECT_DOUBLE_EQ( -72278.340409937548, pVals[0] );
EXPECT_DOUBLE_EQ( -2265.6006907818719, pVals[1] );
EXPECT_DOUBLE_EQ( 6391.9799990972897, pVals[2] );
EXPECT_DOUBLE_EQ( 93073.49128098879, pVals[3] );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, Accumulators )
{
std::vector<double> values;
const double v1 = 2788.2723335651900;
const double v2 = 68778.6851686236000;
const double v3 = -98649.8109937874000;
const double v4 = -57020.4389966513000;
values.push_back( HUGE_VAL );
values.push_back( v1 );
values.push_back( v2 );
values.push_back( -HUGE_VAL );
values.push_back( v3 );
values.push_back( HUGE_VAL );
values.push_back( v4 );
{
MinMaxAccumulator acc;
acc.addData( values );
EXPECT_DOUBLE_EQ( v3, acc.min );
EXPECT_DOUBLE_EQ( v2, acc.max );
}
{
PosNegAccumulator acc;
acc.addData( values );
EXPECT_DOUBLE_EQ( v1, acc.pos );
EXPECT_DOUBLE_EQ( v4, acc.neg );
}
{
SumCountAccumulator acc;
acc.addData( values );
const double sum = v1 + v2 + v3 + v4;
EXPECT_FALSE( std::isinf( acc.valueSum ) );
EXPECT_DOUBLE_EQ( sum, acc.valueSum );
EXPECT_EQ( 4u, acc.sampleCount );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigStatisticsMath, calculateStatisticsCurves )
{
{
std::vector<double> values;
double mean = HUGE_VAL;
double p10 = HUGE_VAL;
double p50 = HUGE_VAL;
double p90 = HUGE_VAL;
RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean );
EXPECT_TRUE( std::isinf( p10 ) );
EXPECT_TRUE( std::isinf( p50 ) );
EXPECT_TRUE( std::isinf( p90 ) );
EXPECT_TRUE( std::isinf( mean ) );
}
{
std::vector<double> values{
1.0,
1.0,
1.0,
};
double mean = HUGE_VAL;
double p10 = HUGE_VAL;
double p50 = HUGE_VAL;
double p90 = HUGE_VAL;
// If we have few samples, P10 and P90 cannot be computed
RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean );
EXPECT_TRUE( std::isinf( p10 ) );
EXPECT_TRUE( std::isinf( p90 ) );
EXPECT_DOUBLE_EQ( 1.0, p50 );
EXPECT_DOUBLE_EQ( 1.0, mean );
}
{
std::vector<double> values{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 5.0, 10.0 };
double mean = HUGE_VAL;
double p10 = HUGE_VAL;
double p50 = HUGE_VAL;
double p90 = HUGE_VAL;
RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean );
EXPECT_DOUBLE_EQ( 1.0, p10 );
EXPECT_DOUBLE_EQ( 1.0, p50 );
EXPECT_FALSE( std::isinf( p90 ) );
EXPECT_FALSE( std::isinf( mean ) );
}
{
std::vector<double> values{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
double mean = HUGE_VAL;
double p10 = HUGE_VAL;
double p50 = HUGE_VAL;
double p90 = HUGE_VAL;
RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean );
EXPECT_DOUBLE_EQ( 1.0, p10 );
EXPECT_DOUBLE_EQ( 1.0, p50 );
EXPECT_DOUBLE_EQ( 1.0, p90 );
EXPECT_DOUBLE_EQ( 1.0, mean );
}
}

View File

@@ -0,0 +1,210 @@
#include "gtest/gtest.h"
#include "RiaCurveMerger.h"
#include <cmath> // Needed for HUGE_VAL on Linux
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, TestDateInterpolation )
{
std::vector<double> values{ 2.0, 3.5, 5.0, 6.0 };
std::vector<time_t> timeSteps{ 1, 5, 10, 15 };
{
double val = RiaTimeHistoryCurveMerger::interpolatedYValue( 1, timeSteps, values );
EXPECT_EQ( 2.0, val );
}
{
double val = RiaTimeHistoryCurveMerger::interpolatedYValue( 0, timeSteps, values );
EXPECT_EQ( HUGE_VAL, val );
}
{
double val = RiaTimeHistoryCurveMerger::interpolatedYValue( 20, timeSteps, values );
EXPECT_EQ( HUGE_VAL, val );
}
{
double val = RiaTimeHistoryCurveMerger::interpolatedYValue( 3, timeSteps, values );
EXPECT_EQ( 2.75, val );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, ExtractIntervalsWithSameTimeSteps )
{
std::vector<double> valuesA{ HUGE_VAL, 1.0, HUGE_VAL, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0, HUGE_VAL };
std::vector<double> valuesB{ 10, 20, 30, 40, 45, HUGE_VAL, HUGE_VAL, 5.0, 6.0, HUGE_VAL };
EXPECT_EQ( valuesA.size(), valuesB.size() );
std::vector<time_t> timeSteps;
for ( size_t i = 0; i < 10; i++ )
{
timeSteps.push_back( i );
}
RiaTimeHistoryCurveMerger interpolate;
interpolate.addCurveData( timeSteps, valuesA );
interpolate.addCurveData( timeSteps, valuesB );
interpolate.computeInterpolatedValues();
auto interpolatedTimeSteps = interpolate.allXValues();
auto intervals = interpolate.validIntervalsForAllXValues();
EXPECT_EQ( 10, static_cast<int>( interpolatedTimeSteps.size() ) );
EXPECT_EQ( 3, static_cast<int>( intervals.size() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, ExtractIntervalsWithSameTimeStepsOneComplete )
{
std::vector<double> valuesA{ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 };
std::vector<double> valuesB{ 10, 20, 30, HUGE_VAL, 50, HUGE_VAL, 70 };
EXPECT_EQ( valuesA.size(), valuesB.size() );
std::vector<time_t> timeSteps;
for ( size_t i = 0; i < 7; i++ )
{
timeSteps.push_back( i );
}
RiaTimeHistoryCurveMerger interpolate;
interpolate.addCurveData( timeSteps, valuesA );
interpolate.addCurveData( timeSteps, valuesB );
interpolate.computeInterpolatedValues();
auto interpolatedTimeSteps = interpolate.allXValues();
auto intervals = interpolate.validIntervalsForAllXValues();
EXPECT_EQ( 7, static_cast<int>( interpolatedTimeSteps.size() ) );
EXPECT_EQ( 3, static_cast<int>( intervals.size() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, ExtractIntervalsWithSameTimeStepsBothComplete )
{
std::vector<double> valuesA{ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 };
std::vector<double> valuesB{ 10, 20, 30, 40, 50, 60, 70 };
EXPECT_EQ( valuesA.size(), valuesB.size() );
std::vector<time_t> timeSteps;
for ( size_t i = 0; i < 7; i++ )
{
timeSteps.push_back( i );
}
RiaTimeHistoryCurveMerger interpolate;
interpolate.addCurveData( timeSteps, valuesA );
interpolate.addCurveData( timeSteps, valuesB );
interpolate.computeInterpolatedValues();
auto interpolatedTimeSteps = interpolate.allXValues();
auto intervals = interpolate.validIntervalsForAllXValues();
EXPECT_EQ( 7, static_cast<int>( interpolatedTimeSteps.size() ) );
EXPECT_EQ( 1, static_cast<int>( intervals.size() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, OverlappintTimes )
{
std::vector<double> valuesA{ 1, 2, 3, 4, 5 };
std::vector<double> valuesB{ 10, 20, 30, 40, 50 };
EXPECT_EQ( valuesA.size(), valuesB.size() );
std::vector<time_t> timeStepsA{ 0, 10, 11, 15, 20 };
std::vector<time_t> timeStepsB{ 1, 2, 3, 5, 7 };
RiaTimeHistoryCurveMerger interpolate;
interpolate.addCurveData( timeStepsA, valuesA );
interpolate.addCurveData( timeStepsB, valuesB );
interpolate.computeInterpolatedValues();
EXPECT_EQ( 2, static_cast<int>( interpolate.curveCount() ) );
auto interpolatedTimeSteps = interpolate.allXValues();
auto intervals = interpolate.validIntervalsForAllXValues();
EXPECT_EQ( 10, static_cast<int>( interpolatedTimeSteps.size() ) );
EXPECT_EQ( 1, static_cast<int>( intervals.size() ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, RobustUse )
{
{
RiaTimeHistoryCurveMerger curveMerger;
curveMerger.computeInterpolatedValues();
EXPECT_EQ( 0, static_cast<int>( curveMerger.allXValues().size() ) );
}
std::vector<double> valuesA{ 1, 2, 3, 4, 5 };
std::vector<double> valuesB{ 10, 20, 30 };
std::vector<time_t> timeStepsA{ 0, 10, 11, 15, 20 };
std::vector<time_t> timeStepsB{ 1, 2, 3 };
{
RiaTimeHistoryCurveMerger curveMerger;
curveMerger.addCurveData( timeStepsA, valuesA );
curveMerger.computeInterpolatedValues();
EXPECT_EQ( timeStepsA.size(), curveMerger.allXValues().size() );
EXPECT_EQ( timeStepsA.size(), curveMerger.interpolatedYValuesForAllXValues( 0 ).size() );
}
{
RiaTimeHistoryCurveMerger curveMerger;
curveMerger.addCurveData( timeStepsA, valuesA );
curveMerger.addCurveData( timeStepsB, valuesB );
// Execute interpolation twice is allowed
curveMerger.computeInterpolatedValues();
curveMerger.computeInterpolatedValues();
EXPECT_EQ( 8, static_cast<int>( curveMerger.allXValues().size() ) );
EXPECT_EQ( 8, static_cast<int>( curveMerger.interpolatedYValuesForAllXValues( 0 ).size() ) );
EXPECT_EQ( 8, static_cast<int>( curveMerger.interpolatedYValuesForAllXValues( 1 ).size() ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaTimeHistoryCurveMergerTest, NoTimeStepOverlap )
{
std::vector<double> valuesA{ 1, 2, 3, 4, 5 };
std::vector<double> valuesB{ 10, 20, 30 };
std::vector<time_t> timeStepsA{ 0, 10, 11, 15, 20 };
std::vector<time_t> timeStepsB{ 100, 200, 300 };
{
RiaTimeHistoryCurveMerger curveMerger;
curveMerger.addCurveData( timeStepsA, valuesA );
curveMerger.addCurveData( timeStepsB, valuesB );
// Execute interpolation twice is allowed
curveMerger.computeInterpolatedValues();
EXPECT_EQ( 8, static_cast<int>( curveMerger.allXValues().size() ) );
EXPECT_EQ( 0, static_cast<int>( curveMerger.validIntervalsForAllXValues().size() ) );
}
}

View File

@@ -0,0 +1,153 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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( size_t( 3 ), tofInIncreasingOrder2.size() );
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 );
}

View File

@@ -0,0 +1,210 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "Completions/RigTransmissibilityCondenser.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigTransmissibilityCondenser, BasicTest )
{
using RiCa = RigTransmissibilityCondenser::CellAddress;
#if 1
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 1 }, 1.0 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 1 } );
EXPECT_DOUBLE_EQ( 1.0, condT );
}
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 1 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 1 } );
EXPECT_DOUBLE_EQ( 0.5, condT );
}
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { false, RiCa::STIMPLAN, 1 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { true, RiCa::STIMPLAN, 2 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 2 } );
EXPECT_DOUBLE_EQ( 0.25, condT );
}
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { false, RiCa::STIMPLAN, 1 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { false, RiCa::STIMPLAN, 2 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { true, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { true, RiCa::STIMPLAN, 3 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 3 } );
EXPECT_DOUBLE_EQ( 0.5, condT );
}
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { false, RiCa::STIMPLAN, 1 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 1 }, { false, RiCa::STIMPLAN, 2 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { false, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 3 }, { true, RiCa::STIMPLAN, 4 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 }, { true, RiCa::STIMPLAN, 4 } );
EXPECT_DOUBLE_EQ( 0.25, condT );
}
#endif
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 5 }, { false, RiCa::STIMPLAN, 1 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 2 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 3 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::STIMPLAN, 6 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 5 }, { true, RiCa::STIMPLAN, 6 } );
EXPECT_NEAR( 0.1666666667, condT, 1e-7 );
}
#if 1
{
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 5 }, { false, RiCa::STIMPLAN, 1 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 7 }, { false, RiCa::STIMPLAN, 2 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 8 }, { false, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::ECLIPSE, 9 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 2 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 3 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 3 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
condenser.addNeighborTransmissibility( { true, RiCa::STIMPLAN, 6 }, { false, RiCa::STIMPLAN, 4 }, 0.5 );
double condT = condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 5 }, { true, RiCa::STIMPLAN, 6 } );
EXPECT_NEAR( 0.045454545, condT, 1e-7 );
}
#endif
#if 1
{
// Test example from Matlab scripts, that match the iterative solution
RigTransmissibilityCondenser condenser;
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 2 }, 0.01127000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { false, RiCa::STIMPLAN, 4 }, 1.12700000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 1 }, { true, RiCa::ECLIPSE, 7 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { false, RiCa::STIMPLAN, 3 }, 0.01127000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { false, RiCa::STIMPLAN, 5 }, 1.12700000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 2 }, { true, RiCa::ECLIPSE, 8 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 3 }, { false, RiCa::STIMPLAN, 6 }, 1.50266667 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 3 }, { true, RiCa::ECLIPSE, 9 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 4 }, { false, RiCa::STIMPLAN, 5 }, 0.01127000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 4 }, { true, RiCa::ECLIPSE, 10 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 5 }, { false, RiCa::STIMPLAN, 6 }, 0.01502667 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 5 }, { true, RiCa::ECLIPSE, 11 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 6 }, { true, RiCa::ECLIPSE, 12 }, 0.09016000 );
condenser.addNeighborTransmissibility( { false, RiCa::STIMPLAN, 6 }, { true, RiCa::STIMPLAN, 13 }, 0.19219491 );
EXPECT_NEAR( 0.00402732,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::ECLIPSE, 2 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00027347,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::ECLIPSE, 3 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.03879174,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::ECLIPSE, 4 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00400489,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::ECLIPSE, 5 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00026172,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::ECLIPSE, 6 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00055791,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 1 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00245697,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 2 + 6 }, { true, RiCa::ECLIPSE, 3 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00401064,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 2 + 6 }, { true, RiCa::ECLIPSE, 4 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.03442773,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 2 + 6 }, { true, RiCa::ECLIPSE, 5 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00233846,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 2 + 6 }, { true, RiCa::ECLIPSE, 6 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00498491,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 2 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00027351,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 3 + 6 }, { true, RiCa::ECLIPSE, 4 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00246579,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 3 + 6 }, { true, RiCa::ECLIPSE, 5 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.01956640,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 3 + 6 }, { true, RiCa::ECLIPSE, 6 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.04170988,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 3 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00402105,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 4 + 6 }, { true, RiCa::ECLIPSE, 5 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00026189,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 4 + 6 }, { true, RiCa::ECLIPSE, 6 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00055827,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 4 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00237402,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 5 + 6 }, { true, RiCa::ECLIPSE, 6 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.00506073,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 5 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
EXPECT_NEAR( 0.04448791,
condenser.condensedTransmissibility( { true, RiCa::ECLIPSE, 6 + 6 }, { true, RiCa::STIMPLAN, 7 + 6 } ),
1e-6 );
}
#endif
}

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor 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 "RifReaderMockModel.h"
#include "RigEclipseCaseData.h"
#include "RigEclipseWellLogExtractor.h"
#include "RigGridManager.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigEclipseWellLogExtractor, ShortWellPathInsideOneCell )
{
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData( nullptr );
{
cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel;
mockFileInterface->setWorldCoordinates( cvf::Vec3d( 10, 10, 10 ), cvf::Vec3d( 20, 20, 20 ) );
mockFileInterface->setGridPointDimensions( cvf::Vec3st( 4, 5, 6 ) );
mockFileInterface->enableWellData( false );
mockFileInterface->open( "", reservoir.p() );
reservoir->mainGrid()->computeCachedData();
}
auto cells = reservoir->mainGrid()->globalCellArray();
EXPECT_FALSE( cells.empty() );
auto firstCell = reservoir->mainGrid()->globalCellArray()[0];
auto center = firstCell.center();
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
{
std::vector<cvf::Vec3d> wellPathPoints;
std::vector<double> mdValues;
{
double offset = 0.0;
wellPathPoints.push_back( center );
mdValues.push_back( offset );
}
{
double offset = 0.1;
wellPathPoints.push_back( center + cvf::Vec3d( 0, 0, offset ) );
mdValues.push_back( offset );
}
wellPathGeometry->setWellPathPoints( wellPathPoints );
wellPathGeometry->setMeasuredDepths( mdValues );
}
cvf::ref<RigEclipseWellLogExtractor> e = new RigEclipseWellLogExtractor( reservoir.p(), wellPathGeometry.p(), "" );
auto intersections = e->cellIntersectionInfosAlongWellPath();
EXPECT_FALSE( intersections.empty() );
}

View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor 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 "RigWellPathGeometryExporter.h"
#include "RigWellPath.h"
#include "cvfVector3.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigWellPathGeometryExporter, VerticalPath )
{
double x = 457313.52;
double y = 7320309.71;
// Make a vertical well
RigWellPath rigWellPath;
std::vector<double> inputMds = { 0.0, 1032.14, 1548.2, 2580.34, 2619.82, 2777.73, 2790.57, 2810.34 };
for ( double md : inputMds )
{
rigWellPath.addMeasuredDepth( md );
rigWellPath.addWellPathPoint( cvf::Vec3d( x, y, -md ) );
}
double mdStepSize = 5.0;
double rkbOffset = 0.0;
std::vector<double> xValues;
std::vector<double> yValues;
std::vector<double> tvdValues;
std::vector<double> mdValues;
RigWellPathGeometryExporter::exportWellPathGeometry( rigWellPath, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues );
double firstMd = inputMds.front();
double lastMd = inputMds.back();
size_t expectedNumDataPoints = static_cast<size_t>( std::abs( lastMd - firstMd ) / mdStepSize ) + 2;
EXPECT_EQ( expectedNumDataPoints, tvdValues.size() );
EXPECT_EQ( expectedNumDataPoints, mdValues.size() );
// The change in MD should always be bigger than change in TVD (or very close)
for ( size_t i = 1; i < tvdValues.size(); i++ )
{
double changeMd = mdValues[i] - mdValues[i - 1];
double changeTvd = tvdValues[i] - tvdValues[i - 1];
double diff = std::abs( changeTvd - changeMd );
ASSERT_TRUE( changeMd > changeTvd || diff < 0.0000000001 );
}
}

View File

@@ -0,0 +1,166 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor 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 "RigWellPathGeometryTools.h"
#include <algorithm>
#include <complex>
#include <vector>
#define TOLERANCE 1.0e-7
#define SOLVER_TOLERANCE
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigWellPathGeometryTools, VerticalPath )
{
std::vector<double> mdValues = { 100, 500, 1000 };
std::vector<double> tvdValues = { 100, 500, 1000 };
std::vector<double> fullTVDValues = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
std::vector<double> fullMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTVDValues );
EXPECT_EQ( fullTVDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < fullTVDValues.size(); ++i )
{
EXPECT_NEAR( fullTVDValues[i], fullMDValues[i], TOLERANCE );
}
}
TEST( RigWellPathGeometryTools, LinearPath )
{
std::vector<double> mdValues = { 100, 500, 1000 };
std::vector<double> tvdValues = { 50, 250, 500 };
std::vector<double> fullTVDValues = { 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 };
std::vector<double> fullMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTVDValues );
EXPECT_EQ( fullTVDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < fullTVDValues.size(); ++i )
{
EXPECT_NEAR( 2.0 * fullTVDValues[i], fullMDValues[i], TOLERANCE );
}
}
TEST( RigWellPathGeometryTools, LinearPathStartingAtZero )
{
std::vector<double> mdValues = { 0, 100, 500, 1000 };
std::vector<double> tvdValues = { 0, 50, 250, 500 };
std::vector<double> fullTVDValues = { 0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500 };
std::vector<double> fullMDValues = RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTVDValues );
EXPECT_EQ( fullTVDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < fullTVDValues.size(); ++i )
{
EXPECT_NEAR( 2.0 * fullTVDValues[i], fullMDValues[i], TOLERANCE );
}
}
double quadraticFunction( double x )
{
return 0.0015 * std::pow( x, 2 ) - 0.25 * x + 100;
}
TEST( RigWellPathGeometryTools, QuadraticPath )
{
std::vector<double> mdValues = { 100, 300, 600, 1000 };
std::vector<double> tvdValues;
for ( double md : mdValues )
{
tvdValues.push_back( quadraticFunction( md ) );
}
std::vector<double> fullMDValues = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
std::vector<double> fullTvdValues;
for ( double md : fullMDValues )
{
fullTvdValues.push_back( quadraticFunction( md ) );
}
std::vector<double> estimatedFullMDValues =
RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTvdValues );
EXPECT_EQ( estimatedFullMDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < estimatedFullMDValues.size(); ++i )
{
if ( std::find( mdValues.begin(), mdValues.end(), estimatedFullMDValues[i] ) != mdValues.end() )
{
EXPECT_NEAR( fullMDValues[i], estimatedFullMDValues[i], TOLERANCE );
}
}
}
double cubicFunction( double x )
{
return 0.000012 * std::pow( x, 3 ) - 0.0175 * std::pow( x, 2 ) + 7 * x;
}
TEST( RigWellPathGeometryTools, CubicPath )
{
std::vector<double> mdValues = { 100, 300, 700, 1000 };
std::vector<double> tvdValues;
for ( double md : mdValues )
{
tvdValues.push_back( cubicFunction( md ) );
}
std::vector<double> fullMDValues = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
std::vector<double> fullTvdValues;
for ( double md : fullMDValues )
{
fullTvdValues.push_back( cubicFunction( md ) );
}
std::vector<double> estimatedFullMDValues =
RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTvdValues );
EXPECT_EQ( estimatedFullMDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < estimatedFullMDValues.size(); ++i )
{
if ( std::find( mdValues.begin(), mdValues.end(), estimatedFullMDValues[i] ) != mdValues.end() )
{
EXPECT_NEAR( fullMDValues[i], estimatedFullMDValues[i], TOLERANCE );
}
}
}
TEST( RigWellPathGeometryTools, CubicPathPoorSampling )
{
std::vector<double> mdValues = { 100, 300, 600, 1000 };
std::vector<double> tvdValues;
for ( double md : mdValues )
{
tvdValues.push_back( cubicFunction( md ) );
}
std::vector<double> fullMDValues = { 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 };
std::vector<double> fullTvdValues;
for ( double md : fullMDValues )
{
fullTvdValues.push_back( cubicFunction( md ) );
}
std::vector<double> estimatedFullMDValues =
RigWellPathGeometryTools::interpolateMdFromTvd( mdValues, tvdValues, fullTvdValues );
EXPECT_EQ( estimatedFullMDValues.size(), fullMDValues.size() );
for ( size_t i = 0; i < estimatedFullMDValues.size(); ++i )
{
if ( std::find( mdValues.begin(), mdValues.end(), estimatedFullMDValues[i] ) != mdValues.end() )
{
EXPECT_NEAR( fullMDValues[i], estimatedFullMDValues[i], TOLERANCE );
}
}
}

View File

@@ -0,0 +1,88 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RigWellPath.h"
#include "cvfVector3.h"
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RigWellPathTest, FindWellPathCoordsIncludingIntersectionPoint )
{
RigWellPath wellPathGeometry;
{
std::vector<cvf::Vec3d> wellPathPoints;
std::vector<double> mdValues;
wellPathPoints.push_back( cvf::Vec3d( 0.0, 0.0, 0.0 ) );
wellPathPoints.push_back( cvf::Vec3d( 0.0, 1.0, 0.0 ) );
wellPathPoints.push_back( cvf::Vec3d( 0.0, 2.0, 0.0 ) );
wellPathPoints.push_back( cvf::Vec3d( 0.0, 3.0, 0.0 ) );
wellPathPoints.push_back( cvf::Vec3d( 0.0, 4.0, 0.0 ) );
mdValues.push_back( 0.0 );
mdValues.push_back( 1.0 );
mdValues.push_back( 2.0 );
mdValues.push_back( 3.0 );
mdValues.push_back( 4.0 );
wellPathGeometry.setWellPathPoints( wellPathPoints );
wellPathGeometry.setMeasuredDepths( mdValues );
}
// Before first MD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( -1.0 );
EXPECT_EQ( 5u, wellPathPoints.size() );
}
// Identical to first MD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( 0.0 );
EXPECT_EQ( 5u, wellPathPoints.size() );
}
// Identical to second MD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( 1.0 );
EXPECT_EQ( 5u, wellPathPoints.size() );
}
// Between first and second MD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( 0.3 );
EXPECT_EQ( 6u, wellPathPoints.size() );
}
// Identical to lastMD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( 4.0 );
EXPECT_EQ( 5u, wellPathPoints.size() );
}
// Larger than lastMD
{
auto wellPathPoints = wellPathGeometry.wellPathPointsIncludingInterpolatedIntersectionPoint( 10.0 );
EXPECT_EQ( 5u, wellPathPoints.size() );
}
}

View File

@@ -0,0 +1,98 @@
#include "gtest/gtest.h"
#include "RiaQDateTimeTools.h"
#include "RiaTestDataDirectory.h"
#include "RimProject.h"
#include "cafFilePath.h"
#include "cafPdmObjectHandle.h"
#include <QDateTime>
#include <QString>
#include <vector>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
template <typename T>
void fieldsByType( caf::PdmObjectHandle* object, std::vector<T*>& typedFields )
{
if ( !object ) return;
std::vector<caf::PdmFieldHandle*> allFieldsInObject;
object->fields( allFieldsInObject );
std::vector<caf::PdmObjectHandle*> children;
for ( const auto& field : allFieldsInObject )
{
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>( field );
if ( typedField ) typedFields.push_back( &typedField->v() );
caf::PdmField<std::vector<T>>* typedFieldInVector = dynamic_cast<caf::PdmField<std::vector<T>>*>( field );
if ( typedFieldInVector )
{
for ( T& typedFieldFromVector : typedFieldInVector->v() )
{
typedFields.push_back( &typedFieldFromVector );
}
}
field->childObjects( &children );
}
for ( const auto& child : children )
{
fieldsByType( child, typedFields );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RimRelocatePathTest, findPathsInProjectFile )
{
QString fileName = QString( "%1/RimRelocatePath/RelocatePath.rsp" ).arg( TEST_DATA_DIR );
if ( fileName.isEmpty() ) return;
RimProject project;
project.fileName = fileName;
project.readFile();
std::vector<caf::FilePath*> filePaths;
fieldsByType( &project, filePaths );
for ( auto filePath : filePaths )
{
std::cout << filePath->path().toStdString() << std::endl;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RimRelocatePathTest, DISABLED_LocaleDateStringTest )
{
// Set a non-english system locale on local machine for this test to be useful
QDateTime dt;
{
QDate d( 2018, 10, 1 );
dt.setDate( d );
}
QString formatString( "ddd MMM yyyy" );
// Change the default locale on your system to get a different text then the english formatted text
QString defaultString = dt.toString( formatString );
std::cout << "default " << defaultString.toStdString() << std::endl;
QString englishString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, formatString );
std::cout << "english " << englishString.toStdString() << std::endl;
}

View File

@@ -0,0 +1,95 @@
#include "gtest/gtest.h"
#include "RimSummaryCaseCollection.h"
#include <random>
#include <QDebug>
class RimSummaryCaseCollection_TESTER
{
public:
static void test1();
};
TEST( RimSummaryCaseCollection, EnsembleParameter )
{
RimSummaryCaseCollection_TESTER::test1();
}
void RimSummaryCaseCollection_TESTER::test1()
{
std::random_device rd;
std::mt19937 gen( rd() );
std::uniform_real_distribution<double> meanDistribution( -10000.0, 10000.0 );
std::uniform_real_distribution<double> variationDistribution( 0.0, 5000.0 );
std::uniform_int_distribution<size_t> countDistribution( 1u, 1000u );
size_t N = 1000;
std::vector<EnsembleParameter> parameters;
for ( size_t i = 0; i < N; ++i )
{
EnsembleParameter param;
param.type = EnsembleParameter::TYPE_NUMERIC;
size_t valueCount = countDistribution( gen );
double maxValue = -std::numeric_limits<double>::max();
double minValue = std::numeric_limits<double>::max();
// Add a few with zero variation
if ( i % 100 )
{
double value = (double)i;
maxValue = value;
minValue = value;
for ( size_t j = 0; j < valueCount; ++j )
{
param.values.push_back( value );
}
}
else
{
double meanValue = meanDistribution( gen );
double range = variationDistribution( gen );
std::uniform_real_distribution<double> valueDistribution( meanValue - range, meanValue + range );
for ( size_t j = 0; j < valueCount; ++j )
{
double value = valueDistribution( gen );
maxValue = std::max( maxValue, value );
minValue = std::min( minValue, value );
param.values.push_back( QVariant( value ) );
}
}
param.minValue = minValue;
param.maxValue = maxValue;
double normStdDev = param.normalizedStdDeviation();
EXPECT_GE( normStdDev, 0.0 );
EXPECT_LE( normStdDev, std::sqrt( 2.0 ) );
param.name = QString( "%1" ).arg( i );
parameters.push_back( param );
}
size_t previousSize = parameters.size();
RimSummaryCaseCollection::sortByBinnedVariation( parameters );
size_t currentSize = parameters.size();
EXPECT_EQ( previousSize, currentSize );
int currentVariation = (int)EnsembleParameter::HIGH_VARIATION;
for ( const EnsembleParameter& nameParamPair : parameters )
{
if ( nameParamPair.normalizedStdDeviation() == 0.0 )
{
EXPECT_EQ( nameParamPair.variationBin, (int)EnsembleParameter::NO_VARIATION );
}
else
{
EXPECT_GE( nameParamPair.variationBin, (int)EnsembleParameter::LOW_VARIATION );
}
EXPECT_LE( nameParamPair.variationBin, (int)EnsembleParameter::HIGH_VARIATION );
EXPECT_LE( nameParamPair.variationBin, currentVariation );
currentVariation = nameParamPair.variationBin;
}
}

View File

@@ -0,0 +1,50 @@
#include "gtest/gtest.h"
#include "RiaCurveDataTools.h"
#include <cmath> // Needed for HUGE_VAL on Linux
#include <numeric>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector )
{
std::vector<double> values;
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 1.0 );
values.push_back( 2.0 );
values.push_back( 3.0 );
values.push_back( HUGE_VAL );
auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false );
EXPECT_EQ( 1, static_cast<int>( valuesIntervals.size() ) );
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].first ) );
EXPECT_EQ( 4, static_cast<int>( valuesIntervals[0].second ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVector )
{
std::vector<double> values;
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 1.0 );
values.push_back( HUGE_VAL );
values.push_back( HUGE_VAL );
values.push_back( 2.0 );
values.push_back( 3.0 );
values.push_back( HUGE_VAL );
auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false );
EXPECT_EQ( 2, static_cast<int>( valuesIntervals.size() ) );
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].first ) );
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].second ) );
EXPECT_EQ( 5, static_cast<int>( valuesIntervals[1].first ) );
EXPECT_EQ( 6, static_cast<int>( valuesIntervals[1].second ) );
}

View File

@@ -0,0 +1,50 @@
#include "gtest/gtest.h"
#include "RimWellPathCompletions.h"
#include <QRegExpValidator>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RimWellPathCompletions, WellNameRegExp )
{
std::vector<QString> validNames = { "RASASD", "gf0sdf", "sd-ASD12", "1-AA_b" };
std::vector<QString> invalidNames = { ".AdSD", "+gf0sdf", "sd ASD12", "ABCDEFGHIJKL" };
QRegExp rx = RimWellPathCompletions::wellNameForExportRegExp();
EXPECT_TRUE( rx.isValid() );
for ( QString validName : validNames )
{
EXPECT_TRUE( rx.exactMatch( validName ) );
}
for ( QString invalidName : invalidNames )
{
EXPECT_FALSE( rx.exactMatch( invalidName ) );
}
}
TEST( RimWellPathCompletions, WellNameRegExpValidator )
{
std::vector<QString> validNames = { "RASASD", "gf0sdf", "sd-ASD12", "1-AA_b" };
std::vector<QString> invalidNames = { ".AdSD", "+gf0sdf", "sd ASD12", "ABCDEFGHIJKL" };
QString emptyString = "";
QRegExp rx = RimWellPathCompletions::wellNameForExportRegExp();
QRegExpValidator validator( nullptr );
validator.setRegExp( rx );
for ( QString validName : validNames )
{
int dummyPos;
EXPECT_EQ( QValidator::Acceptable, validator.validate( validName, dummyPos ) );
}
for ( QString invalidName : invalidNames )
{
int dummyPos;
EXPECT_EQ( QValidator::Invalid, validator.validate( invalidName, dummyPos ) );
}
int dummyPos;
EXPECT_EQ( QValidator::Intermediate, validator.validate( emptyString, dummyPos ) );
}

View File

@@ -0,0 +1,89 @@
#include "gtest/gtest.h"
#include "RiuSummaryQuantityNameInfoProvider.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiuSummaryQuantityNameInfoProvider, TestInit )
{
{
std::string s( "SRSFC" );
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( longName == "Reach brine concentration" );
}
{
std::string s( "SRSFC" );
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( test == "Reach brine concentration" );
}
{
std::string s( "does not exist" );
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_INVALID );
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( longName == "" );
}
{
std::string s( "does not exist" );
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( test == "" );
}
{
std::string s( "does not exist" );
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s, true );
EXPECT_TRUE( test == s );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiuSummaryQuantityNameInfoProvider, TestCustomNaming )
{
{
std::string s( "SRSFCABC" );
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT );
auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( longName == "Reach brine concentration" );
}
{
std::string s( "BHD__ABC" );
auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s );
EXPECT_TRUE( test == "Hydraulic head" );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiuSummaryQuantityNameInfoProvider, Test6x )
{
{
std::string s( "GLIT" );
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP );
}
{
std::string s( "WSBVPROP" );
auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s );
EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL );
}
}

View File

@@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "gtest/gtest.h"
#include "cvfLibCore.h"
#include "cvfLibGeometry.h"
#include "cvfLibRender.h"
#include "cvfLibViewing.h"
#include "RivPipeGeometryGenerator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::Vec3dArray> buildPipeCoords()
{
cvf::ref<cvf::Vec3dArray> coords = new cvf::Vec3dArray;
coords->resize( 10 );
// Two identical at start
coords->set( 0, cvf::Vec3d( 10, 10, 10 ) );
coords->set( 1, cvf::Vec3d( 10, 10, 10 ) );
// 180 degree
coords->set( 2, cvf::Vec3d( 12, 20, 10 ) );
coords->set( 3, cvf::Vec3d( 13, 20, 20 ) );
coords->set( 4, cvf::Vec3d( 13, 20, 20 ) );
coords->set( 5, cvf::Vec3d( 12, 20, 10 ) );
// coords->set(5, cvf::Vec3d(15, 10, 10));
coords->set( 6, cvf::Vec3d( 16, 10, 10 ) );
coords->set( 7, cvf::Vec3d( 17, 10, 10 ) );
// Two identical at end
coords->set( 8, cvf::Vec3d( 18, 10, 10 ) );
coords->set( 9, cvf::Vec3d( 18, 10, 10 ) );
return coords;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ModelVisualizationTest, AllPartsInputTest )
{
cvf::ref<cvf::Vec3dArray> coords = new cvf::Vec3dArray;
RivPipeGeometryGenerator gen;
// Set empty coords array
gen.setPipeCenterCoords( coords.p() );
{
cvf::ref<cvf::DrawableGeo> geo = gen.createPipeSurface();
EXPECT_TRUE( geo.isNull() );
}
coords->resize( 2 );
coords->set( 0, cvf::Vec3d( 10, 10, 10 ) );
coords->set( 1, cvf::Vec3d( 10, 10, 10 ) );
gen.setPipeCenterCoords( coords.p() );
{
cvf::ref<cvf::DrawableGeo> geo = gen.createPipeSurface();
EXPECT_TRUE( geo.isNull() );
}
coords->set( 1, cvf::Vec3d( 10, 10, 20 ) );
gen.setPipeCenterCoords( coords.p() );
{
cvf::ref<cvf::DrawableGeo> geo = gen.createPipeSurface();
EXPECT_TRUE( geo.notNull() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ModelVisualizationTest, PipeGeometryTest )
{
cvf::ref<cvf::Vec3dArray> coords = buildPipeCoords();
RivPipeGeometryGenerator gen;
gen.setPipeCenterCoords( coords.p() );
gen.createPipeSurface();
}

View File

@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions 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 "gtest/gtest.h"
#include "RivTernaryScalarMapper.h"
#include "cvfTextureImage.h"
#include "cvfqtUtils.h"
#include <QImage>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( TernaryScalarMapperTest, BasicFunctions )
{
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper( cvf::Color3f::GRAY );
cvf::ref<cvf::TextureImage> texImage = new cvf::TextureImage;
scalarMapper->updateTexture( texImage.p(), 1.0 );
QImage img = cvfqt::Utils::toQImage( *( texImage.p() ) );
img.save( "c:/tmp/test.png" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( TernaryScalarMapperTest, TextureMapping )
{
cvf::ref<RivTernaryScalarMapper> scalarMapper = new RivTernaryScalarMapper( cvf::Color3f::GRAY );
// See RivTernaryScalarMapper::mapToTextureCoord
double edgeClampDelta = 1.1 * 0.001;
// Without opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 0.0, 0.0, false );
EXPECT_NEAR( 0.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.0, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 1.0, 0.0, false );
EXPECT_NEAR( 1.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.0, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 0.0, 1.0, false );
EXPECT_NEAR( 0.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.5, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 3.0, 3.0, false );
EXPECT_NEAR( 1.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.0, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( -1.0, -1.0, false );
EXPECT_NEAR( 0.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.0, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 0.5, 3.0, false );
EXPECT_NEAR( 0.5, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.25, texCoord.y(), edgeClampDelta );
}
// Opacity
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 0.0, 0.0, true );
EXPECT_NEAR( 0.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 0.5, texCoord.y(), edgeClampDelta );
}
{
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord( 0.0, 1.0, true );
EXPECT_NEAR( 0.0, texCoord.x(), edgeClampDelta );
EXPECT_NEAR( 1.0, texCoord.y(), edgeClampDelta );
}
}

View File

@@ -0,0 +1,372 @@
#include "gtest/gtest.h"
#include "cvfScalarMapperDiscreteLinear.h"
#include <QDebug>
#include "RiaOffshoreSphericalCoords.h"
#include "cafTickMarkGenerator.h"
#include "cvfGeometryTools.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ScalarMapperTest, TickMarkGenerator )
{
EXPECT_EQ( 10.0e6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 5.5e6 ) );
EXPECT_EQ( 5.0e6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 2.1e6 ) );
EXPECT_EQ( 2.0e6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 1.1e6 ) );
EXPECT_EQ( 1.0e6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 1.0e6 ) );
EXPECT_EQ( 1.0e6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.9e6 ) );
EXPECT_EQ( 50.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 50.0 ) );
EXPECT_EQ( 50.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 21.00023 ) );
EXPECT_EQ( 20.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 11.2324556 ) );
EXPECT_EQ( 10.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 5.5 ) );
EXPECT_EQ( 5.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 2.1 ) );
EXPECT_EQ( 2.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 1.1 ) );
EXPECT_EQ( 1.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 1.0 ) );
EXPECT_EQ( 1.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.9 ) );
EXPECT_EQ( 1.0, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.7 ) );
EXPECT_EQ( 0.5, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.5 ) );
EXPECT_EQ( 0.5, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.435 ) );
EXPECT_EQ( 0.5, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.200001 ) );
EXPECT_EQ( 0.2, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.20000 ) );
EXPECT_EQ( 0.2, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.12 ) );
EXPECT_EQ( 0.1, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.056 ) );
EXPECT_EQ( 0.5e-6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.200001e-6 ) );
EXPECT_EQ( 0.2e-6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.20000e-6 ) );
EXPECT_EQ( 0.2e-6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.12e-6 ) );
EXPECT_EQ( 0.1e-6, caf::TickMarkGenerator::roundUpToLog_1_2_5_10( 0.056e-6 ) );
{
caf::TickMarkGenerator tickGen( 1234.34521, 2346.67293, 104.2768 );
EXPECT_EQ( size_t( 5 ), tickGen.tickMarkValues().size() );
EXPECT_EQ( 1400, tickGen.tickMarkValues()[0] );
EXPECT_EQ( 1600, tickGen.tickMarkValues()[1] );
EXPECT_EQ( 1800, tickGen.tickMarkValues()[2] );
EXPECT_EQ( 2000, tickGen.tickMarkValues()[3] );
EXPECT_EQ( 2200, tickGen.tickMarkValues()[4] );
}
{
caf::TickMarkGenerator tickGen( 0.02134, 0.17829, 0.03267 );
EXPECT_EQ( size_t( 3 ), tickGen.tickMarkValues().size() );
EXPECT_NEAR( 0.05, tickGen.tickMarkValues()[0], 1e-15 );
EXPECT_NEAR( 0.1, tickGen.tickMarkValues()[1], 1e-15 );
EXPECT_NEAR( 0.15, tickGen.tickMarkValues()[2], 1e-15 );
}
{
caf::TickMarkGenerator tickGen( 0.02134, 0.0335, 0.001267 );
EXPECT_EQ( size_t( 6 ), tickGen.tickMarkValues().size() );
EXPECT_EQ( 0.022, tickGen.tickMarkValues()[0] );
EXPECT_EQ( 0.024, tickGen.tickMarkValues()[1] );
EXPECT_NEAR( 0.026, tickGen.tickMarkValues()[2], 1e-15 );
EXPECT_EQ( 0.028, tickGen.tickMarkValues()[3] );
EXPECT_EQ( 0.03, tickGen.tickMarkValues()[4] );
EXPECT_EQ( 0.032, tickGen.tickMarkValues()[5] );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( ScalarMapperTest, TestHumanReadableTickmarks )
{
cvf::ref<cvf::ScalarMapperDiscreteLinear> m_linDiscreteScalarMapper = new cvf::ScalarMapperDiscreteLinear;
double adjustedMin = 2141234;
double adjustedMax = 2165239;
size_t m_numLevels = 10;
m_linDiscreteScalarMapper->setRange( adjustedMin, adjustedMax );
m_linDiscreteScalarMapper->setLevelCount( m_numLevels, true );
std::vector<double> tickValues;
m_linDiscreteScalarMapper->majorTickValues( &tickValues );
for ( size_t i = 0; i < tickValues.size(); i++ )
{
qDebug() << i << " " << tickValues[i];
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaOffshoreSphericalCoords, RiaOffshoreSphericalCoords )
{
{
cvf::Vec3f vec( 0, 0, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( spCoord.inc(), 0.0, 1e-10 );
EXPECT_NEAR( spCoord.azi(), 0.0, 1e-10 );
EXPECT_NEAR( spCoord.r(), 0.0, 1e-10 );
}
{
cvf::Vec3f vec( 1, 0, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 90.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 90.0, 1e-5 );
EXPECT_NEAR( spCoord.r(), 1.0, 1e-10 );
}
{
cvf::Vec3f vec( -1, 0, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 90.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), -90.0, 1e-5 );
EXPECT_NEAR( spCoord.r(), 1.0, 1e-10 );
}
{
cvf::Vec3f vec( 0, 1, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 90.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 0.0, 1e-10 );
EXPECT_NEAR( spCoord.r(), 1.0, 1e-10 );
}
{
cvf::Vec3f vec( 0.000001f, -3, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 90.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 179.9999, 1e-4 );
EXPECT_NEAR( spCoord.r(), 3.0, 1e-5 );
}
{
cvf::Vec3f vec( -0.000001f, -3, 0 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 90.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), -179.9999, 1e-4 );
EXPECT_NEAR( spCoord.r(), 3.0, 1e-5 );
}
{
cvf::Vec3f vec( 0, 0, 1 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 180.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 0.0, 1e-4 );
EXPECT_NEAR( spCoord.r(), 1.0, 1e-5 );
}
{
cvf::Vec3f vec( 0, 0, -1 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 0.0, 1e-10 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 0.0, 1e-4 );
EXPECT_NEAR( spCoord.r(), 1.0, 1e-5 );
}
{
cvf::Vec3f vec( 1, 0, -1 );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 45.0, 1e-5 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 90.0, 1e-4 );
EXPECT_NEAR( spCoord.r(), sqrt( 2 ), 1e-5 );
}
{
cvf::Vec3f vec( 1.5f, 1.5f, 1.5f );
RiaOffshoreSphericalCoords spCoord( vec );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.inc() ), 125.264396, 1e-5 );
EXPECT_NEAR( cvf::Math::toDegrees( spCoord.azi() ), 45.0, 1e-4 );
EXPECT_NEAR( spCoord.r(), vec.length(), 1e-6 );
}
}
#include "../cafTensor/cafTensor3.h"
#include "cvfMath.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( Tensor, TensorRotation )
{
{
caf::Ten3f orgT( 1.0f, 0.5f, 0.2f, 0, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 1, 0, 0 ), cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 1.0f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.5f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 1.0f, 0.5f, 0.2f, 0, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 1, 0, 0 ), 0.5 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 1.0f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.5f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 1.0f, 0.5f, 0.2f, 0, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 0, 0, 1 ), 0.5 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 0.5f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 1.0f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 1.0f, 0.5f, 0.2f, 0, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 0, 0, 1 ), 0.25 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 0.75f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.75f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.25f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 0.75f, 0.75f, 0.2f, 0.25, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 0, 0, 1 ), -0.25 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 1.0f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.5f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 1.0f, 0.5f, 0.2f, 0, 0, 0 );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 1, 1, 1 ), 0.2 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 0.8320561f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.5584094f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.3095343f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.2091861f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( -0.2258091f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0166228f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
{
caf::Ten3f orgT( 0.8320561f, 0.5584094f, 0.3095343f, 0.2091861f, 0.0166228f, -0.2258091f );
cvf::Mat3f rotMx = cvf::Mat3f::fromRotation( cvf::Vec3f( 1, 1, 1 ), -0.2 * cvf::PI_F );
caf::Ten3f rotT = orgT.rotated( rotMx );
EXPECT_NEAR( 1.0f, rotT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 0.5f, rotT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 0.2f, rotT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 0.0f, rotT[caf::Ten3f::SYZ], 1e-4 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( Tensor, TensorAddScale )
{
caf::Ten3f orgT1( 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f );
caf::Ten3f orgT2( 1.6f, 1.5f, 1.4f, 1.3f, 1.2f, 1.1f );
caf::Ten3f newT = orgT1 + orgT2;
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 2.7f, newT[caf::Ten3f::SYZ], 1e-4 );
newT = newT * 0.5;
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SXX], 1e-4 );
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SYY], 1e-4 );
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SZZ], 1e-4 );
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SXY], 1e-4 );
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SZX], 1e-4 );
EXPECT_NEAR( 1.35f, newT[caf::Ten3f::SYZ], 1e-4 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( Tensor, TensorTestRotationMatrix )
{
{
cvf::Vec3f vec1 = cvf::Vec3f::X_AXIS;
cvf::Vec3f vec2 = cvf::Vec3f::Z_AXIS;
cvf::Mat3f triangleXf = cvf::GeometryTools::computePlaneHorizontalRotationMx( vec1, vec2 );
float ipT11 = 11;
float ipT22 = 22;
float ipT33 = 33;
float ipT12 = 12;
float ipT23 = 23;
float ipT13 = 13;
caf::Ten3f tensor( ipT11, ipT22, ipT33, ipT12, ipT23, ipT13 );
caf::Ten3f xfTen = tensor.rotated( triangleXf );
auto szz = xfTen[caf::Ten3f::SZZ];
EXPECT_NEAR( ipT22, szz, 1e-4 );
}
{
cvf::Vec3f vec1 = cvf::Vec3f::Y_AXIS;
cvf::Vec3f vec2 = cvf::Vec3f::Z_AXIS;
cvf::Mat3f triangleXf = cvf::GeometryTools::computePlaneHorizontalRotationMx( vec1, vec2 );
float ipT11 = 11;
float ipT22 = 22;
float ipT33 = 33;
float ipT12 = 12;
float ipT23 = 23;
float ipT13 = 13;
caf::Ten3f tensor( ipT11, ipT22, ipT33, ipT12, ipT23, ipT13 );
caf::Ten3f xfTen = tensor.rotated( triangleXf );
auto szz = xfTen[caf::Ten3f::SZZ];
EXPECT_NEAR( ipT11, szz, 1e-4 );
}
}

View File

@@ -0,0 +1,515 @@
#include "gtest/gtest.h"
#include <assert.h>
#include <iostream>
#include "RiaSCurveCalculator.h"
#define M_PI 3.14159265358979323846 // pi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Test1 )
{
RiaSCurveCalculator sCurveCalc( { 100, 100, 0 }, 0, M_PI / 4, 12, { 100, 150, -1000 }, M_PI, M_PI / 4, 12 );
EXPECT_TRUE( sCurveCalc.isOk() );
sCurveCalc.dump();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Test1AtEstimate )
{
RiaSCurveCalculator sCurveCalc( { 100, 100, 0 }, 0, M_PI / 4, 535.452, { 100, 150, -1000 }, M_PI, M_PI / 4, 439.508 );
EXPECT_TRUE( sCurveCalc.isOk() );
sCurveCalc.dump();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Test2 )
{
RiaSCurveCalculator sCurveCalc( { 100, 100, 0 }, 0, M_PI / 4, 50, { 100, 150, -1000 }, M_PI, M_PI / 4, 50 );
EXPECT_TRUE( sCurveCalc.isOk() );
sCurveCalc.dump();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Test3 )
{
RiaSCurveCalculator sCurveCalc( { 100, 100, 0 }, 0, 0.3, 50, { 100, 150, -1000 }, 0, 0.4, 50 );
EXPECT_TRUE( sCurveCalc.isOk() );
sCurveCalc.dump();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Test4 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 45, 115, { 0, 50, -1000 }, 0, 0, 115 );
EXPECT_TRUE( sCurveCalc.isOk() );
sCurveCalc.dump();
}
double curveRadius = 115;
double angleEpsilon = 0.01;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config1 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, 0, -1000 }, 0, 0, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK_INFINITE_RADIUS12, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config1a )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, 0, -1000 }, 0, angleEpsilon, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config2 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, 0, -1000 }, 0, M_PI / 2.0, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config3 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, 0, -1000 }, 0, M_PI, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config3a )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, 0, -1000 }, 0, M_PI - angleEpsilon, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config4 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI / 2.0, curveRadius, { 0, 0, -1000 }, 0, M_PI / 2.0, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config5 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI / 2.0, curveRadius, { 0, 0, -1000 }, M_PI, M_PI / 2.0, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config6 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI, curveRadius, { 0, 0, -1000 }, 0, 0, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config6a )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI, curveRadius, { 0, 0, -1000 }, 0, angleEpsilon, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config6b )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI - angleEpsilon, curveRadius, { 0, 0, -1000 }, 0, 0.00, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config7 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI, curveRadius, { 0, 0, -1000 }, 0, M_PI / 2.0, curveRadius + 20 );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config8 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI, curveRadius, { 0, 0, -1000 }, 0, M_PI, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config8a )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI, curveRadius, { 0, 0, -1000 }, 0, M_PI - angleEpsilon, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, Config8b )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI - angleEpsilon, curveRadius, { 0, 0, -1000 }, 0, M_PI, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, Config9 )
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, M_PI / 2, curveRadius, { 0, 0, -1000 }, M_PI / 2, M_PI / 2, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, InfiniteStartRadius )
{
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, curveRadius, -1000 }, 0, M_PI / 2, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK_INFINITE_RADIUS1, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, 0, 0, curveRadius, { 0, curveRadius + 0.01, -1000 }, 0, M_PI / 2, curveRadius );
sCurveCalc.dump();
EXPECT_EQ( RiaSCurveCalculator::OK, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::CONVERGED, sCurveCalc.solveStatus() );
}
}
//--------------------------------------------------------------------------------------------------
/// Helper method to print the r1(q1, q2) r2(q1, q2) for plotting as 3D surface in Excel
//--------------------------------------------------------------------------------------------------
void printQ1Q2R1R2Matrix( cvf::Vec3d p1, double azi1, double inc1, cvf::Vec3d p2, double azi2, double inc2 )
{
double q1Start = 0.0;
double q1End = 3000;
double step1 = 100;
double q2Start = 0.0;
double q2End = 3000;
double step2 = 100;
std::cout << "R1" << std::endl;
std::cout << "q1\\q2"
<< " ";
for ( double q2 = q2Start; q2 < q2End; q2 += step2 )
{
std::cout << q2 << " ";
}
std::cout << std::endl;
for ( double q1 = q1Start; q1 < q1End; q1 += step1 )
{
std::cout << q1 << " ";
for ( double q2 = q2Start; q2 < q2End; q2 += step2 )
{
RiaSCurveCalculator sCurveCalc =
RiaSCurveCalculator::fromTangentsAndLength( p1, azi1, inc1, q1, p2, azi2, inc2, q2 );
if ( sCurveCalc.isOk() )
{
std::cout << sCurveCalc.firstRadius() << " ";
}
else
{
std::cout << "NS"
<< " ";
}
}
std::cout << std::endl;
}
std::cout << std::endl;
std::cout << "R2" << std::endl;
std::cout << "q1\\q2"
<< " ";
for ( double q2 = q2Start; q2 < q2End; q2 += step2 )
{
std::cout << q2 << " ";
}
std::cout << std::endl;
for ( double q1 = q1Start; q1 < q1End; q1 += step1 )
{
std::cout << q1 << " ";
for ( double q2 = q2Start; q2 < q2End; q2 += step2 )
{
RiaSCurveCalculator sCurveCalc =
RiaSCurveCalculator::fromTangentsAndLength( p1, azi1, inc1, q1, p2, azi2, inc2, q2 );
if ( sCurveCalc.isOk() )
{
std::cout << sCurveCalc.secondRadius() << " ";
}
else
{
std::cout << "NS"
<< " ";
}
}
std::cout << std::endl;
}
}
//--------------------------------------------------------------------------------------------------
/// Test used to print and plot the relations between q1, q2, r1 and r2 in excel as 3d surface
//--------------------------------------------------------------------------------------------------
TEST( DISABLED_RiaSCurveCalculator, q_r_relation )
{
std::cout << "Config 1" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 }, 0, 0 );
std::cout << "Config 1a" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 }, 0, angleEpsilon );
std::cout << "Config 2" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 }, 0, M_PI / 2.0 );
std::cout << "Config 3" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 }, 0, M_PI );
std::cout << "Config 3a" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 }, 0, M_PI - angleEpsilon );
std::cout << "Config 4" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI / 2.0, { 0, 0, -1000 }, 0, M_PI / 2.0 );
std::cout << "Config 5" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI / 2.0, { 0, 0, -1000 }, M_PI, M_PI / 2.0 );
std::cout << "Config 6" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI, { 0, 0, -1000 }, 0, 0 );
std::cout << "Config 6a" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI, { 0, 0, -1000 }, 0, angleEpsilon );
std::cout << "Config 6b" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI - angleEpsilon, { 0, 0, -1000 }, 0, 0.00 );
std::cout << "Config 7" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI, { 0, 0, -1000 }, 0, M_PI / 2.0 );
std::cout << "Config 8" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI, { 0, 0, -1000 }, 0, M_PI );
std::cout << "Config 8a" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI, { 0, 0, -1000 }, 0, M_PI - angleEpsilon );
std::cout << "Config 8b" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI - angleEpsilon, { 0, 0, -1000 }, 0, M_PI );
std::cout << "Config 9" << std::endl;
printQ1Q2R1R2Matrix( { 0, 0, 0 }, 0, M_PI / 2, { 0, 0, -1000 }, M_PI / 2, M_PI / 2 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaSCurveCalculator, ControlPointCurve )
{
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, { 0, 0, -100 }, { 0, 500, -1000 }, { 0, 0, -500 } );
EXPECT_EQ( RiaSCurveCalculator::FAILED_ARC_OVERLAP, sCurveCalc.curveStatus() );
EXPECT_EQ( RiaSCurveCalculator::NOT_SOLVED, sCurveCalc.solveStatus() );
// sCurveCalc.dump();
}
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, { 0, 0, -100 }, { 0, 100, -1000 }, { 0, 0, -900 } );
EXPECT_EQ( RiaSCurveCalculator::OK_INFINITE_RADIUS1, sCurveCalc.curveStatus() );
}
{
RiaSCurveCalculator sCurveCalc( { 0, 100, 0 }, { 0, 0, -100 }, { 0, 0, -1000 }, { 0, 0, -900 } );
EXPECT_EQ( RiaSCurveCalculator::OK_INFINITE_RADIUS2, sCurveCalc.curveStatus() );
}
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, { 0, 0, -100 }, { 0, 0, -1000 }, { 0, 0, -900 } );
EXPECT_EQ( RiaSCurveCalculator::OK_INFINITE_RADIUS12, sCurveCalc.curveStatus() );
}
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, { 0, 0, -100 }, { 0, 0, 0 }, { 0, 0, -900 } );
EXPECT_EQ( RiaSCurveCalculator::FAILED_ARC_OVERLAP, sCurveCalc.curveStatus() );
// sCurveCalc.dump();
}
{
RiaSCurveCalculator sCurveCalc( { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, -1000 }, { 0, 0, -900 } );
EXPECT_EQ( RiaSCurveCalculator::FAILED_INPUT_OVERLAP, sCurveCalc.curveStatus() );
// sCurveCalc.dump();
}
}
#include "RiaJCurveCalculator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaJCurveCalculator, Basic )
{
{
RiaJCurveCalculator calc( { 0, 0, 0 }, 0, M_PI / 2, 100, { 0, 100, -1000 } );
EXPECT_TRUE( calc.curveStatus() == RiaJCurveCalculator::OK );
cvf::Vec3d p11 = calc.firstArcEndpoint();
EXPECT_NEAR( 0, p11.x(), 1e-5 );
EXPECT_NEAR( 100, p11.y(), 1e-5 );
EXPECT_NEAR( -100, p11.z(), 1e-5 );
cvf::Vec3d n = calc.firstNormal();
EXPECT_NEAR( -1, n.x(), 1e-5 );
EXPECT_NEAR( 0, n.y(), 1e-5 );
EXPECT_NEAR( 0, n.z(), 1e-5 );
cvf::Vec3d c = calc.firstCenter();
EXPECT_NEAR( 0, c.x(), 1e-5 );
EXPECT_NEAR( 0, c.y(), 1e-5 );
EXPECT_NEAR( -100, c.z(), 1e-5 );
}
{
RiaJCurveCalculator calc( { 0, 0, 0 }, 0, 0, 100, { 0, 0, -1000 } );
EXPECT_TRUE( calc.curveStatus() == RiaJCurveCalculator::OK_STRAIGHT_LINE );
}
}
#include "RiaArcCurveCalculator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RiaArcCurveCalculator, Basic )
{
{
RiaArcCurveCalculator calc( { 0, 0, 0 }, 0, M_PI / 2, { 0, 1000, -1000 } );
EXPECT_TRUE( calc.curveStatus() == RiaArcCurveCalculator::OK );
EXPECT_NEAR( 1000.0, calc.radius(), 1e-5 );
EXPECT_NEAR( M_PI / 2, calc.arcAngle(), 1e-5 );
EXPECT_NEAR( M_PI / 2 * 1000, calc.arcLength(), 1e-5 );
cvf::Vec3d center = calc.center();
EXPECT_NEAR( 0, center.x(), 1e-5 );
EXPECT_NEAR( 0, center.y(), 1e-5 );
EXPECT_NEAR( -1000, center.z(), 1e-5 );
cvf::Vec3d n = calc.normal();
EXPECT_NEAR( -1, n.x(), 1e-5 );
EXPECT_NEAR( 0, n.y(), 1e-5 );
EXPECT_NEAR( 0, n.z(), 1e-5 );
cvf::Vec3d te = calc.endTangent();
EXPECT_NEAR( 0, te.x(), 1e-5 );
EXPECT_NEAR( 0, te.y(), 1e-5 );
EXPECT_NEAR( -1, te.z(), 1e-5 );
}
{
RiaArcCurveCalculator calc( { 0, 0, 0 }, 0, 0, { 0, 0, -1000 } );
EXPECT_TRUE( calc.curveStatus() == RiaArcCurveCalculator::OK_STRAIGHT_LINE );
cvf::Vec3d te = calc.endTangent();
EXPECT_NEAR( 0, te.x(), 1e-5 );
EXPECT_NEAR( 0, te.y(), 1e-5 );
EXPECT_NEAR( -1, te.z(), 1e-5 );
}
}

View File

@@ -0,0 +1,2 @@
RifReaderEclipseOutput/TEST10K_FLT_LGR_NNC_OUT.GRDECL
RifReaderEclipseOutput/TEST10K_FLT_LGR_NNC_OUT_FROM_RES.GRDECL

View File

@@ -0,0 +1,16 @@
EQUIL
-- Datum P-datum WOC Pcwoc GOC Pcgoc RSVD RSVD
1950 634.8 1940 0.00 3904 0.00 1 1 / asdf
1950 634.8 1944 0.00 3904 0.00 2 2 / asdf
1950 634.8 1898.5 0.00 3898.5 0.00 3 3 / sdfsdfsdf
1950 634 2020 0.00 4020 0.00 4 4 / ssss
1821.94 629.35 1883 0.00 3000 0.00 5 5 20/ sdfsdf
1821.94 629.35 1877 0.00 3000 0.00 6 6 / abab
1950 634.8 1944 0.00 3650 0.00 7 7 / aaa
1950 634.8 1944 0.00 3650 0.00 8 8 / bbb
1950 634.8 1820.5 0.00 3811 0.00 9 9 / ddd
1950 634.8 1892 0.00 3821 0.00 10 10 / sdf
-- 1950 634.8 1913 0.00 3871 0.00 11 11 / sdf
RSVD
2582.0 120.25

View File

@@ -0,0 +1,6 @@
INCLUDE
'../include/solution/equilibiration.inc' /
INCLUDE
'../include/grid/FAULT_JUN_05.INC'/

View File

@@ -0,0 +1,12 @@
EDIT
-- searching for faults stops when EDIT keyword is detected
INCLUDE
'../include/grid/FAULT_JUN_05.INC'/
SCHEDULE
-- searching for EQUIL stops when SCHEDULE keyword is detected
INCLUDE
'../include/solution/equilibiration.inc' /

View File

@@ -0,0 +1,30 @@
LETSWOF:L_1OW 1.83555
LETSWOF:E_1OW 5.84645
LETSWOF:T_1OW 1.46894
LETSWOF:L_1WO 4.9974
LETSWOF:E_1WO 1.59008
LETSWOF:T_1WO 0.762342
LETSWOF:SORW1 0.13
LETSWOF:KRW1 0.778509
MULTFLT:MULTFLT_F1 0.678647
LOG10_MULTFLT:MULTFLT_F1 -0.168356
MULTFLT:MULTFLT_F2 0.0051102
LOG10_MULTFLT:MULTFLT_F2 -2.29156
MULTFLT:MULTFLT_F3 0.347461
LOG10_MULTFLT:MULTFLT_F3 -0.459093
MULTFLT:MULTFLT_F4 0.113
LOG10_MULTFLT:MULTFLT_F4 -0.946922
MULTFLT:MULTFLT_F5 0.521999
LOG10_MULTFLT:MULTFLT_F5 -0.28233
RMSGLOBPARAMS:FWL 1708.62
MULTZ:MULTZ_MIDREEK 3.38433e-05
LOG10_MULTZ:MULTZ_MIDREEK -4.47053
LETSGOF:L_1GO 2.04966
LETSGOF:E_1GO 1.85285
LETSGOF:T_1GO 1.39467
LETSGOF:L_1OG 3.90509
LETSGOF:E_1OG 4.00383
LETSGOF:T_1OG 1.03539
LETSGOF:SORG1 0.34
TST:TEXT_PARAM YES
LETSGOF:KRG1 0.97

View File

@@ -0,0 +1,29 @@
LETSWOF:L_1OW 1.83555
LETSWOF:E_1OW 5.84645
LETSWOF:T_1OW 1.46894
LETSWOF:L_1WO 4.9974
LETSWOF:E_1WO 1.59008
LETSWOF:T_1WO 0.762342
LETSWOF:SORW1 0.13
LETSWOF:KRW1 0.778509
MULTFLT:MULTFLT_F1 0.678647
LOG10_MULTFLT:MULTFLT_F1 -0.168356 ERROR
MULTFLT:MULTFLT_F2 0.0051102
LOG10_MULTFLT:MULTFLT_F2 -2.29156
MULTFLT:MULTFLT_F3 0.347461
LOG10_MULTFLT:MULTFLT_F3 -0.459093
MULTFLT:MULTFLT_F4 0.113
LOG10_MULTFLT:MULTFLT_F4 -0.946922
MULTFLT:MULTFLT_F5 0.521999
LOG10_MULTFLT:MULTFLT_F5 -0.28233
RMSGLOBPARAMS:FWL 1708.62
MULTZ:MULTZ_MIDREEK 3.38433e-05
LOG10_MULTZ:MULTZ_MIDREEK -4.47053
LETSGOF:L_1GO 2.04966
LETSGOF:E_1GO 1.85285
LETSGOF:T_1GO 1.39467
LETSGOF:L_1OG 3.90509
LETSGOF:E_1OG 4.00383
LETSGOF:T_1OG 1.03539
LETSGOF:SORG1 0.34
LETSGOF:KRG1 0.97

View File

@@ -0,0 +1,29 @@
LETSWOF:L_1OW 1.83555
LETSWOF:E_1OW 5.84645
LETSWOF:T_1OW 1.46894
LETSWOF:L_1WO 4.9974
LETSWOF:E_1WO 1.59008
LETSWOF:T_1WO 0.762342
LETSWOF:SORW1 0.13
LETSWOF:KRW1 0.778509
MULTFLT:MULTFLT_F1 0.678647
LOG10_MULTFLT:MULTFLT_F1 -0.16ERROR8356
MULTFLT:MULTFLT_F2 0.0051102
LOG10_MULTFLT:MULTFLT_F2 -2.29156
MULTFLT:MULTFLT_F3 0.347461
LOG10_MULTFLT:MULTFLT_F3 -0.459093
MULTFLT:MULTFLT_F4 0.113
LOG10_MULTFLT:MULTFLT_F4 -0.946922
MULTFLT:MULTFLT_F5 0.521999
LOG10_MULTFLT:MULTFLT_F5 -0.28233
RMSGLOBPARAMS:FWL 1708.62
MULTZ:MULTZ_MIDREEK 3.38433e-05
LOG10_MULTZ:MULTZ_MIDREEK -4.47053
LETSGOF:L_1GO 2.04966
LETSGOF:E_1GO 1.85285
LETSGOF:T_1GO 1.39467
LETSGOF:L_1OG 3.90509
LETSGOF:E_1OG 4.00383
LETSGOF:T_1OG 1.03539
LETSGOF:SORG1 0.34
LETSGOF:KRG1 0.97

View File

@@ -0,0 +1,23 @@
-- Formations - Norne FFM ATW2013
'Garn 3' 1 - 1
'Garn 2' 2 - 2
'Garn 1' 3 - 3
'Not' 4 - 4
'Ile 2.2' 5 - 5
'Ile 2.1.3' 6 - 6
'Ile 2.1.2' 7 - 7
'Ile 2.1.1' 8 - 8
'Ile 1.3' 9 - 9
'Ile 1.2' 10 - 10
'Ile 1.1' 11 - 11
'Tofte 2.2' 12 - 12
'Tofte 2.1.3' 13 - 13
'Tofte 2.1.2' 14 - 14
'Tofte 2.1.1' 15 - 15
'Tofte 1.2.2' 16 - 16
'Tofte 1.2.1' 17 - 17
'Tofte 1.1' 18 - 18
'Tilje 4' 19 - 19
'Tilje 3' 20 - 20
'Tilje 2' 21 - 21
'Tilje 1' 22 - 22

View File

@@ -0,0 +1,23 @@
-- Formations - Norne FFM ATW2013
'Garn 3' 1 - 1 #000000
'Garn 2' 2 - 2 #FF0000
'Garn 1' 3 - 3 #00FF00
'Not' 4 - 4 #0000FF
'Ile 2.2' 5 - 5 #000000
'Ile 2.1.3' 6 - 6 #FF0000
'Ile 2.1.2' 7 - 7 #00FF00
'Ile 2.1.1' 8 - 8 #0000FF
'Ile 1.3' 9 - 9 #000000
'Ile 1.2' 10 - 10 #FF0000
'Ile 1.1' 11 - 11 #00FF00
'Tofte 2.2' 12 - 12 #0000FF
'Tofte 2.1.3' 13 - 13 #000000
'Tofte 2.1.2' 14 - 14 #FF0000
'Tofte 2.1.1' 15 - 15 #00FF00
'Tofte 1.2.2' 16 - 16 #0000FF
'Tofte 1.2.1' 17 - 17 #000000
'Tofte 1.1' 18 - 18 #FF0000
'Tilje 4' 19 - 19 #00FF00
'Tilje 3' 20 - 20 #0000FF
'Tilje 2' 21 - 21 #000000
'Tilje 1' 22 - 22 #FF0000

View File

@@ -0,0 +1,23 @@
-- Formations - Norne FFM ATW2013
'Garn 3' 1 - 1 black
'Garn 2' 2 - 2 red
'Garn 1' 3 - 3 green
'Not' 4 - 4 black
'Ile 2.2' 5 - 5 red
'Ile 2.1.3' 6 - 6 green
'Ile 2.1.2' 7 - 7 black
'Ile 2.1.1' 8 - 8 red
'Ile 1.3' 9 - 9 green
'Ile 1.2' 10 - 10 black
'Ile 1.1' 11 - 11 red
'Tofte 2.2' 12 - 12 green
'Tofte 2.1.3' 13 - 13 black
'Tofte 2.1.2' 14 - 14 red
'Tofte 2.1.1' 15 - 15 green
'Tofte 1.2.2' 16 - 16 black
'Tofte 1.2.1' 17 - 17 red
'Tofte 1.1' 18 - 18 green
'Tilje 4' 19 - 19 black
'Tilje 3' 20 - 20 red
'Tilje 2' 21 - 21 green
'Tilje 1' 22 - 22 red

View File

@@ -0,0 +1,24 @@
** ELASTIC SETTING FOR EACH ELEMENT
*Distribution Table, name=RSV_Res-1_Elastic_Table
MODULUS, MODULUS, MODULUS, RATIO, RATIO, RATIO, MODULUS,
MODULUS, MODULUS
*Distribution, name=RSV_Res-1_ELASTICS, location=ELEMENT, Table=RSV_Res-1_Elastic_Table
** Description: Element-by-Element Elastic properties
, 5000000000.0, 5000000000.0, 5000000000.0, 0.20, 0.20, 0.20, 2083333333.3,
2083333333.3, 2083333333.3,
Res-1.9764, 4998669605.36, 4998515013.81, 4985819146.89, 0.20, 0.20, 0.20, 2082985108.55
2083070114.11, 2083195609.10
Res-1.9763, 4998378764.10, 4996164940.36, 4967298321.58, 0.20, 0.20, 0.20, 2081274342.77
2083260687.92, 2083208458.19
Res-1.9762, 4998328556.97, 4995561505.50, 4964174759.06, 0.20, 0.20, 0.20, 2080763818.91
2083292591.66, 2083261000.75
Res-1.9761, 4998322867.69, 4994775664.48, 4958309492.44, 0.20, 0.20, 0.20, 2079995008.83
2083319853.08, 2083286460.02
Res-1.9760, 4998346381.04, 4994364077.05, 4955669201.25, 0.20, 0.20, 0.20, 2079617885.94
2083326454.00, 2083303403.23
Res-1.9759, 4998383500.18, 4994047179.49, 4953310980.82, 0.20, 0.20, 0.20, 2079279656.11
2083330439.00, 2083313410.86
Res-1.9758, 4998414899.36, 4993818845.60, 4951718769.13, 0.20, 0.20, 0.20, 2079052099.57
2083331777.84, 2083319849.17
Res-1.9757, 4998444377.89, 4993643343.12, 4950414224.86, 0.20, 0.20, 0.20, 2078864720.70
2083332526.54, 2083323962.41

View File

@@ -0,0 +1,12 @@
UNITS METRIC
WELLNAME A1_RI_HZX
"SOH" perforation 2010 2060 0.212 0
"SOH" perforation 2080 2130 0.212 0
"SOH" perforation 2150 2200 0.212 0
"SOH" perforation 2220 2270 0.212 0
"SOH" perforation 2290 2340 0.212 0
"SOH" perforation 2360 2410 0.212 0
"SOH" perforation 2430 2480 0.212 0
"SOH" perforation 2500 2550 0.212 0
"SOH" perforation 2570 2620 0.212 0
"SOH" perforation 2640 2690 0.212 0

View File

@@ -0,0 +1,31 @@
roff-asc
#ROFF file#
#Creator: RMS - Reservoir Modeling System, version 11.1.0#
tag filedata
int byteswaptest 1
char filetype "parameter"
char creationDate "06/03/2020 14:25:36"
endtag
tag version
int major 2
int minor 0
endtag
tag dimensions
int nX 46
int nY 112
int nZ 242
endtag
tag parameter
char name "composite"
array char codeNames 4
"only"
"four"
"code"
"names"
array int codeValues 6
0 1 2 3 4 5
array int data 4
-999 -999 -999 -999
endtag
tag eof
endtag

View File

@@ -0,0 +1,26 @@
roff-asc
#ROFF file#
#Creator: RMS - Reservoir Modeling System, version 11.1.0#
tag filedata
int byteswaptest 1
char filetype "parameter"
char creationDate "06/03/2020 14:25:36"
endtag
tag version
int major 2
int minor 0
endtag
tag dimensions
int nX 46
int nY 112
int nZ 242
endtag
tag parameter
char name "composite"
array int codeValues 6
0 1 2 3 4 5
array int data 4
-999 -999 -999 -999
endtag
tag eof
endtag

View File

@@ -0,0 +1,29 @@
roff-asc
#ROFF file#
#Creator: RMS - Reservoir Modeling System, version 11.1.0#
tag filedata
int byteswaptest 1
char filetype "parameter"
char creationDate "06/03/2020 14:25:36"
endtag
tag version
int major 2
int minor 0
endtag
tag dimensions
int nX 46
int nY 112
int nZ 242
endtag
tag parameter
char name "composite"
array char codeNames 2
"cn1"
"cn2"
array int codeValues this_is_not_a_number
0 1 2 3 4 5
array int data 4
-999 -999 -999 -999
endtag
tag eof
endtag

View File

@@ -0,0 +1,26 @@
roff-asc
#ROFF file#
#Creator: RMS - Reservoir Modeling System, version 11.1.0#
tag filedata
int byteswaptest 1
char filetype "parameter"
char creationDate "06/03/2020 14:25:36"
endtag
tag version
int major 2
int minor 0
endtag
tag dimensions
int nX 46
int nY 112
int nZ 242
endtag
tag parameter
char name "composite"
array char codeNames 1
"a name"
array int data 4
-999 -999 -999 -999
endtag
tag eof
endtag

View File

@@ -0,0 +1,33 @@
roff-asc
#ROFF file#
#Creator: RMS - Reservoir Modeling System, version 11.1.0#
tag filedata
int byteswaptest 1
char filetype "parameter"
char creationDate "06/03/2020 14:25:36"
endtag
tag version
int major 2
int minor 0
endtag
tag dimensions
int nX 46
int nY 112
int nZ 242
endtag
tag parameter
char name "composite"
array char codeNames 6
"code name 1"
"code name 2"
"code name 3"
"code name 4"
"code name 5"
"code name 6"
array int codeValues 6
0 1 2 3 4 5
array int data 4
-999 -999 -999 -999
endtag
tag eof
endtag

View File

@@ -0,0 +1,489 @@
<?xml version="1.0" ?>
<contours>
<grid xCount="25" yCount="23" uom="m" cs="tvd" frac="1">
<xs>[0.000 9.144 18.288 27.432 36.576 45.720 54.864 64.008 73.152 82.296 91.440 100.584 109.728 118.872 128.016 137.160 146.304 155.448 164.592 173.736 182.880 192.024 201.168 210.312 219.456 ]</xs>
<ys>[2858.516 2849.880 2841.244 2832.608 2823.972 2820.665 2817.358 2808.321 2799.283 2794.284 2789.286 2781.188 2773.091 2764.993 2760.345 2755.697 2751.277 2746.858 2738.323 2729.789 2721.254 2712.720 2704.186 ]</ys>
</grid>
<perf uom="m" frac="1">
<topTVD>2773.680</topTVD>
<bottomTVD>2773.680</bottomTVD>
<topMD>2804.160</topMD>
<bottomMD>2804.770</bottomMD>
</perf>
<properties>
<property name="Width - Effective" uom="cm">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.006599 0.007267 0.005106 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.010933 0.010326 0.006549 0.002868 0.041439 0.003864 0.005312 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.156969 0.148225 0.141401 0.132092 0.127827 0.001292 0.001117 0.011365 0.003382 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.162227 0.134704 0.140920 0.155954 0.181063 0.157884 0.134474 0.000141 0.002995 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.116274 0.127379 0.095162 0.085395 0.098685 0.139853 0.158597 0.128680 0.021546 0.013427 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.055252 0.090133 0.097527 0.100038 0.092390 0.090461 0.138938 0.148599 0.000000 0.028171 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.045677 0.059408 0.107219 0.090164 0.092029 0.091795 0.139242 0.153773 0.136202 0.029148 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.032796 0.056088 0.063294 0.067607 0.069711 0.068179 0.147297 0.174227 0.140395 0.008306 0.014771 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.030009 0.046680 0.061979 0.076771 0.057918 0.089275 0.171296 0.196207 0.142044 0.000826 0.015167 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.118627 0.079404 0.074651 0.068755 0.043337 0.111683 0.178167 0.175246 0.134281 0.036563 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.100006 0.081170 0.077452 0.043922 0.079958 0.164882 0.193966 0.159476 0.011040 0.034638 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.072600 0.064055 0.029891 0.062791 0.160214 0.192274 0.194078 0.149482 0.017751 0.031658 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.071201 0.082311 0.078591 0.164629 0.191751 0.189427 0.178506 0.125993 0.009326 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.164434 0.195153 0.213042 0.209569 0.199025 0.153762 0.128230 0.031350 0.007214 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.224015 0.225824 0.196136 0.175725 0.147450 0.017825 0.029475 0.009676 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.210135 0.186533 0.163399 0.149378 0.061699 0.020104 0.017043 0.004253 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.134473 0.122349 0.004133 0.028817 0.011714 0.010312 0.001955 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.012069 0.003226 0.005550 0.004484 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="Conductivity-Total" uom="md-m">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[1.736234 1.912153 1.343488 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[2.856008 2.697283 1.710628 0.749226 10.824710 1.009309 1.387506 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[40.706512 38.438911 36.669220 34.255127 33.149185 7.837394 2.111845 2.947347 0.877170 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[43.300613 35.954578 37.613586 41.626320 48.328209 42.141594 35.893108 4.326466 0.799316 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[30.918808 33.871620 25.304667 22.707695 26.241570 37.188610 42.172993 34.217739 5.729384 3.570283 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[15.106816 24.643560 26.665367 27.351702 25.260868 24.733328 37.987751 40.629139 0.000000 7.702352 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[12.439384 16.178862 29.199598 24.554922 25.062593 24.999115 37.920357 41.877640 37.092579 7.938149 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[8.753751 14.970630 16.893879 18.045012 18.606701 18.197798 39.315250 46.503311 37.473175 2.216958 3.942689 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[7.954777 12.373921 16.429352 20.350309 15.352845 23.664845 45.407055 52.010342 37.652954 0.218828 4.020452 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[31.229650 20.903852 19.652475 18.100399 11.408943 33.968338 46.904114 46.135101 35.350800 9.625496 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[25.814980 20.952826 19.993032 11.337770 25.728062 42.561977 50.069447 41.166382 5.113105 8.941309 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[18.661039 16.464607 7.683194 19.899736 41.181290 49.422081 49.885689 38.422703 4.562820 8.137413 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[18.098726 23.833443 33.713806 41.847527 48.741776 48.151070 45.374866 32.026600 2.370625 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[41.477814 49.226543 53.739021 52.862770 50.203323 38.785885 32.345364 7.907846 1.819710 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[57.468307 57.932426 50.316139 45.080101 37.826492 7.644749 7.561387 2.482348 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[53.756054 47.718204 41.800072 38.213436 15.783506 5.142892 4.359911 1.087941 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[32.752499 29.799530 6.854710 7.018809 2.853180 2.511691 0.476083 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[2.918071 0.779894 1.341766 1.084090 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="BETA" uom="atm-sec^2/g">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
</properties>
<grid xCount="25" yCount="23" uom="m" cs="tvd" frac="2">
<xs>[0.000 9.144 18.288 27.432 36.576 45.720 54.864 64.008 73.152 82.296 91.440 100.584 109.728 118.872 128.016 137.160 146.304 155.448 164.592 173.736 182.880 192.024 201.168 210.312 219.456 ]</xs>
<ys>[2858.516 2849.880 2841.244 2832.608 2823.972 2820.665 2817.358 2808.321 2799.283 2794.284 2789.286 2781.188 2773.091 2764.993 2760.345 2755.697 2751.277 2746.858 2738.323 2729.789 2721.254 2712.720 2704.186 ]</ys>
</grid>
<perf uom="m" frac="2">
<topTVD>2773.680</topTVD>
<bottomTVD>2773.680</bottomTVD>
<topMD>2819.400</topMD>
<bottomMD>2820.010</bottomMD>
</perf>
<properties>
<property name="Width - Effective" uom="cm">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.040212 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="Conductivity-Total" uom="md-m">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[10.659304 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="BETA" uom="atm-sec^2/g">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
</properties>
<grid xCount="25" yCount="23" uom="m" cs="tvd" frac="3">
<xs>[0.000 9.144 18.288 27.432 36.576 45.720 54.864 64.008 73.152 82.296 91.440 100.584 109.728 118.872 128.016 137.160 146.304 155.448 164.592 173.736 182.880 192.024 201.168 210.312 219.456 ]</xs>
<ys>[2858.516 2849.880 2841.244 2832.608 2823.972 2820.665 2817.358 2808.321 2799.283 2794.284 2789.286 2781.188 2773.091 2764.993 2760.345 2755.697 2751.277 2746.858 2738.323 2729.789 2721.254 2712.720 2704.186 ]</ys>
</grid>
<perf uom="m" frac="3">
<topTVD>2773.680</topTVD>
<bottomTVD>2773.680</bottomTVD>
<topMD>2834.640</topMD>
<bottomMD>2835.250</bottomMD>
</perf>
<properties>
<property name="Width - Effective" uom="cm">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.010085 0.008091 0.008670 0.001900 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.009773 0.004651 0.001463 0.032333 0.008348 0.002435 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.165045 0.161131 0.153417 0.136026 0.123139 0.069587 0.019948 0.002101 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.179989 0.173282 0.172576 0.191330 0.184589 0.144984 0.067630 0.029443 0.001009 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.125213 0.111770 0.096738 0.109617 0.146309 0.169251 0.136238 0.063561 0.008820 0.000169 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.090146 0.098976 0.098904 0.098768 0.123294 0.141666 0.152773 0.003431 0.013253 0.006085 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.069015 0.088037 0.071714 0.073100 0.060490 0.140714 0.160499 0.032449 0.015071 0.002788 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.058919 0.080372 0.082258 0.076545 0.070737 0.145363 0.170738 0.031420 0.015330 0.004977 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.029836 0.061894 0.080386 0.057825 0.087586 0.171435 0.177713 0.037577 0.008413 0.010085 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.180831 0.065257 0.069143 0.068770 0.116440 0.193240 0.173985 0.040846 0.015656 0.003467 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.069587 0.071580 0.063758 0.071652 0.163155 0.205669 0.161847 0.049705 0.011711 0.002127 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.082210 0.069883 0.063873 0.075463 0.185356 0.216974 0.154566 0.019505 0.007559 0.001262 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.076013 0.066047 0.092751 0.158478 0.203945 0.199272 0.143527 0.039561 0.002166 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.096087 0.176382 0.200390 0.216587 0.212738 0.167184 0.006754 0.015797 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.219382 0.247777 0.252984 0.233723 0.200752 0.146793 0.038604 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.234441 0.253526 0.239806 0.212985 0.175759 0.131825 0.009442 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.210324 0.204999 0.169817 0.142771 0.123701 0.024673 0.011629 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.127437 0.115570 0.016061 0.009386 0.008653 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="Conductivity-Total" uom="md-m">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[2.653590 2.128951 2.281372 0.499958 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[2.553011 1.215055 0.382200 8.446023 2.180557 0.636011 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[42.800755 41.785763 39.785336 35.275276 31.933270 18.045906 5.173023 0.544854 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[48.041653 46.251526 46.063038 51.068653 49.269455 38.698311 18.051443 7.858835 0.269281 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[33.295670 29.721102 25.723820 29.148663 38.905285 45.005867 36.227283 16.901661 2.345238 0.045026 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[24.647333 27.061455 27.041897 27.004709 33.710281 38.733505 41.770317 3.254671 3.623597 1.663592 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[18.795191 23.975649 19.530285 19.907782 16.473471 38.321388 43.709602 8.837068 4.104240 0.759199 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[15.726136 21.452129 21.955673 20.430687 18.880545 38.799232 45.572060 8.386318 4.091673 1.328377 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[13.824607 16.406828 21.308731 15.328093 23.217136 45.443974 47.108074 9.960929 2.230132 2.673277 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[47.605423 17.179466 18.202650 18.104263 34.221920 50.872318 45.803017 10.753159 4.121521 0.912666 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[17.962957 18.477325 16.458067 18.495790 42.116058 53.090405 41.778339 12.830625 3.023015 0.549042 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[21.131214 17.962795 16.417971 19.396877 47.643879 55.770790 39.729504 5.013553 1.942963 0.324461 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[19.321857 16.788626 26.493015 40.284061 51.841393 50.653435 36.483627 10.056015 0.550495 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[28.261518 44.491707 50.547539 54.633224 53.662182 42.171539 4.564503 3.984722 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[56.279766 63.564152 64.899956 59.958828 51.500500 37.657932 9.903442 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[59.973911 64.856201 61.346283 54.485069 44.961998 33.722939 2.415417 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[51.227116 49.929970 41.361084 34.773758 30.128929 6.009503 2.832336 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[30.811954 27.942541 3.883194 2.269368 2.092091 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
<property name="BETA" uom="atm-sec^2/g">
<time value="154.716">
<depth>2704.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2712.72</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2721.25</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2729.79</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2738.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2746.86</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2751.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2755.70</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2760.34</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2764.99</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2773.09</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2781.19</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2789.29</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2794.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2799.28</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2808.32</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2817.36</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2820.66</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2823.97</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2832.61</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2841.24</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2849.88</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
<depth>2858.52</depth>
<data>[0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ]</data>
</time>
</property>
</properties>
</contours>

View File

@@ -0,0 +1,24 @@
<contours>
<grid xCount="4" yCount="5" uom="m" cs="tvd" frac="1">
<xs><![CDATA[0
50 100 150
]]></xs>
<ys><![CDATA[2035 2025 2015 2005 1995 ]]></ys>
</grid>
<properties>
<property name="CONDUCTIVITY" uom="md-m">
<time value="117.238">
<depth>1995.00</depth>
<![CDATA[0 0 0 0]]>
<depth>2005.00</depth>
<![CDATA[301.7 301.7 0.0 0 ]]>
<depth>2015.00</depth>
<![CDATA[301.7 301.7 0.0 0 ]]>
<depth>2025.00</depth>
<![CDATA[301.7 301.7 0.0 0 ]]>
<depth>2035.00</depth>
<![CDATA[0 0 0 0]]>
</time>
</property>
</properties>
</contours>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More