2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 09:45:23 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
2017-01-10 09:51:39 +01:00
|
|
|
#include "RigEclipseCaseData.h"
|
2013-03-22 16:58:44 +01:00
|
|
|
#include "RigGridManager.h"
|
2017-01-09 20:46:56 +01:00
|
|
|
#include "RigMainGrid.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-02-14 10:08:56 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-02-14 10:08:56 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
TEST( RigGridManager, BasicTest )
|
2013-02-14 10:08:56 +01:00
|
|
|
{
|
|
|
|
|
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( nullptr );
|
|
|
|
|
eclipseCase->setMainGrid( mainGridA.p() );
|
2013-02-28 08:04:43 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
EXPECT_EQ( mainGridA->refCount(), 2 );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
2013-03-22 15:43:42 +01:00
|
|
|
RigGridManager gridCollection;
|
2019-09-06 10:40:57 +02:00
|
|
|
gridCollection.addCase( eclipseCase.p() );
|
|
|
|
|
EXPECT_EQ( mainGridA->refCount(), 2 );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
|
|
|
|
cvf::ref<RigMainGrid> mainGridB = mainGridA;
|
2019-09-06 10:40:57 +02:00
|
|
|
EXPECT_EQ( mainGridA->refCount(), 3 );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
cvf::ref<RigMainGrid> existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
|
|
|
|
|
EXPECT_TRUE( existingGrid.notNull() );
|
2013-02-14 10:08:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2013-02-14 10:08:56 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
TEST( RigGridManager, EqualTests )
|
2013-02-14 10:08:56 +01:00
|
|
|
{
|
|
|
|
|
cvf::ref<RigMainGrid> mainGridA = new RigMainGrid;
|
2019-09-06 10:40:57 +02:00
|
|
|
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 ) );
|
2013-02-28 08:04:43 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( nullptr );
|
|
|
|
|
eclipseCase->setMainGrid( mainGridA.p() );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
2013-03-22 15:43:42 +01:00
|
|
|
RigGridManager gridCollection;
|
2019-09-06 10:40:57 +02:00
|
|
|
gridCollection.addCase( eclipseCase.p() );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
cvf::ref<RigMainGrid> mainGridB = new RigMainGrid;
|
|
|
|
|
cvf::ref<RigMainGrid> existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
|
|
|
|
|
EXPECT_TRUE( existingGrid.isNull() );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
mainGridB->nodes().push_back( cvf::Vec3d( 0, 0, 0 ) );
|
|
|
|
|
existingGrid = gridCollection.findEqualGrid( mainGridB.p() );
|
|
|
|
|
EXPECT_TRUE( existingGrid.isNull() );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
|
|
|
|
// Insert nodes in opposite direction
|
2019-09-06 10:40:57 +02:00
|
|
|
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() );
|
2013-02-14 10:08:56 +01:00
|
|
|
|
|
|
|
|
// Overwrite to match the node structure of mainGridA
|
2019-09-06 10:40:57 +02:00
|
|
|
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() );
|
2013-02-14 10:08:56 +01:00
|
|
|
}
|
|
|
|
|
|
2013-02-12 07:11:32 +01:00
|
|
|
/*
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2012-05-18 09:45:23 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
TEST(RigReservoirTest, BasicTest)
|
|
|
|
|
{
|
2013-03-22 16:58:44 +01:00
|
|
|
cvf::ref<RigSingleWellResultsData> wellCellTimeHistory = new RigSingleWellResultsData;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
QDateTime wellStartTime = QDateTime::currentDateTime();
|
|
|
|
|
|
2013-01-22 11:34:47 +01:00
|
|
|
int wellTimeStepCount = 5;
|
2012-05-18 09:45:23 +02:00
|
|
|
wellCellTimeHistory->m_wellCellsTimeSteps.resize(wellTimeStepCount);
|
|
|
|
|
|
2013-01-22 11:34:47 +01:00
|
|
|
int i;
|
2012-05-18 09:45:23 +02:00
|
|
|
for (i = 0; i < wellTimeStepCount; i++)
|
|
|
|
|
{
|
|
|
|
|
wellCellTimeHistory->m_wellCellsTimeSteps[i].m_timestamp = QDateTime(wellStartTime).addYears(i);
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-22 11:34:47 +01:00
|
|
|
int resultTimeStepCount = 2 * wellTimeStepCount;
|
2013-03-18 11:40:39 +01:00
|
|
|
std::vector<QDateTime> resultTimes;
|
2012-05-18 09:45:23 +02:00
|
|
|
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];
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
const RigWellResultFrame& wellCells =
|
|
|
|
|
wellCellTimeHistory->wellResultFrame(wellCellTimeHistory->m_resultTimeStepIndexToWellTimeStepIndex[i]); qDebug() <<
|
|
|
|
|
wellCells.m_timestamp;
|
2012-05-18 09:45:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-12 07:11:32 +01:00
|
|
|
|
2013-02-28 09:59:36 +01:00
|
|
|
*/
|