Skip to content

Commit

Permalink
Merge pull request #259 from OPM/dev
Browse files Browse the repository at this point in the history
Updated to 1.3.1
  • Loading branch information
magnesj committed Nov 7, 2014
2 parents ef05bc5 + 0f88443 commit a32e623
Show file tree
Hide file tree
Showing 1,254 changed files with 54,937 additions and 14,704 deletions.
12 changes: 11 additions & 1 deletion ApplicationCode/Application/RiaApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,11 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas

// Select SOIL as default result variable
riv->cellResult()->setResultType(RimDefines::DYNAMIC_NATIVE);
riv->cellResult()->setResultVariable("SOIL");

if (m_preferences->loadAndShowSoil)
{
riv->cellResult()->setResultVariable("SOIL");
}
riv->animationMode = true;

riv->loadDataAndUpdate();
Expand Down Expand Up @@ -1788,6 +1792,12 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
info.setProgress(i);
}

if (gridCaseGroup)
{
// Create placeholder results and propagate results info from main case to all other cases
gridCaseGroup->loadMainCaseAndActiveCellInfo();
}

RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();

uiModel->updateUiSubTree( m_project->activeOilField()->analysisModels());
Expand Down
18 changes: 9 additions & 9 deletions ApplicationCode/Application/RiaPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.setUiHidden(true);

CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
CAF_PDM_InitField(&autocomputeGridFaults, "autocomputeGridFaults", true, "Grid faults", "", "Detect all fault faces geometrically", "");

CAF_PDM_InitField(&autocomputeDepthRelatedProperties, "autocomputeDepth", true, "Compute DEPTH related properties", "", "DEPTH, DX, DY, DZ, TOP, BOTTOM", "");
autocomputeDepthRelatedProperties.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
autocomputeGridFaults.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);

CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and show SOIL", "", "", "");
loadAndShowSoil.setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);

readerSettings = new RifReaderSettings;
CAF_PDM_InitFieldNoDefault(&readerSettings, "readerSettings", "Reader settings", "", "", "");
Expand Down Expand Up @@ -99,8 +99,8 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
}
}
else if (field == &octaveShowHeaderInfoWhenExecutingScripts ||
field == &autocomputeDepthRelatedProperties ||
field == &autocomputeGridFaults)
field == &autocomputeDepthRelatedProperties ||
field == &loadAndShowSoil )
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = static_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)
Expand Down Expand Up @@ -133,10 +133,9 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
defaultSettingsGroup->add(&defaultFaultGridLineColors);
defaultSettingsGroup->add(&defaultWellLabelColor);

caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Compute when loading new case");
caf::PdmUiGroup* autoComputeGroup = uiOrdering.addNewGroup("Behavior when loading new case");
autoComputeGroup->add(&autocomputeDepthRelatedProperties);
autoComputeGroup->add(&autocomputeGridFaults);

autoComputeGroup->add(&loadAndShowSoil);

caf::PdmUiGroup* readerSettingsGroup = uiOrdering.addNewGroup("Reader settings");
std::vector<caf::PdmFieldHandle*> readerSettingsFields;
Expand All @@ -157,6 +156,7 @@ void RiaPreferences::configureForRegressionTests()
showHud = false;

autocomputeDepthRelatedProperties = true;
loadAndShowSoil = true;

CVF_ASSERT(readerSettings);
readerSettings->importFaults = false;
Expand Down
2 changes: 1 addition & 1 deletion ApplicationCode/Application/RiaPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RiaPreferences : public caf::PdmObject
caf::PdmField<QString> lastUsedProjectFileName;

caf::PdmField<bool> autocomputeDepthRelatedProperties;
caf::PdmField<bool> autocomputeGridFaults;
caf::PdmField<bool> loadAndShowSoil;

caf::PdmField<RifReaderSettings*> readerSettings;

