2012-06-26 09:10:41 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-06-26 09:10:41 -05: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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-06-25 06:14:04 -05:00
|
|
|
#include "RimEclipseInputCase.h"
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RiaPreferences.h"
|
2016-06-29 08:45:20 -05:00
|
|
|
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RifEclipseInputFileTools.h"
|
2012-06-26 09:10:41 -05:00
|
|
|
#include "RifReaderEclipseInput.h"
|
2014-07-24 03:11:43 -05:00
|
|
|
#include "RifReaderInterface.h"
|
|
|
|
#include "RifReaderMockModel.h"
|
2014-07-30 02:13:47 -05:00
|
|
|
#include "RifReaderSettings.h"
|
2016-06-29 08:45:20 -05:00
|
|
|
|
2017-01-09 12:14:07 -06:00
|
|
|
#include "RigActiveCellInfo.h"
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseCellResultsData.h"
|
2017-01-10 02:51:39 -06:00
|
|
|
#include "RigEclipseCaseData.h"
|
2017-01-09 13:27:46 -06:00
|
|
|
#include "RigMainGrid.h"
|
2016-06-29 08:45:20 -05:00
|
|
|
|
2017-06-13 08:41:52 -05:00
|
|
|
#include "RiaDefines.h"
|
2015-06-25 06:14:04 -05:00
|
|
|
#include "RimEclipseInputProperty.h"
|
|
|
|
#include "RimEclipseInputPropertyCollection.h"
|
2014-07-24 07:03:17 -05:00
|
|
|
#include "RimReservoirCellResultsStorage.h"
|
2016-06-29 08:45:20 -05:00
|
|
|
#include "RimTools.h"
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2018-10-10 02:35:01 -05:00
|
|
|
#include "cafPdmUiTreeOrdering.h"
|
2012-06-26 09:10:41 -05:00
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
|
2014-07-24 03:11:43 -05:00
|
|
|
#include <QFileInfo>
|
2017-06-28 13:10:06 -05:00
|
|
|
#include <QDir>
|
2012-10-24 03:52:44 -05:00
|
|
|
|
2015-06-25 04:50:13 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RimEclipseInputCase, "RimInputReservoir");
|
2012-06-26 09:10:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
RimEclipseInputCase::RimEclipseInputCase()
|
2015-05-15 01:40:27 -05:00
|
|
|
: RimEclipseCase()
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-03-22 10:40:41 -05:00
|
|
|
CAF_PDM_InitObject("RimInputCase", ":/EclipseInput48x48.png", "", "");
|
2017-04-06 11:37:43 -05:00
|
|
|
CAF_PDM_InitField(&m_gridFileName, "GridFileName", QString(), "Case File Name", "", "" ,"");
|
2015-08-05 06:27:36 -05:00
|
|
|
m_gridFileName.uiCapability()->setUiReadOnly(true);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&m_inputPropertyCollection, "InputPropertyCollection", "", "", "", "");
|
2015-06-25 04:54:31 -05:00
|
|
|
m_inputPropertyCollection = new RimEclipseInputPropertyCollection;
|
2015-08-24 04:35:07 -05:00
|
|
|
m_inputPropertyCollection->parentField()->uiCapability()->setUiHidden(true);
|
2017-06-28 13:10:06 -05:00
|
|
|
|
2017-11-30 06:44:18 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files", "", "", "");
|
2017-06-28 13:10:06 -05:00
|
|
|
m_additionalFiles.registerGetMethod(this, &RimEclipseInputCase::additionalFiles);
|
|
|
|
m_additionalFiles.uiCapability()->setUiReadOnly(true);
|
|
|
|
m_additionalFiles.xmlCapability()->setIOWritable(false);
|
|
|
|
|
2017-11-30 06:44:18 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_additionalFilenames_OBSOLETE, "AdditionalFileNames", "Additional Files", "", "" ,"");
|
2017-06-28 13:10:06 -05:00
|
|
|
m_additionalFilenames_OBSOLETE.uiCapability()->setUiReadOnly(true);
|
|
|
|
m_additionalFilenames_OBSOLETE.uiCapability()->setUiHidden(true);
|
|
|
|
m_additionalFilenames_OBSOLETE.xmlCapability()->setIOWritable(false);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
RimEclipseInputCase::~RimEclipseInputCase()
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
|
|
|
delete m_inputPropertyCollection;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Open the supplied file set. If no grid data has been read, it will first find the possible
|
|
|
|
/// grid data among the files then read all supported properties from the files matching the grid
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-10-19 04:37:17 -05:00
|
|
|
bool RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-06-13 08:41:52 -05:00
|
|
|
if (fileNames.contains(RiaDefines::mockModelBasicInputCase()))
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-10-08 07:28:01 -05:00
|
|
|
cvf::ref<RifReaderInterface> readerInterface = this->createMockModel(fileNames[0]);
|
2017-09-13 03:39:20 -05:00
|
|
|
results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p());
|
|
|
|
results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p());
|
2013-02-06 03:02:50 -06:00
|
|
|
|
2017-08-11 07:05:59 -05:00
|
|
|
eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)->computeDerivedData();
|
|
|
|
eclipseCaseData()->activeCellInfo(RiaDefines::FRACTURE_MODEL)->computeDerivedData();
|
2013-10-08 07:28:01 -05:00
|
|
|
|
|
|
|
QFileInfo gridFileName(fileNames[0]);
|
|
|
|
QString caseName = gridFileName.completeBaseName();
|
|
|
|
this->caseUserDescription = caseName;
|
|
|
|
|
|
|
|
computeCachedData();
|
2013-02-06 03:02:50 -06:00
|
|
|
|
2017-10-19 04:37:17 -05:00
|
|
|
return true;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2018-02-18 11:56:43 -06:00
|
|
|
if (this->eclipseCaseData() == nullptr)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-09-08 07:43:28 -05:00
|
|
|
this->setReservoirData(new RigEclipseCaseData(this));
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// First find and read the grid data
|
2017-03-15 03:10:16 -05:00
|
|
|
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-12-20 02:18:52 -06:00
|
|
|
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
for (int i = 0; i < fileNames.size(); i++)
|
|
|
|
{
|
2017-08-29 01:27:42 -05:00
|
|
|
if (RifEclipseInputFileTools::openGridFile(fileNames[i], this->eclipseCaseData(), prefs->readerSettings()->importFaults()))
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
|
|
|
m_gridFileName = fileNames[i];
|
2013-10-08 07:28:01 -05:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
QFileInfo gridFileName(fileNames[i]);
|
|
|
|
QString caseName = gridFileName.completeBaseName();
|
2013-10-08 07:28:01 -05:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
this->caseUserDescription = caseName;
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2018-08-24 02:34:24 -05:00
|
|
|
this->eclipseCaseData()->mainGrid()->setFlipAxis(m_flipXAxis, m_flipYAxis);
|
2013-04-26 06:19:34 -05:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
computeCachedData();
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2017-03-15 03:10:16 -05:00
|
|
|
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-10-19 04:37:17 -05:00
|
|
|
return false; // No grid present
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
std::vector<QString> filesToRead;
|
|
|
|
for (const QString& filename : fileNames)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-06-28 13:10:06 -05:00
|
|
|
bool exists = false;
|
|
|
|
for (const QString& currentFileName : additionalFiles())
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-06-28 13:10:06 -05:00
|
|
|
if (filename == currentFileName)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-06-28 13:10:06 -05:00
|
|
|
exists = true;
|
|
|
|
break;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
2017-06-28 13:10:06 -05:00
|
|
|
if (!exists)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-06-28 13:10:06 -05:00
|
|
|
filesToRead.push_back(filename);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
for (const QString& propertyFileName : filesToRead)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-03-15 03:10:16 -05:00
|
|
|
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->eclipseCaseData());
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
std::map<QString, QString>::iterator it;
|
|
|
|
for (it = readProperties.begin(); it != readProperties.end(); ++it)
|
|
|
|
{
|
2015-06-25 04:51:59 -05:00
|
|
|
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
2012-06-26 09:10:41 -05:00
|
|
|
inputProperty->resultName = it->first;
|
|
|
|
inputProperty->eclipseKeyword = it->second;
|
|
|
|
inputProperty->fileName = propertyFileName;
|
2015-06-25 04:51:59 -05:00
|
|
|
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
2012-06-26 09:10:41 -05:00
|
|
|
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
|
|
|
}
|
|
|
|
}
|
2017-10-19 04:37:17 -05:00
|
|
|
return true;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
bool RimEclipseInputCase::openEclipseGridFile()
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
|
|
|
// Early exit if reservoir data is created
|
2018-02-18 11:56:43 -06:00
|
|
|
if (this->eclipseCaseData() == nullptr)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2012-10-24 03:52:44 -05:00
|
|
|
cvf::ref<RifReaderInterface> readerInterface;
|
|
|
|
|
2017-06-13 08:41:52 -05:00
|
|
|
if (m_gridFileName().contains(RiaDefines::mockModelBasicInputCase()))
|
2012-10-24 03:52:44 -05:00
|
|
|
{
|
2013-04-11 05:06:38 -05:00
|
|
|
readerInterface = this->createMockModel(this->m_gridFileName());
|
2012-10-24 03:52:44 -05:00
|
|
|
}
|
|
|
|
else
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2012-10-24 03:52:44 -05:00
|
|
|
readerInterface = new RifReaderEclipseInput;
|
2013-12-20 02:18:52 -06:00
|
|
|
|
2017-09-08 07:43:28 -05:00
|
|
|
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
|
2013-02-14 03:02:49 -06:00
|
|
|
if (!readerInterface->open(m_gridFileName, eclipseCase.p()))
|
2012-10-24 03:52:44 -05:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-03-18 08:34:29 -05:00
|
|
|
this->setReservoirData( eclipseCase.p() );
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2017-03-15 03:10:16 -05:00
|
|
|
CVF_ASSERT(this->eclipseCaseData());
|
2012-10-24 03:52:44 -05:00
|
|
|
CVF_ASSERT(readerInterface.notNull());
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2017-09-13 03:39:20 -05:00
|
|
|
results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p());
|
|
|
|
results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p());
|
2013-04-26 06:19:34 -05:00
|
|
|
|
2018-08-24 02:34:24 -05:00
|
|
|
this->eclipseCaseData()->mainGrid()->setFlipAxis(m_flipXAxis, m_flipYAxis);
|
2013-02-22 03:12:06 -06:00
|
|
|
|
|
|
|
computeCachedData();
|
|
|
|
loadAndSyncronizeInputProperties();
|
2012-10-24 03:52:44 -05:00
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-03-22 09:50:44 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
2012-10-24 03:52:44 -05:00
|
|
|
if (app->preferences()->autocomputeDepthRelatedProperties)
|
|
|
|
{
|
2017-09-13 03:39:20 -05:00
|
|
|
results(RiaDefines::MATRIX_MODEL)->computeDepthRelatedResults();
|
|
|
|
results(RiaDefines::FRACTURE_MODEL)->computeDepthRelatedResults();
|
2012-10-24 03:52:44 -05:00
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-04-21 05:02:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseInputCase::reloadEclipseGridFile()
|
|
|
|
{
|
|
|
|
setReservoirData(nullptr);
|
2017-04-21 09:05:25 -05:00
|
|
|
openReserviorCase();
|
2017-04-21 05:02:48 -05:00
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
#define for_all(stdVector, indexName) for (size_t indexName = 0; indexName < stdVector.size(); ++indexName)
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Loads input property data from the gridFile and additional files
|
|
|
|
/// Creates new InputProperties if necessary, and flags the unused ones as obsolete
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
void RimEclipseInputCase::loadAndSyncronizeInputProperties()
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
|
|
|
// Make sure we actually have reservoir data
|
|
|
|
|
2017-03-15 03:10:16 -05:00
|
|
|
CVF_ASSERT(this->eclipseCaseData());
|
|
|
|
CVF_ASSERT(this->eclipseCaseData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0,0,0));
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
// Then read the properties from all the files referenced by the InputReservoir
|
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
std::vector<QString> filenames;
|
2018-01-24 08:01:19 -06:00
|
|
|
for (const QString& fileName : additionalFiles())
|
2017-06-28 13:10:06 -05:00
|
|
|
{
|
2018-01-24 08:01:19 -06:00
|
|
|
filenames.push_back(fileName);
|
2017-06-28 13:10:06 -05:00
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
filenames.push_back(m_gridFileName);
|
|
|
|
|
|
|
|
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
|
|
|
|
|
2016-11-25 09:36:39 -06:00
|
|
|
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() * inputPropCount), "Reading Input properties" );
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
for_all(filenames, i)
|
|
|
|
{
|
2017-03-06 04:18:57 -06:00
|
|
|
int progress = static_cast<int>(i*inputPropCount);
|
2012-06-26 09:10:41 -05:00
|
|
|
// Find all the keywords present on the file
|
|
|
|
|
|
|
|
progInfo.setProgressDescription(filenames[i]);
|
|
|
|
|
|
|
|
QFileInfo fileNameInfo(filenames[i]);
|
|
|
|
bool isExistingFile = fileNameInfo.exists();
|
|
|
|
|
|
|
|
std::set<QString> fileKeywordSet;
|
|
|
|
|
|
|
|
if (isExistingFile)
|
|
|
|
{
|
2013-12-03 13:30:32 -06:00
|
|
|
std::vector< RifKeywordAndFilePos > fileKeywords;
|
2016-10-21 01:48:33 -05:00
|
|
|
RifEclipseInputFileTools::findKeywordsOnFile(filenames[i], &fileKeywords);
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2012-10-08 12:44:10 -05:00
|
|
|
for_all(fileKeywords, fkIt) fileKeywordSet.insert(fileKeywords[fkIt].keyword);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Find the input property objects referring to the file
|
|
|
|
|
2015-06-25 04:51:59 -05:00
|
|
|
std::vector<RimEclipseInputProperty*> ipsUsingThisFile = this->m_inputPropertyCollection()->findInputProperties(filenames[i]);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
// Read property data for each inputProperty
|
|
|
|
|
|
|
|
for_all(ipsUsingThisFile, ipIdx)
|
|
|
|
{
|
|
|
|
if (!isExistingFile)
|
|
|
|
{
|
2015-06-25 04:51:59 -05:00
|
|
|
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::FILE_MISSING;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString kw = ipsUsingThisFile[ipIdx]->eclipseKeyword();
|
2015-06-25 04:51:59 -05:00
|
|
|
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
|
2012-06-26 09:10:41 -05:00
|
|
|
if (fileKeywordSet.count(kw))
|
|
|
|
{
|
2017-03-15 03:10:16 -05:00
|
|
|
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2015-06-25 04:51:59 -05:00
|
|
|
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::RESOLVED;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fileKeywordSet.erase(kw);
|
|
|
|
}
|
|
|
|
|
2013-01-22 04:34:47 -06:00
|
|
|
progInfo.setProgress(static_cast<int>(progress + ipIdx) );
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2013-01-22 04:34:47 -06:00
|
|
|
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
|
2012-06-26 09:10:41 -05:00
|
|
|
// Check if there are more known property keywords left on file. If it is, read them and create inputProperty objects
|
|
|
|
|
2018-10-10 02:35:01 -05:00
|
|
|
for (const QString& fileKeyword : fileKeywordSet)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
|
|
|
{
|
2017-08-11 07:05:59 -05:00
|
|
|
QString resultName = this->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->makeResultNameUnique(fileKeyword);
|
2017-03-15 03:10:16 -05:00
|
|
|
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), fileKeyword, resultName))
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2016-11-25 09:36:39 -06:00
|
|
|
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
|
|
|
inputProperty->resultName = resultName;
|
|
|
|
inputProperty->eclipseKeyword = fileKeyword;
|
|
|
|
inputProperty->fileName = filenames[i];
|
|
|
|
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
|
|
|
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
2016-11-25 09:36:39 -06:00
|
|
|
|
|
|
|
progInfo.setProgress(static_cast<int>(progress + inputPropCount));
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for_all(m_inputPropertyCollection->inputProperties, i)
|
|
|
|
{
|
2015-06-25 04:51:59 -05:00
|
|
|
if (m_inputPropertyCollection->inputProperties[i]->resolvedState() == RimEclipseInputProperty::UNKNOWN)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2015-06-25 04:51:59 -05:00
|
|
|
m_inputPropertyCollection->inputProperties[i]->resolvedState = RimEclipseInputProperty::FILE_MISSING;
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-10 02:35:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimEclipseInputPropertyCollection* RimEclipseInputCase::inputPropertyCollection()
|
|
|
|
{
|
|
|
|
return m_inputPropertyCollection();
|
|
|
|
}
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel(QString modelName)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2017-09-08 07:43:28 -05:00
|
|
|
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(this);
|
2012-06-26 09:10:41 -05:00
|
|
|
cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel;
|
|
|
|
|
2017-06-13 08:41:52 -05:00
|
|
|
if (modelName == RiaDefines::mockModelBasicInputCase())
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-04-11 05:06:38 -05:00
|
|
|
m_gridFileName = modelName;
|
|
|
|
|
2012-06-26 09:10:41 -05:00
|
|
|
// Create the mock file interface and and RigSerervoir and set them up.
|
|
|
|
mockFileInterface->setWorldCoordinates(cvf::Vec3d(10, 10, 10), cvf::Vec3d(20, 20, 20));
|
|
|
|
mockFileInterface->setGridPointDimensions(cvf::Vec3st(4, 5, 6));
|
|
|
|
mockFileInterface->addLocalGridRefinement(cvf::Vec3st(0, 2, 2), cvf::Vec3st(0, 2, 2), cvf::Vec3st(3, 3, 3));
|
|
|
|
mockFileInterface->setResultInfo(3, 10);
|
|
|
|
|
|
|
|
mockFileInterface->open("", reservoir.p());
|
|
|
|
{
|
2015-10-26 04:13:34 -05:00
|
|
|
//size_t idx = reservoir->mainGrid()->cellIndexFromIJK(1, 3, 4);
|
2013-02-25 07:07:59 -06:00
|
|
|
|
|
|
|
//TODO: Rewrite active cell info in mock models
|
|
|
|
//reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2015-10-26 04:13:34 -05:00
|
|
|
//size_t idx = reservoir->mainGrid()->cellIndexFromIJK(2, 2, 3);
|
2013-02-25 07:07:59 -06:00
|
|
|
|
|
|
|
//TODO: Rewrite active cell info in mock models
|
|
|
|
//reservoir->mainGrid()->cell(idx).setActiveIndexInMatrixModel(cvf::UNDEFINED_SIZE_T);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add a property
|
2015-06-25 04:51:59 -05:00
|
|
|
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
|
2012-06-26 09:10:41 -05:00
|
|
|
inputProperty->resultName = "PORO";
|
|
|
|
inputProperty->eclipseKeyword = "PORO";
|
|
|
|
inputProperty->fileName = "PORO.prop";
|
|
|
|
m_inputPropertyCollection->inputProperties.push_back(inputProperty);
|
|
|
|
}
|
|
|
|
|
2013-03-18 08:34:29 -05:00
|
|
|
this->setReservoirData( reservoir.p() );
|
2012-06-26 09:10:41 -05:00
|
|
|
|
|
|
|
return mockFileInterface.p();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-04-06 11:37:43 -05:00
|
|
|
void RimEclipseInputCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
|
|
|
uiOrdering.add(&caseUserDescription);
|
|
|
|
uiOrdering.add(&caseId);
|
|
|
|
uiOrdering.add(&m_gridFileName);
|
2017-06-28 13:10:06 -05:00
|
|
|
uiOrdering.add(&m_additionalFiles);
|
2017-04-06 11:37:43 -05:00
|
|
|
|
|
|
|
auto group = uiOrdering.addNewGroup("Case Options");
|
|
|
|
group->add(&activeFormationNames);
|
2018-08-24 02:34:24 -05:00
|
|
|
group->add(&m_flipXAxis);
|
|
|
|
group->add(&m_flipYAxis);
|
2017-04-06 11:37:43 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-10-10 02:35:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseInputCase::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
|
|
|
{
|
|
|
|
uiTreeOrdering.add(&m_inputPropertyCollection);
|
|
|
|
|
|
|
|
RimEclipseCase::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);
|
|
|
|
}
|
|
|
|
|
2017-04-06 11:37:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
QString RimEclipseInputCase::locationOnDisc() const
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
|
|
|
if (m_gridFileName().isEmpty()) return QString();
|
|
|
|
|
|
|
|
QFileInfo fi(m_gridFileName);
|
|
|
|
return fi.absolutePath();
|
|
|
|
}
|
2013-04-08 02:57:40 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-25 04:50:13 -05:00
|
|
|
void RimEclipseInputCase::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
2013-04-08 02:57:40 -05:00
|
|
|
{
|
2013-04-12 01:31:59 -05:00
|
|
|
bool foundFile = false;
|
|
|
|
std::vector<QString> searchedPaths;
|
2013-04-08 02:57:40 -05:00
|
|
|
|
2016-06-29 08:45:20 -05:00
|
|
|
m_gridFileName = RimTools::relocateFile(m_gridFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
2013-04-08 02:57:40 -05:00
|
|
|
|
2017-06-28 13:10:06 -05:00
|
|
|
for (RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties())
|
|
|
|
{
|
|
|
|
inputProperty->fileName = RimTools::relocateFile(inputProperty->fileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimEclipseInputCase::updateAdditionalFileFolder(const QString& newFolder)
|
|
|
|
{
|
|
|
|
QDir newDir(newFolder);
|
|
|
|
for (RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties())
|
|
|
|
{
|
|
|
|
if (inputProperty->fileName == m_gridFileName) continue;
|
|
|
|
QFileInfo oldFilePath(inputProperty->fileName);
|
|
|
|
QFileInfo newFilePath(newDir, oldFilePath.fileName());
|
|
|
|
inputProperty->fileName = newFilePath.absoluteFilePath();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<QString> RimEclipseInputCase::additionalFiles() const
|
|
|
|
{
|
|
|
|
std::vector<QString> additionalFiles;
|
|
|
|
for (const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties())
|
2013-04-08 02:57:40 -05:00
|
|
|
{
|
2017-06-28 13:10:06 -05:00
|
|
|
if (inputProperty->fileName == m_gridFileName) continue;
|
|
|
|
additionalFiles.push_back(inputProperty->fileName);
|
2013-04-08 02:57:40 -05:00
|
|
|
}
|
2017-06-28 13:10:06 -05:00
|
|
|
return additionalFiles;
|
2013-04-08 02:57:40 -05:00
|
|
|
}
|