Expand Down
41 changes: 23 additions & 18 deletions ApplicationCode/FileInterface/FileInterface_UnitTests/Ert-Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ TEST(RigReservoirTest, WellTestErt)
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
Expand Down Expand Up @@ -149,10 +151,12 @@ 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/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 = "c:/tmp/TestModels/TEST_RKMFAULTS/msj_faults.txt";
QString outFilename = "d:/tmp/msj_faults.txt";
QFile outputFile(outFilename);
{
if (!outputFile.open(QIODevice::WriteOnly))
Expand All @@ -165,7 +169,8 @@ TEST(RigReservoirTest, ReadFaultsRecursively)

cvf::Collection<RigFault> faults;

RifEclipseInputFileTools::readFaultsInGridSection(filename, faults);
std::vector<QString> filenamesWithFaults;
RifEclipseInputFileTools::readFaultsInGridSection(filename, faults, filenamesWithFaults);

// EXPECT_EQ(4, faults.size());

Expand All @@ -178,21 +183,21 @@ TEST(RigReservoirTest, ReadFaultsRecursively)
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");
}
// 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");
// }
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,12 +850,12 @@ bool RifEclipseInputFileTools::readFaultsAndParseIncludeStatementsRecursively(QF

cvf::StructGridInterface::FaceEnum RifEclipseInputFileTools::faceEnumFromText(const QString& faceString)
{
if (faceString == "X" ) return cvf::StructGridInterface::POS_I;
if (faceString == "X-") return cvf::StructGridInterface::NEG_I;
if (faceString == "Y" ) return cvf::StructGridInterface::POS_J;
if (faceString == "Y-") return cvf::StructGridInterface::NEG_J;
if (faceString == "Z" ) return cvf::StructGridInterface::POS_K;
if (faceString == "Z-") return cvf::StructGridInterface::NEG_K;
if (faceString == "X" || faceString == "I" ) return cvf::StructGridInterface::POS_I;
if (faceString == "X-" || faceString == "I-") return cvf::StructGridInterface::NEG_I;
if (faceString == "Y" || faceString == "J" ) return cvf::StructGridInterface::POS_J;
if (faceString == "Y-" || faceString == "J-") return cvf::StructGridInterface::NEG_J;
if (faceString == "Z" || faceString == "K" ) return cvf::StructGridInterface::POS_K;
if (faceString == "Z-" || faceString == "K-") return cvf::StructGridInterface::NEG_K;

return cvf::StructGridInterface::NO_FACE;
}
Expand Down Expand Up @@ -906,14 +906,16 @@ void RifEclipseInputFileTools::readFaults(QFile &data, qint64 filePos, cvf::Coll
// Replace tab with space to be able to split the string using space as splitter
line.replace("\t", " ");

// Replace character ' used to mark start and end of fault name
line.remove("'");

QStringList entries = line.split(" ", QString::SkipEmptyParts);
if (entries.size() < 8)
{
continue;
}

QString name = entries[0];
name.remove("'");

int i1, i2, j1, j2, k1, k2;
i1 = entries[1].toInt();
Expand All @@ -924,7 +926,6 @@ void RifEclipseInputFileTools::readFaults(QFile &data, qint64 filePos, cvf::Coll
k2 = entries[6].toInt();

QString faceString = entries[7];
faceString.remove("'");

cvf::StructGridInterface::FaceEnum cellFaceEnum = RifEclipseInputFileTools::faceEnumFromText(faceString);

Expand Down
35 changes: 29 additions & 6 deletions ApplicationCode/FileInterface/RifEclipseOutputFileTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@
#include "ecl_grid.h"
#include "ecl_rsthead.h"

#include "cafProgressInfo.h"

#include <QFileInfo>
#include <QDebug>
#include "cafProgressInfo.h"

#include <assert.h>


//--------------------------------------------------------------------------------------------------
Expand All @@ -46,6 +49,16 @@ RifEclipseOutputFileTools::~RifEclipseOutputFileTools()
{
}

void getDayMonthYear(const ecl_kw_type* intehead_kw, int* day, int* month, int* year)
{
assert(day && month && year);

*day = ecl_kw_iget_int(intehead_kw, INTEHEAD_DAY_INDEX);
*month = ecl_kw_iget_int(intehead_kw, INTEHEAD_MONTH_INDEX);
*year = ecl_kw_iget_int(intehead_kw, INTEHEAD_YEAR_INDEX);
}


//--------------------------------------------------------------------------------------------------
/// Get list of time step texts (dates)
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -94,9 +107,12 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, 0);
if (kwINTEHEAD)
{
time_t ertTimeStamp = ecl_rsthead_date(kwINTEHEAD);
QDateTime simulationStart = QDateTime::fromTime_t(ertTimeStamp);

int day = 0;
int month = 0;
int year = 0;
getDayMonthYear(kwINTEHEAD, &day, &month, &year);

QDateTime simulationStart(QDate(year, month, day));
for (int i = 0; i < days.size(); i++)
{
QDateTime reportDateTime(simulationStart);
Expand Down Expand Up @@ -127,8 +143,15 @@ void RifEclipseOutputFileTools::timeSteps(ecl_file_type* ecl_file, std::vector<Q
ecl_kw_type* kwINTEHEAD = ecl_file_iget_named_kw(ecl_file, INTEHEAD_KW, i);
if (kwINTEHEAD)
{
time_t ertTimeStamp = ecl_rsthead_date(kwINTEHEAD);
QDateTime reportDateTime = QDateTime::fromTime_t(ertTimeStamp);
int day = 0;
int month = 0;
int year = 0;
getDayMonthYear(kwINTEHEAD, &day, &month, &year);

QDateTime reportDateTime(QDate(year, month, day));
QTime time(0, 0);
reportDateTime.setTime(time);

CVF_ASSERT(reportDateTime.isValid());

if (std::find(timeStepsFound.begin(), timeStepsFound.end(), reportDateTime) == timeStepsFound.end())
Expand Down
3 changes: 2 additions & 1 deletion ApplicationCode/FileInterface/RifEclipseRestartDataAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ class RifEclipseRestartDataAccess : public cvf::Object
virtual void setTimeSteps(const std::vector<QDateTime>& timeSteps) {};
virtual size_t timeStepCount() = 0;
virtual std::vector<QDateTime> timeSteps() = 0;
virtual std::vector<int> reportNumbers() = 0;

virtual void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts) = 0;
virtual bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values) = 0;

virtual void readWellData(well_info_type * well_info) = 0;
virtual void readWellData(well_info_type * well_info, bool importCompleteMswData) = 0;
virtual int readUnitsType() = 0;
};
24 changes: 22 additions & 2 deletions ApplicationCode/FileInterface/RifEclipseRestartFilesetAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info)
void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info, bool importCompleteMswData)
{
if (!well_info) return;

Expand All @@ -221,7 +221,7 @@ void RifEclipseRestartFilesetAccess::readWellData(well_info_type* well_info)
int reportNumber = ecl_util_filename_report_nr(fileName);
if(reportNumber != -1)
{
well_info_add_wells(well_info, m_ecl_files[i], reportNumber);
well_info_add_wells(well_info, m_ecl_files[i], reportNumber, importCompleteMswData);
}
}
}
Expand Down Expand Up @@ -258,3 +258,23 @@ int RifEclipseRestartFilesetAccess::readUnitsType()
return RifEclipseOutputFileTools::readUnitsType(ecl_file);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<int> RifEclipseRestartFilesetAccess::reportNumbers()
{
std::vector<int> reportNr;

for (size_t i = 0; i < m_ecl_files.size(); i++)
{
const char* fileName = ecl_file_get_src_file(m_ecl_files[i]);
int reportNumber = ecl_util_filename_report_nr(fileName);
if (reportNumber != -1)
{
reportNr.push_back(reportNumber);
}
}

return reportNr;
}

Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ class RifEclipseRestartFilesetAccess : public RifEclipseRestartDataAccess
void setTimeSteps(const std::vector<QDateTime>& timeSteps);
size_t timeStepCount();
std::vector<QDateTime> timeSteps();
std::vector<int> reportNumbers();

void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
bool results(const QString& resultName, size_t timeStep, size_t gridCount, std::vector<double>* values);

virtual void readWellData(well_info_type* well_info);
virtual void readWellData(well_info_type* well_info, bool importCompleteMswData);
virtual int readUnitsType();

private:
void openTimeStep(size_t timeStep);


private:
QStringList m_fileNames;
std::vector<QDateTime> m_timeSteps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "RifEclipseUnifiedRestartFileAccess.h"
#include "RifEclipseOutputFileTools.h"

#include "ecl_kw_magic.h"
#include <well_state.h>
#include <well_info.h>
#include <well_conn.h>
Expand Down Expand Up @@ -146,13 +147,13 @@ bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseUnifiedRestartFileAccess::readWellData(well_info_type* well_info)
void RifEclipseUnifiedRestartFileAccess::readWellData(well_info_type* well_info, bool importCompleteMswData)
{
if (!well_info) return;

if (openFile())
{
well_info_add_UNRST_wells(well_info, m_ecl_file);
well_info_add_UNRST_wells(well_info, m_ecl_file, importCompleteMswData);
}
}

Expand All @@ -175,3 +176,31 @@ int RifEclipseUnifiedRestartFileAccess::readUnitsType()
return RifEclipseOutputFileTools::readUnitsType(m_ecl_file);
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<int> RifEclipseUnifiedRestartFileAccess::reportNumbers()
{
std::vector<int> reportNr;

// Taken from well_info_add_UNRST_wells

int num_blocks = ecl_file_get_num_named_kw(m_ecl_file, SEQNUM_KW);
int block_nr;
for (block_nr = 0; block_nr < num_blocks; block_nr++) {
ecl_file_push_block(m_ecl_file); // <-------------------------------------------------------
{ //
ecl_file_subselect_block(m_ecl_file, SEQNUM_KW, block_nr); // Ensure that the status
{ // is not changed as a side
const ecl_kw_type * seqnum_kw = ecl_file_iget_named_kw(m_ecl_file, SEQNUM_KW, 0); // effect.
int report_nr = ecl_kw_iget_int(seqnum_kw, 0); //

reportNr.push_back(report_nr);
} //
} //
ecl_file_pop_block(m_ecl_file); // <-------------------------------------------------------
}

return reportNr;
}

Loading

0 comments on commit a32e623

Please sign in to comment.