Merged in changes from maintenance branch

This commit is contained in:
Magne Sjaastad 2016-08-04 11:12:53 +02:00
commit 4bfef4ead0
49 changed files with 849 additions and 196 deletions

View File

@ -1178,6 +1178,9 @@ bool RiaApplication::parseArguments()
QString gridListFile = cvfqt::Utils::toQString(o.safeValue(0)); QString gridListFile = cvfqt::Utils::toQString(o.safeValue(0));
std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile); std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile);
runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots"); runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
closeProject(false);
return false; return false;
} }
} }
@ -1262,6 +1265,8 @@ bool RiaApplication::parseArguments()
saveSnapshotForAllViews("snapshots"); saveSnapshotForAllViews("snapshots");
mainWnd->loadWinGeoAndDockToolBarLayout(); mainWnd->loadWinGeoAndDockToolBarLayout();
closeProject(false);
} }
// Returning false will exit the application // Returning false will exit the application

View File

@ -12,6 +12,7 @@ ${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.h
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.h ${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.h
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.h ${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.h
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.h ${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicRefreshScriptsFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@ -22,6 +23,7 @@ ${CEE_CURRENT_LIST_DIR}RicExecuteScriptFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.cpp ${CEE_CURRENT_LIST_DIR}RicExecuteScriptForCasesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.cpp ${CEE_CURRENT_LIST_DIR}RicNewScriptFeature.cpp
${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.cpp ${CEE_CURRENT_LIST_DIR}RicScriptFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicRefreshScriptsFeature.cpp
) )
set (QT_MOC_HEADERS set (QT_MOC_HEADERS

View File

@ -19,11 +19,13 @@
#include "RicAddScriptPathFeature.h" #include "RicAddScriptPathFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RicRefreshScriptsFeature.h"
#include "RicScriptFeatureImpl.h" #include "RicScriptFeatureImpl.h"
#include "RimScriptCollection.h" #include "RimScriptCollection.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "cvfAssert.h" #include "cvfAssert.h"
@ -62,6 +64,8 @@ void RicAddScriptPathFeature::onActionTriggered(bool isChecked)
RiaApplication::instance()->preferences()->scriptDirectories = filePathString; RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
RiaApplication::instance()->applyPreferences(); RiaApplication::instance()->applyPreferences();
RicRefreshScriptsFeature::refreshScriptFolders();
} }
} }

View File

@ -19,11 +19,13 @@
#include "RicDeleteScriptPathFeature.h" #include "RicDeleteScriptPathFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RicRefreshScriptsFeature.h"
#include "RicScriptFeatureImpl.h" #include "RicScriptFeatureImpl.h"
#include "RimScriptCollection.h" #include "RimScriptCollection.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "cvfAssert.h" #include "cvfAssert.h"
@ -69,6 +71,8 @@ void RicDeleteScriptPathFeature::onActionTriggered(bool isChecked)
RiaApplication::instance()->preferences()->scriptDirectories = filePathString; RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
RiaApplication::instance()->applyPreferences(); RiaApplication::instance()->applyPreferences();
RicRefreshScriptsFeature::refreshScriptFolders();
} }
} }

View File

@ -19,16 +19,20 @@
#include "RicNewScriptFeature.h" #include "RicNewScriptFeature.h"
#include "RiaApplication.h"
#include "RicRefreshScriptsFeature.h"
#include "RicScriptFeatureImpl.h" #include "RicScriptFeatureImpl.h"
#include "RimCalcScript.h" #include "RimCalcScript.h"
#include "RimScriptCollection.h" #include "RimScriptCollection.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include <QAction> #include <QAction>
#include <QFileInfo> #include <QFileInfo>
#include <QInputDialog>
#include <QLineEdit>
#include <QMessageBox> #include <QMessageBox>
CAF_CMD_SOURCE_INIT(RicNewScriptFeature, "RicNewScriptFeature"); CAF_CMD_SOURCE_INIT(RicNewScriptFeature, "RicNewScriptFeature");
@ -38,8 +42,7 @@ CAF_CMD_SOURCE_INIT(RicNewScriptFeature, "RicNewScriptFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewScriptFeature::isCommandEnabled() bool RicNewScriptFeature::isCommandEnabled()
{ {
std::vector<RimCalcScript*> selection = RicScriptFeatureImpl::selectedScripts(); return true;
return selection.size() > 0;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -55,7 +58,7 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
QString fullPathNewScript; QString fullPathNewScript;
if (calcScript ) if (calcScript)
{ {
QFileInfo existingScriptFileInfo(calcScript->absolutePath()); QFileInfo existingScriptFileInfo(calcScript->absolutePath());
fullPathNewScript = existingScriptFileInfo.absolutePath(); fullPathNewScript = existingScriptFileInfo.absolutePath();
@ -79,19 +82,40 @@ void RicNewScriptFeature::onActionTriggered(bool isChecked)
num++; num++;
} }
RiaApplication* app = RiaApplication::instance(); bool ok;
QString scriptEditor = app->scriptEditorPath(); fullPathFilenameNewScript = QInputDialog::getText(NULL, "Specify new script file", "File name", QLineEdit::Normal, fullPathFilenameNewScript, &ok);
if (!scriptEditor.isEmpty())
if (ok && !fullPathFilenameNewScript.isEmpty())
{ {
QStringList arguments; QFile file(fullPathFilenameNewScript);
arguments << fullPathFilenameNewScript; if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
QProcess* myProcess = new QProcess(this);
myProcess->start(scriptEditor, arguments);
if (!myProcess->waitForStarted(1000))
{ {
QMessageBox::warning(RiuMainWindow::instance(), "Script editor", "Failed to start script editor executable\n" + scriptEditor); QMessageBox::warning(RiuMainWindow::instance(), "Script editor", "Failed to create file\n" + fullPathFilenameNewScript);
return;
}
RicRefreshScriptsFeature::refreshScriptFolders();
if (calcScript)
{
RiuMainWindow::instance()->selectAsCurrentItem(calcScript);
}
RiaApplication* app = RiaApplication::instance();
QString scriptEditor = app->scriptEditorPath();
if (!scriptEditor.isEmpty())
{
QStringList arguments;
arguments << fullPathFilenameNewScript;
QProcess* myProcess = new QProcess(this);
myProcess->start(scriptEditor, arguments);
if (!myProcess->waitForStarted(1000))
{
QMessageBox::warning(RiuMainWindow::instance(), "Script editor", "Failed to start script editor executable\n" + scriptEditor);
}
} }
} }
} }

View File

@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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 "RicRefreshScriptsFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimProject.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicRefreshScriptsFeature, "RicRefreshScriptsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRefreshScriptsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRefreshScriptsFeature::onActionTriggered(bool isChecked)
{
refreshScriptFolders();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRefreshScriptsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Refresh");
actionToSetup->setIcon(QIcon(":/Refresh-32.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRefreshScriptsFeature::refreshScriptFolders()
{
RimProject* proj = RiaApplication::instance()->project();
RiaPreferences* prefs = RiaApplication::instance()->preferences();
proj->setScriptDirectories(prefs->scriptDirectories());
proj->updateConnectedEditors();
}

View File

@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
#include <vector>
//==================================================================================================
///
//==================================================================================================
class RicRefreshScriptsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void refreshScriptFolders();
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
};

View File

@ -67,11 +67,15 @@ void RicCloseCaseFeature::onActionTriggered(bool isChecked)
if (userConfirmedGridCaseGroupChange(casesToBeDeleted)) if (userConfirmedGridCaseGroupChange(casesToBeDeleted))
{ {
deleteEclipseCase(eclipseCase); deleteEclipseCase(eclipseCase);
RiuMainWindow::instance()->cleanupGuiCaseClose();
} }
} }
else if (geoMechCase) else if (geoMechCase)
{ {
deleteGeoMechCase(geoMechCase); deleteGeoMechCase(geoMechCase);
RiuMainWindow::instance()->cleanupGuiCaseClose();
} }
} }

View File

@ -47,6 +47,59 @@ RifEclipseOutputFileTools::~RifEclipseOutputFileTools()
{ {
} }
struct KeywordItemCounter
{
KeywordItemCounter(std::string keyword, size_t aggregatedItemCount)
: m_keyword(keyword),
m_aggregatedItemCount(aggregatedItemCount),
m_reportStepCount(1)
{}
bool operator==(const std::string& rhs) const
{
return this->m_keyword == rhs;
}
std::string m_keyword;
size_t m_aggregatedItemCount;
size_t m_reportStepCount;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputFileTools::findKeywordsAndItemCount(std::vector<ecl_file_type*> ecl_files, QStringList* resultNames, std::vector<size_t>* resultDataItemCounts)
{
std::vector<RifRestartReportStep> reportSteps;
RifEclipseOutputFileTools::createReportStepsMetaData(ecl_files, &reportSteps);
std::vector<KeywordItemCounter> foundKeywords;
for (auto reportStep : reportSteps)
{
for (auto keywordItemCount : reportStep.m_keywords.keywordsWithAggregatedItemCount())
{
auto it = std::find(foundKeywords.begin(), foundKeywords.end(), keywordItemCount.first);
if (it == foundKeywords.end())
{
foundKeywords.push_back(KeywordItemCounter(keywordItemCount.first, keywordItemCount.second));
}
else
{
it->m_aggregatedItemCount += keywordItemCount.second;
it->m_reportStepCount++;
}
}
}
for (auto stdKeyword : foundKeywords)
{
resultNames->push_back(QString::fromStdString(stdKeyword.m_keyword));
resultDataItemCounts->push_back(stdKeyword.m_aggregatedItemCount);
}
}
void getDayMonthYear(const ecl_kw_type* intehead_kw, int* day, int* month, int* year) void getDayMonthYear(const ecl_kw_type* intehead_kw, int* day, int* month, int* year)
{ {
assert(day && month && year); assert(day && month && year);
@ -230,45 +283,6 @@ bool RifEclipseOutputFileTools::findSiblingFilesWithSameBaseName(const QString&
return baseNameFiles->count() > 0; return baseNameFiles->count() > 0;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file_type* ecl_file, QStringList* keywords, std::vector<size_t>* keywordDataItemCounts)
{
if (!ecl_file || !keywords || !keywordDataItemCounts) return;
int numKeywords = ecl_file_get_num_distinct_kw(ecl_file);
caf::ProgressInfo info(numKeywords, "Reading Keywords on file");
for (int i = 0; i < numKeywords; i++)
{
const char* kw = ecl_file_iget_distinct_kw(ecl_file , i);
int numKeywordOccurrences = ecl_file_get_num_named_kw(ecl_file, kw);
bool validData = true;
size_t fileResultValueCount = 0;
for (int j = 0; j < numKeywordOccurrences; j++)
{
fileResultValueCount += ecl_file_iget_named_size(ecl_file, kw, j);
ecl_type_enum dataType = ecl_file_iget_named_type(ecl_file, kw, j);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE )
{
validData = false;
break;
}
}
if (validData)
{
keywords->append(QString(kw));
keywordDataItemCounts->push_back(fileResultValueCount);
}
info.setProgress(i);
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -321,3 +335,66 @@ int RifEclipseOutputFileTools::readUnitsType(ecl_file_type* ecl_file)
return unitsType; return unitsType;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseOutputFileTools::createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps)
{
if (!reportSteps) return;
for (auto ecl_file : ecl_files)
{
if (!ecl_file) continue;
int reportStepCount = ecl_file_get_num_named_kw(ecl_file, INTEHEAD_KW);
for (int reportStepIndex = 0; reportStepIndex < reportStepCount; reportStepIndex++)
{
ecl_rsthead_type* restart_header = ecl_rsthead_ialloc(ecl_file, reportStepIndex);
if (restart_header)
{
ecl_file_push_block(ecl_file);
{
ecl_file_select_block(ecl_file, INTEHEAD_KW, reportStepIndex);
RifRestartReportStep reportStep;
// Set Date
{
QDateTime reportDateTime(QDate(restart_header->year, restart_header->month, restart_header->day));
CVF_ASSERT(reportDateTime.isValid());
reportStep.dateTime = reportDateTime;
}
// Find number of keywords withing this report step
int numKeywords = ecl_file_get_num_distinct_kw(ecl_file);
for (int iKey = 0; iKey < numKeywords; iKey++)
{
const char* kw = ecl_file_iget_distinct_kw(ecl_file, iKey);
int namedKeywordCount = ecl_file_get_num_named_kw(ecl_file, kw);
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
{
ecl_type_enum dataType = ecl_file_iget_named_type(ecl_file, kw, iOcc);
if (dataType != ECL_DOUBLE_TYPE && dataType != ECL_FLOAT_TYPE && dataType != ECL_INT_TYPE)
{
continue;
}
int itemCount = ecl_file_iget_named_size(ecl_file, kw, iOcc);
reportStep.m_keywords.appendKeyword(kw, itemCount, iOcc);
}
}
reportSteps->push_back(reportStep);
}
ecl_file_pop_block(ecl_file);
ecl_rsthead_free(restart_header);
}
}
}
}

View File

@ -24,10 +24,12 @@
#include "cvfObject.h" #include "cvfObject.h"
#include "cvfLibCore.h" #include "cvfLibCore.h"
#include "RifReaderInterface.h"
#include "RifEclipseRestartDataAccess.h"
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QDateTime> #include <QDateTime>
#include "RifReaderInterface.h"
#include "ert/ecl/ecl_util.h" #include "ert/ecl/ecl_util.h"
@ -45,7 +47,8 @@ public:
RifEclipseOutputFileTools(); RifEclipseOutputFileTools();
virtual ~RifEclipseOutputFileTools(); virtual ~RifEclipseOutputFileTools();
static void findKeywordsAndDataItemCounts(ecl_file_type* ecl_file, QStringList* keywords, std::vector<size_t>* keywordDataItemCounts); static void findKeywordsAndItemCount(std::vector<ecl_file_type*> ecl_files, QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values); static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<double>* values);
static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values); static bool keywordData(ecl_file_type* ecl_file, const QString& keyword, size_t fileKeywordOccurrence, std::vector<int>* values);
@ -59,4 +62,7 @@ public:
static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions); static void readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions);
static int readUnitsType(ecl_file_type* ecl_file); static int readUnitsType(ecl_file_type* ecl_file);
private:
static void createReportStepsMetaData(std::vector<ecl_file_type*> ecl_files, std::vector<RifRestartReportStep>* reportSteps);
}; };

View File

@ -33,3 +33,106 @@ RifEclipseRestartDataAccess::RifEclipseRestartDataAccess()
RifEclipseRestartDataAccess::~RifEclipseRestartDataAccess() RifEclipseRestartDataAccess::~RifEclipseRestartDataAccess()
{ {
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifRestartReportKeywords::RifRestartReportKeywords()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifRestartReportKeywords::appendKeyword(const std::string& keyword, size_t itemCount, int globalIndex)
{
m_keywordNameAndItemCount.push_back(RifKeywordLocation(keyword, itemCount, globalIndex));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RifRestartReportKeywords::keywordsWithItemCountFactorOf(const std::vector<size_t>& factorCandidates)
{
std::vector<std::string> tmp;
for (auto uni : uniqueKeywords())
{
size_t sum = 0;
for (auto loc : objectsForKeyword(uni))
{
sum += loc.itemCount();
}
bool foundMatch = false;
size_t i = 0;
while (i < factorCandidates.size() && !foundMatch)
{
if (sum > 0 && (sum % factorCandidates[i]) == 0)
{
foundMatch = true;
tmp.push_back(uni);
}
i++;
}
}
return tmp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<std::string, size_t> > RifRestartReportKeywords::keywordsWithAggregatedItemCount()
{
std::vector<std::pair<std::string, size_t> > tmp;
for (auto uni : uniqueKeywords())
{
size_t sum = 0;
for (auto loc : objectsForKeyword(uni))
{
sum += loc.itemCount();
}
tmp.push_back(std::make_pair(uni, sum));
}
return tmp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RifKeywordLocation> RifRestartReportKeywords::objectsForKeyword(const std::string& keyword)
{
std::vector<RifKeywordLocation> tmp;
for (auto a : m_keywordNameAndItemCount)
{
if (a.keyword() == keyword)
{
tmp.push_back(a);
}
}
return tmp;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<std::string> RifRestartReportKeywords::uniqueKeywords()
{
std::set<std::string> unique;
for (auto a : m_keywordNameAndItemCount)
{
unique.insert(a.keyword());
}
return unique;
}

View File

@ -33,6 +33,55 @@
#include "RifReaderInterface.h" #include "RifReaderInterface.h"
class RifKeywordLocation
{
public:
RifKeywordLocation(std::string keyword, size_t itemCount, int indexWithinReportStep)
: m_keyword(keyword),
m_itemCount(itemCount),
m_indexWithinReportStep(indexWithinReportStep)
{
}
std::string keyword() const { return m_keyword; }
size_t itemCount() const { return m_itemCount; }
int indexWithinReportStep() const { return m_indexWithinReportStep; }
private:
std::string m_keyword;
size_t m_itemCount;
int m_indexWithinReportStep;
};
class RifRestartReportKeywords
{
public:
RifRestartReportKeywords();
void appendKeyword(const std::string& keyword, size_t itemCount, int globalIndex);
std::vector<std::string> keywordsWithItemCountFactorOf(const std::vector<size_t>& factorCandidates);
std::vector<std::pair<std::string, size_t> > keywordsWithAggregatedItemCount();
private:
std::vector<RifKeywordLocation> objectsForKeyword(const std::string& keyword);
std::set<std::string> uniqueKeywords();
private:
std::vector<RifKeywordLocation> m_keywordNameAndItemCount;
};
class RifRestartReportStep
{
public:
//int globalIndex;
QDateTime dateTime;
RifRestartReportKeywords m_keywords;
};
//================================================================================================== //==================================================================================================
// //
// Abstract class for results access // Abstract class for results access

View File

@ -155,15 +155,12 @@ void RifEclipseRestartFilesetAccess::resultNames(QStringList* resultNames, std::
{ {
CVF_ASSERT(timeStepCount() > 0); CVF_ASSERT(timeStepCount() > 0);
openTimeStep(0); for (int i = 0; i < m_fileNames.size(); i++)
std::vector<size_t> valueCountForOneFile;
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_files[0], resultNames, &valueCountForOneFile);
for (size_t i = 0; i < valueCountForOneFile.size(); i++)
{ {
resultDataItemCounts->push_back(valueCountForOneFile[i] * timeStepCount()); openTimeStep(i);
} }
RifEclipseOutputFileTools::findKeywordsAndItemCount(m_ecl_files, resultNames, resultDataItemCounts);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -205,7 +202,6 @@ bool RifEclipseRestartFilesetAccess::results(const QString& resultName, size_t t
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -43,7 +43,7 @@ public:
void setTimeSteps(const std::vector<QDateTime>& timeSteps); void setTimeSteps(const std::vector<QDateTime>& timeSteps);
size_t timeStepCount(); size_t timeStepCount();
std::vector<QDateTime> timeSteps(); std::vector<QDateTime> timeSteps();
std::vector<int> reportNumbers(); std::vector<int> reportNumbers();
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts); void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
@ -55,10 +55,9 @@ public:
private: private:
void openTimeStep(size_t timeStep); void openTimeStep(size_t timeStep);
private: private:
QStringList m_fileNames; QStringList m_fileNames;
std::vector<QDateTime> m_timeSteps; std::vector<QDateTime> m_timeSteps;
std::vector< ecl_file_type* > m_ecl_files; std::vector< ecl_file_type* > m_ecl_files;
}; };

View File

@ -24,6 +24,8 @@
#include "ert/ecl/ecl_file.h" #include "ert/ecl/ecl_file.h"
#include "ert/ecl/ecl_kw_magic.h" #include "ert/ecl/ecl_kw_magic.h"
#include <QDebug>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Constructor /// Constructor
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -102,6 +104,7 @@ std::vector<QDateTime> RifEclipseUnifiedRestartFileAccess::timeSteps()
return timeSteps; return timeSteps;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Get list of result names /// Get list of result names
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -109,7 +112,10 @@ void RifEclipseUnifiedRestartFileAccess::resultNames(QStringList* resultNames, s
{ {
if (openFile()) if (openFile())
{ {
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_file, resultNames, resultDataItemCounts); std::vector< ecl_file_type* > filesUsedToFindAvailableKeywords;
filesUsedToFindAvailableKeywords.push_back(m_ecl_file);
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, resultNames, resultDataItemCounts);
} }
} }
@ -123,24 +129,27 @@ bool RifEclipseUnifiedRestartFileAccess::results(const QString& resultName, size
return false; return false;
} }
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_file, resultName.toAscii().data()); ecl_file_push_block(m_ecl_file);
size_t startIndex = timeStep * gridCount; for (size_t i = 0; i < gridCount; i++)
CVF_ASSERT(startIndex + gridCount <= numOccurrences);
size_t occurrenceIdx;
for (occurrenceIdx = startIndex; occurrenceIdx < startIndex + gridCount; occurrenceIdx++)
{ {
std::vector<double> partValues; ecl_file_select_block(m_ecl_file, INTEHEAD_KW, static_cast<int>(timeStep * gridCount + i));
RifEclipseOutputFileTools::keywordData(m_ecl_file, resultName, occurrenceIdx, &partValues);
values->insert(values->end(), partValues.begin(), partValues.end()); int namedKeywordCount = ecl_file_get_num_named_kw(m_ecl_file, resultName.toAscii().data());
for (int iOcc = 0; iOcc < namedKeywordCount; iOcc++)
{
std::vector<double> partValues;
RifEclipseOutputFileTools::keywordData(m_ecl_file, resultName, iOcc, &partValues);
values->insert(values->end(), partValues.begin(), partValues.end());
}
} }
ecl_file_pop_block(m_ecl_file);
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -28,6 +28,8 @@ class RifEclipseOutputFileTools;
#include "ert/ecl_well/well_info.h" #include "ert/ecl_well/well_info.h"
//================================================================================================== //==================================================================================================
// //
// Class for access to results from a unified restart file // Class for access to results from a unified restart file
@ -44,7 +46,7 @@ public:
void close(); void close();
size_t timeStepCount(); size_t timeStepCount();
std::vector<QDateTime> timeSteps(); std::vector<QDateTime> timeSteps();
std::vector<int> reportNumbers(); std::vector<int> reportNumbers();
void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts); void resultNames(QStringList* resultNames, std::vector<size_t>* resultDataItemCounts);
@ -56,7 +58,6 @@ public:
private: private:
bool openFile(); bool openFile();
private: private:
QString m_filename; QString m_filename;
ecl_file_type* m_ecl_file; ecl_file_type* m_ecl_file;

View File

@ -683,7 +683,10 @@ void RifReaderEclipseOutput::buildMetaData()
{ {
QStringList resultNames; QStringList resultNames;
std::vector<size_t> resultNamesDataItemCounts; std::vector<size_t> resultNamesDataItemCounts;
RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(m_ecl_init_file, &resultNames, &resultNamesDataItemCounts); std::vector< ecl_file_type* > filesUsedToFindAvailableKeywords;
filesUsedToFindAvailableKeywords.push_back(m_ecl_init_file);
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts);
{ {
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts, QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
@ -1565,7 +1568,7 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts, QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringList& keywords, const std::vector<size_t>& keywordDataItemCounts,
const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo, const RigActiveCellInfo* activeCellInfo, const RigActiveCellInfo* fractureActiveCellInfo,
PorosityModelResultType matrixOrFracture, size_t timeStepCount) const PorosityModelResultType porosityModel, size_t timeStepCount) const
{ {
CVF_ASSERT(activeCellInfo); CVF_ASSERT(activeCellInfo);
@ -1574,7 +1577,7 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
return QStringList(); return QStringList();
} }
if (matrixOrFracture == RifReaderInterface::FRACTURE_RESULTS) if (porosityModel == RifReaderInterface::FRACTURE_RESULTS)
{ {
if (fractureActiveCellInfo->reservoirActiveCellCount() == 0) if (fractureActiveCellInfo->reservoirActiveCellCount() == 0)
{ {
@ -1590,43 +1593,47 @@ QStringList RifReaderEclipseOutput::validKeywordsForPorosityModel(const QStringL
if (activeCellInfo->reservoirActiveCellCount() > 0) if (activeCellInfo->reservoirActiveCellCount() > 0)
{ {
if (keywordDataItemCounts[i] < activeCellInfo->reservoirActiveCellCount()) continue;
size_t timeStepsAllCellsRest = keywordDataItemCounts[i] % activeCellInfo->reservoirCellCount(); size_t timeStepsAllCellsRest = keywordDataItemCounts[i] % activeCellInfo->reservoirCellCount();
size_t timeStepsMatrix = keywordDataItemCounts[i] / activeCellInfo->reservoirActiveCellCount();
size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->reservoirActiveCellCount(); size_t timeStepsMatrixRest = keywordDataItemCounts[i] % activeCellInfo->reservoirActiveCellCount();
size_t timeStepsMatrixAndFracture = keywordDataItemCounts[i] / (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount());
size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount()); size_t timeStepsMatrixAndFractureRest = keywordDataItemCounts[i] % (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount());
if (matrixOrFracture == RifReaderInterface::MATRIX_RESULTS) if (timeStepsAllCellsRest == 0)
{ {
if (timeStepsMatrixRest == 0 || timeStepsMatrixAndFractureRest == 0) if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirCellCount())
{ {
if (timeStepCount == timeStepsMatrix || timeStepCount == timeStepsMatrixAndFracture) continue;
{
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
}
}
else if (timeStepsAllCellsRest == 0)
{
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
else else if (porosityModel == RifReaderInterface::MATRIX_RESULTS && timeStepsMatrixRest == 0)
{ {
if (timeStepsMatrixAndFractureRest == 0 && timeStepCount == timeStepsMatrixAndFracture) if (keywordDataItemCounts[i] > timeStepCount * activeCellInfo->reservoirActiveCellCount())
{ {
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]); continue;
} }
else if (timeStepsAllCellsRest == 0)
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
}
else if (porosityModel == RifReaderInterface::FRACTURE_RESULTS && timeStepsMatrixAndFractureRest == 0)
{
if (keywordDataItemCounts[i] > timeStepCount * (activeCellInfo->reservoirActiveCellCount() + fractureActiveCellInfo->reservoirActiveCellCount()))
{ {
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]); continue;
} }
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
} }
else else
{ {
if (keywordDataItemCounts[i] > activeCellInfo->reservoirCellCount())
{
continue;
}
keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]); keywordsWithCorrectNumberOfDataItems.push_back(keywords[i]);
} }
} }

View File

@ -19,23 +19,26 @@
#include "RivGeoMechVizLogic.h" #include "RivGeoMechVizLogic.h"
#include "RimGeoMechView.h"
#include "cvfModelBasicList.h"
#include "RimGeoMechCellColors.h"
#include "RivGeoMechPartMgrCache.h"
#include "RivGeoMechPartMgr.h"
#include "RivReservoirViewPartMgr.h"
#include "RimGeoMechCase.h"
#include "RigFemPartCollection.h" #include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h" #include "RigGeoMechCaseData.h"
#include "RimCellRangeFilterCollection.h" #include "RimCellRangeFilterCollection.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechPropertyFilterCollection.h"
#include "RimGeoMechView.h"
#include "RimView.h"
#include "RimViewController.h"
#include "RivCellSetEnum.h" #include "RivCellSetEnum.h"
#include "RivFemElmVisibilityCalculator.h" #include "RivFemElmVisibilityCalculator.h"
#include "RigFemPartResultsCollection.h" #include "RivGeoMechPartMgr.h"
#include "RimGeoMechPropertyFilterCollection.h" #include "RivGeoMechPartMgrCache.h"
#include "RimView.h" #include "RivReservoirViewPartMgr.h"
#include "RimViewController.h"
#include "cvfModelBasicList.h"
#include "cvfStructGridGeometryGenerator.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -26,15 +26,18 @@
#include "RigGridBase.h" #include "RigGridBase.h"
#include "RigResultAccessor.h" #include "RigResultAccessor.h"
#include "RigResultAccessorFactory.h" #include "RigResultAccessorFactory.h"
#include "RimEclipseCase.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimEclipseView.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimTernaryLegendConfig.h" #include "RimEclipseView.h"
#include "RimEclipseWellCollection.h" #include "RimEclipseWellCollection.h"
#include "RimTernaryLegendConfig.h"
#include "RivTernaryTextureCoordsCreator.h" #include "RivTernaryTextureCoordsCreator.h"
#include "cvfDrawableGeo.h" #include "cvfDrawableGeo.h"
#include "cvfScalarMapper.h"
#include "cvfVertexAttribute.h" #include "cvfVertexAttribute.h"
@ -48,6 +51,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper, const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, cvf::DrawableGeo* geo,
size_t gridIndex, size_t gridIndex,
bool useDefaultValueForHugeVals,
float opacityLevel) float opacityLevel)
{ {
RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData();
@ -114,9 +118,13 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
{ {
float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color float cellColorTextureCoord = 0.5f; // If no results exists, the texture will have a special color
if (scalarValue != HUGE_VAL) if (useDefaultValueForHugeVals || scalarValue != HUGE_VAL)
{ {
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0]; if (scalarValue != HUGE_VAL)
{
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
}
// If we are dealing with wellcells, the default is transparent. // If we are dealing with wellcells, the default is transparent.
// we need to make cells opaque if there are no wellpipe through them. // we need to make cells opaque if there are no wellpipe through them.
if (opacityLevel < 1.0f) if (opacityLevel < 1.0f)

View File

@ -44,6 +44,7 @@ public:
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper, const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, cvf::DrawableGeo* geo,
size_t gridIndex, size_t gridIndex,
bool useDefaultValueForHugeVals,
float opacityLevel); float opacityLevel);
static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex, static void addTernaryCellEdgeResultsToDrawableGeo(size_t timeStepIndex,

View File

@ -19,20 +19,24 @@
#include "RivReservoirFaultsPartMgr.h" #include "RivReservoirFaultsPartMgr.h"
#include "cvfPart.h" #include "RigCaseData.h"
#include "cvfModelBasicList.h" #include "RigMainGrid.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimFaultCollection.h"
#include "RivFaultPartMgr.h"
#include "cvfColor3.h" #include "cvfColor3.h"
#include "cvfModelBasicList.h"
#include "cvfPart.h"
#include "cvfTransform.h" #include "cvfTransform.h"
#include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfColor.h"
#include "RigMainGrid.h"
#include "RimFaultCollection.h"
#include "RimEclipseFaultColors.h"
#include "RimEclipseView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseCase.h"
#include "RigCaseData.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@ -20,19 +20,23 @@
#pragma once #pragma once
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfArray.h"
#include "cvfCollection.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "RigGridBase.h" #include "cafPdmPointer.h"
#include "RivFaultPartMgr.h"
namespace cvf namespace cvf
{ {
class Transform; class Transform;
class ModelBasicList;
} }
class RimEclipseCellColors; class RimEclipseCellColors;
class RimCellEdgeColors; class RimCellEdgeColors;
class RimEclipseView; class RimEclipseView;
class RivFaultPartMgr;
class RigMainGrid;
//================================================================================================== //==================================================================================================
/// ///

View File

@ -20,12 +20,13 @@
#include "RivReservoirPartMgr.h" #include "RivReservoirPartMgr.h"
#include "RigCaseData.h"
#include "RivGridPartMgr.h"
#include "RivReservoirFaultsPartMgr.h"
#include "cvfStructGrid.h" #include "cvfStructGrid.h"
#include "cvfModelBasicList.h" #include "cvfModelBasicList.h"
#include "RigCaseData.h"
#include "RivGridPartMgr.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -24,9 +24,6 @@
#include "cvfArray.h" #include "cvfArray.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include "RivGridPartMgr.h"
#include "RivReservoirFaultsPartMgr.h"
namespace cvf namespace cvf
{ {
class ModelBasicList; class ModelBasicList;
@ -37,6 +34,8 @@ class RimEclipseCellColors;
class RimCellEdgeColors; class RimCellEdgeColors;
class RigCaseData; class RigCaseData;
class RimEclipseView; class RimEclipseView;
class RivReservoirFaultsPartMgr;
class RivGridPartMgr;
//================================================================================================== //==================================================================================================
/// ///

View File

@ -22,25 +22,26 @@
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RigCaseToCaseCellMapper.h"
#include "RigGridBase.h" #include "RigGridBase.h"
#include "RigResultAccessorFactory.h" #include "RigResultAccessorFactory.h"
#include "Rim3dOverlayInfoConfig.h" #include "Rim3dOverlayInfoConfig.h"
#include "RimEclipseCase.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimCellRangeFilterCollection.h" #include "RimCellRangeFilterCollection.h"
#include "RimEclipseCase.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h" #include "RimFaultCollection.h"
#include "RimReservoirCellResultsStorage.h" #include "RimReservoirCellResultsStorage.h"
#include "RimEclipseView.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseWellCollection.h"
#include "RivGridPartMgr.h"
#include "RimViewController.h" #include "RimViewController.h"
#include "RimViewLinker.h" #include "RimViewLinker.h"
#include "RigCaseToCaseCellMapper.h"
#include "RivGridPartMgr.h"
#include "RivReservoirFaultsPartMgr.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -952,19 +953,22 @@ void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::Model
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes) const RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes, bool showFaultsOutsideFilters) const
{ {
bool hasInactive = false; bool hasInactive = false;
for (size_t i = 0; i < geometryTypes.size(); i++) for (size_t i = 0; i < geometryTypes.size(); i++)
{ {
if (geometryTypes[i] == PROPERTY_FILTERED) if (!showFaultsOutsideFilters)
{ {
return PROPERTY_FILTERED; if (geometryTypes[i] == PROPERTY_FILTERED)
} {
return PROPERTY_FILTERED;
}
if (geometryTypes[i] == RANGE_FILTERED) if (geometryTypes[i] == RANGE_FILTERED)
{ {
return RANGE_FILTERED; return RANGE_FILTERED;
}
} }
if (geometryTypes[i] == INACTIVE) if (geometryTypes[i] == INACTIVE)

View File

@ -19,18 +19,29 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "RivReservoirPartMgr.h"
#include "cvfTransform.h" #include "RivCellSetEnum.h"
#include "RivReservoirPartMgr.h" // Must include here because of caf::FixedArray<RivReservoirPartMgr, PROPERTY_FILTERED>
#include "cafFixedArray.h" #include "cafFixedArray.h"
#include "cvfArray.h" #include "cvfArray.h"
#include "cvfBase.h"
#include "cvfTransform.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "RivCellSetEnum.h"
class RimEclipseView; class RimEclipseView;
class RigGridBase; class RigGridBase;
class RimCellRangeFilterCollection; class RimCellRangeFilterCollection;
class RimEclipsePropertyFilterCollection; class RimEclipsePropertyFilterCollection;
class RigActiveCellInfo; class RigActiveCellInfo;
class RimEclipseCellColors;
class RimCellEdgeColors;
namespace cvf
{
class ModelBasicList;
}
class RivReservoirViewPartMgr: public cvf::Object class RivReservoirViewPartMgr: public cvf::Object
{ {
@ -64,7 +75,7 @@ public:
RimCellEdgeColors* cellEdgeResultColors); RimCellEdgeColors* cellEdgeResultColors);
// Fault labels // Fault labels
RivCellSetEnum geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes) const; RivCellSetEnum geometryTypeForFaultLabels(const std::vector<RivCellSetEnum>& geometryTypes, bool showFaultsOutsideFilters) const;
void appendFaultLabelsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType); void appendFaultLabelsStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType);
void appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex); void appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex);

View File

@ -90,11 +90,22 @@ cvf::ref<cvf::Effect> RivScalarMapperUtils::createCellEdgeEffect(cvf::DrawableGe
} }
else else
{ {
RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors, bool useDefaultValueForHugeVals = false;
quadToCellFaceMapper, dg, gridIndex, opacityLevel); if (!cellResultColors->hasResult())
{
useDefaultValueForHugeVals = true;
}
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper(); RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultColors, cellEdgeResultColors,
cellFaceEffectGen.setScalarMapper(cellScalarMapper); quadToCellFaceMapper, dg, gridIndex, useDefaultValueForHugeVals, opacityLevel);
if (cellResultColors->hasResult())
{
// If no scalar mapper is set for the effect, a default color is used to fill the texture
// This is what we want when the fault colors should be visible in combination with cell edge
cvf::ScalarMapper* cellScalarMapper = cellResultColors->legendConfig()->scalarMapper();
cellFaceEffectGen.setScalarMapper(cellScalarMapper);
}
} }
cellFaceEffectGen.setOpacityLevel(opacityLevel); cellFaceEffectGen.setOpacityLevel(opacityLevel);

View File

@ -84,14 +84,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewWellLogPlotFeature"; commandIds << "RicNewWellLogPlotFeature";
commandIds << "RicNewSummaryPlotFeature"; commandIds << "RicNewSummaryPlotFeature";
} }
else if (uiItems.size() > 1)
{
caf::PdmUiItem* uiItem = uiItems[0];
if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
{
commandIds << "RicAddWellLogToPlotFeature";
}
}
else if (uiItems.size() == 1) else if (uiItems.size() == 1)
{ {
caf::PdmUiItem* uiItem = uiItems[0]; caf::PdmUiItem* uiItem = uiItems[0];
@ -130,7 +122,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewViewFeature"; commandIds << "RicNewViewFeature";
commandIds << "RicComputeStatisticsFeature"; commandIds << "RicComputeStatisticsFeature";
commandIds << "RicCloseCaseFeature"; commandIds << "RicCloseCaseFeature";
commandIds << "RicExecuteScriptForCasesFeature";
} }
else if (dynamic_cast<RimEclipseCase*>(uiItem)) else if (dynamic_cast<RimEclipseCase*>(uiItem))
{ {
@ -142,7 +133,6 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicCloseCaseFeature"; commandIds << "RicCloseCaseFeature";
commandIds << "RicNewViewFeature"; commandIds << "RicNewViewFeature";
commandIds << "RicEclipseCaseNewGroupFeature"; commandIds << "RicEclipseCaseNewGroupFeature";
commandIds << "RicExecuteScriptForCasesFeature";
} }
else if (dynamic_cast<RimGeoMechCase*>(uiItem)) else if (dynamic_cast<RimGeoMechCase*>(uiItem))
{ {
@ -233,6 +223,9 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{ {
commandIds << "RicAddScriptPathFeature"; commandIds << "RicAddScriptPathFeature";
commandIds << "RicDeleteScriptPathFeature"; commandIds << "RicDeleteScriptPathFeature";
commandIds << "RicNewScriptFeature";
commandIds << "Separator";
commandIds << "RicRefreshScriptsFeature";
} }
else if (dynamic_cast<RimViewController*>(uiItem)) else if (dynamic_cast<RimViewController*>(uiItem))
{ {
@ -328,6 +321,24 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
} }
} }
// Command supporting multiple selected objects
if (uiItems.size() > 0)
{
caf::PdmUiItem* uiItem = uiItems[0];
if (dynamic_cast<RimWellLogFileChannel*>(uiItem))
{
commandIds << "RicAddWellLogToPlotFeature";
}
else if (dynamic_cast<RimEclipseStatisticsCase*>(uiItem))
{
commandIds << "RicExecuteScriptForCasesFeature";
}
else if (dynamic_cast<RimEclipseCase*>(uiItem))
{
commandIds << "RicExecuteScriptForCasesFeature";
}
}
if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable()) if (RicToggleItemsFeatureImpl::isToggleCommandsAvailable())
{ {
commandIds << "Separator"; commandIds << "Separator";

View File

@ -20,10 +20,13 @@
#include "RimCrossSectionCollection.h" #include "RimCrossSectionCollection.h"
#include "RimCrossSection.h" #include "RimCrossSection.h"
#include "RivCrossSectionPartMgr.h" #include "RimEclipseWell.h"
#include "RiuMainWindow.h"
#include "RimView.h" #include "RimView.h"
#include "RiuMainWindow.h"
#include "RivCrossSectionPartMgr.h"
CAF_PDM_SOURCE_INIT(RimCrossSectionCollection, "CrossSectionCollection"); CAF_PDM_SOURCE_INIT(RimCrossSectionCollection, "CrossSectionCollection");
@ -143,3 +146,25 @@ void RimCrossSectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* chan
} }
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimCrossSectionCollection::hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const
{
if (!isActive) return false;
for (size_t csIdx = 0; csIdx < m_crossSections.size(); ++csIdx)
{
RimCrossSection* cs = m_crossSections[csIdx];
if (cs->isActive &&
cs->type() == RimCrossSection::CS_SIMULATION_WELL &&
cs->simulationWell() == eclipseWell)
{
return true;
}
}
return false;
}

View File

@ -25,6 +25,7 @@
class RimCrossSection; class RimCrossSection;
class RimEclipseCellColors; class RimEclipseCellColors;
class RimEclipseWell;
namespace cvf { namespace cvf {
class ModelBasicList; class ModelBasicList;
@ -48,6 +49,7 @@ public:
void appendCrossSection(RimCrossSection* crossSection); void appendCrossSection(RimCrossSection* crossSection);
bool hasActiveCrossSectionForSimulationWell(RimEclipseWell* eclipseWell) const;
// Visualization interface // Visualization interface

View File

@ -407,7 +407,7 @@ void RimEclipseView::createDisplayModel()
std::vector<RivCellSetEnum> faultGeometryTypesToAppend = visibleFaultGeometryTypes(); std::vector<RivCellSetEnum> faultGeometryTypesToAppend = visibleFaultGeometryTypes();
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend); RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->showFaultsOutsideFilters());
for (size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx) for (size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
{ {
@ -535,7 +535,7 @@ void RimEclipseView::updateCurrentTimeStep()
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), faultGeometryTypesToAppend[i]); m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), faultGeometryTypesToAppend[i]);
} }
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend); RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->showFaultsOutsideFilters());
m_reservoirGridPartManager->appendFaultLabelsStaticGeometryPartsToModel(frameParts.p(), faultLabelType); m_reservoirGridPartManager->appendFaultLabelsStaticGeometryPartsToModel(frameParts.p(), faultLabelType);
} }
else else

View File

@ -20,6 +20,7 @@
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RimCrossSectionCollection.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimEclipseWellCollection.h" #include "RimEclipseWellCollection.h"
@ -179,6 +180,9 @@ bool RimEclipseWell::calculateWellPipeVisibility(size_t frameIndex)
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY) if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_INDIVIDUALLY)
return true; return true;
if (m_reservoirView->crossSectionCollection()->hasActiveCrossSectionForSimulationWell(this))
return true;
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS) if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimEclipseWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
{ {
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts(); const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();

View File

@ -21,12 +21,17 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiaPreferences.h" #include "RiaPreferences.h"
#include "RigCaseData.h" #include "RigCaseData.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseView.h"
#include "RimFault.h"
#include "RimNoCommonAreaNNC.h" #include "RimNoCommonAreaNNC.h"
#include "RimNoCommonAreaNncCollection.h" #include "RimNoCommonAreaNncCollection.h"
#include "RimEclipseView.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RivColorTableArray.h" #include "RivColorTableArray.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"

View File

@ -180,6 +180,10 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
RigCaseData* rigCaseData = mainCase->reservoirData(); RigCaseData* rigCaseData = mainCase->reservoirData();
CVF_ASSERT(rigCaseData); CVF_ASSERT(rigCaseData);
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
mainCase->results(poroModel)->cellResults()->createPlaceholderResultEntries();
// Action A : Read active cell info // Action A : Read active cell info
// Read active cell info from all source cases. The file access is optimized for this purpose, and result meta data // Read active cell info from all source cases. The file access is optimized for this purpose, and result meta data
// is copied from main case to all other cases (see "Action B") // is copied from main case to all other cases (see "Action B")
@ -245,11 +249,15 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
RimDefines::ResultCatType resultType = resultInfos[resIdx].m_resultType; RimDefines::ResultCatType resultType = resultInfos[resIdx].m_resultType;
QString resultName = resultInfos[resIdx].m_resultName; QString resultName = resultInfos[resIdx].m_resultName;
bool needsToBeStored = resultInfos[resIdx].m_needsToBeStored; bool needsToBeStored = resultInfos[resIdx].m_needsToBeStored;
bool mustBeCalculated = resultInfos[resIdx].m_mustBeCalculated;
size_t scalarResultIndex = cellResultsStorage->cellResults()->findScalarResultIndex(resultType, resultName); size_t scalarResultIndex = cellResultsStorage->cellResults()->findScalarResultIndex(resultType, resultName);
if (scalarResultIndex == cvf::UNDEFINED_SIZE_T) if (scalarResultIndex == cvf::UNDEFINED_SIZE_T)
{ {
size_t scalarResultIndex = cellResultsStorage->cellResults()->addEmptyScalarResult(resultType, resultName, needsToBeStored); size_t scalarResultIndex = cellResultsStorage->cellResults()->addEmptyScalarResult(resultType, resultName, needsToBeStored);
if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates); cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex); std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex);

View File

@ -484,6 +484,15 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible(size_t i, size_t j, size_t k
return true; return true;
} }
// Do not show cell geometry if a fault is present to avoid z fighting between surfaces
// It will always be a better solution to avoid geometry creation instead of part priority and polygon offset
size_t nativeResvCellIndex = m_grid->reservoirCellIndex(cellIndex);
const RigFault* fault = m_grid->mainGrid()->findFaultFromCellIndexAndCellFace(nativeResvCellIndex, face);
if (fault)
{
return false;
}
// If the neighbour cell is invisible, we need to draw the face // If the neighbour cell is invisible, we need to draw the face
if ((cellVisibility != NULL) && !(*cellVisibility)[neighborCellIndex]) if ((cellVisibility != NULL) && !(*cellVisibility)[neighborCellIndex])
{ {

View File

@ -57,6 +57,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
if (uiResultName == RimDefines::combinedTransmissibilityResultName()) if (uiResultName == RimDefines::combinedTransmissibilityResultName())
{ {
CVF_ASSERT(timeStepIndex == 0); // Static result, only data for first time step
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid); cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX"); cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "TRANX");
@ -69,6 +71,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
} }
else if (uiResultName == RimDefines::combinedMultResultName()) else if (uiResultName == RimDefines::combinedMultResultName())
{ {
CVF_ASSERT(timeStepIndex == 0); // Static result, only data for first time step
cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor(grid); cvf::ref<RigCombMultResultAccessor> cellFaceAccessObject = new RigCombMultResultAccessor(grid);
cvf::ref<RigResultAccessor> multXPos = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "MULTX"); cvf::ref<RigResultAccessor> multXPos = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, "MULTX");
@ -84,6 +88,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
} }
else if (uiResultName == RimDefines::combinedRiTranResultName()) else if (uiResultName == RimDefines::combinedRiTranResultName())
{ {
CVF_ASSERT(timeStepIndex == 0); // Static result, only data for first time step
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid); cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riTranXResultName()); cvf::ref<RigResultAccessor> xTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riTranXResultName());
@ -96,6 +102,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
} }
else if (uiResultName == RimDefines::combinedRiMultResultName()) else if (uiResultName == RimDefines::combinedRiMultResultName())
{ {
CVF_ASSERT(timeStepIndex == 0); // Static result, only data for first time step
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid); cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
cvf::ref<RigResultAccessor> xRiMultAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riMultXResultName()); cvf::ref<RigResultAccessor> xRiMultAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riMultXResultName());
@ -108,6 +116,8 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
} }
else if (uiResultName == RimDefines::combinedRiAreaNormTranResultName()) else if (uiResultName == RimDefines::combinedRiAreaNormTranResultName())
{ {
CVF_ASSERT(timeStepIndex == 0); // Static result, only data for first time step
cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid); cvf::ref<RigCombTransResultAccessor> cellFaceAccessObject = new RigCombTransResultAccessor(grid);
cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riAreaNormTranXResultName()); cvf::ref<RigResultAccessor> xRiAreaNormTransAccessor = RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, RimDefines::riAreaNormTranXResultName());
@ -118,6 +128,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createResultAccessor(RigCa
return cellFaceAccessObject; return cellFaceAccessObject;
} }
return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName); return RigResultAccessorFactory::createNativeResultAccessor(eclipseCase, gridIndex, porosityModel, timeStepIndex, uiResultName);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

View File

@ -56,6 +56,7 @@
<file>WellLogCurve16x16.png</file> <file>WellLogCurve16x16.png</file>
<file>CrossSection16x16.png</file> <file>CrossSection16x16.png</file>
<file>CrossSections16x16.png</file> <file>CrossSections16x16.png</file>
<file>Refresh-32.png</file>
<file>SummaryPlot16x16.png</file> <file>SummaryPlot16x16.png</file>
<file>SummaryPlots16x16.png</file> <file>SummaryPlots16x16.png</file>
<file>SummaryCurve16x16.png</file> <file>SummaryCurve16x16.png</file>

View File

@ -30,6 +30,90 @@
#include "RifEclipseUnifiedRestartFileAccess.h" #include "RifEclipseUnifiedRestartFileAccess.h"
#include "RifReaderSettings.h" #include "RifReaderSettings.h"
#include <QDebug>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST(RigReservoirTest, BasicTest)
{
RifEclipseUnifiedRestartFileAccess unrstAccess;
QStringList filenames;
//filenames << "d:/Models/Statoil/testcase_juli_2011/data/TEST10K_FLT_LGR_NNC.UNRST";
filenames << "d:/Models/MRST/simple/SIMPLE.UNRST";
unrstAccess.setRestartFiles(filenames);
QStringList resultNames;
std::vector<size_t> dataItemCount;
unrstAccess.resultNames(&resultNames, &dataItemCount);
for (size_t i = 0; i < resultNames.size(); i++)
{
qDebug() << resultNames[i] << "\t" << dataItemCount[i];
}
auto reportNums = unrstAccess.reportNumbers();
for (auto reportNum : reportNums)
{
qDebug() << reportNum;
}
/*
cvf::ref<RifReaderEclipseOutput> readerInterfaceEcl = new RifReaderEclipseOutput;
cvf::ref<RigCaseData> reservoir = new RigCaseData;
// 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());
}
*/
}
#if 0 #if 0

View File

@ -175,11 +175,10 @@ void RiuMainWindow::initializeGuiNewProjectLoaded()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuMainWindow::cleanupGuiBeforeProjectClose() void RiuMainWindow::cleanupGuiCaseClose()
{ {
caf::CmdExecCommandManager::instance()->undoStack()->clear(); caf::CmdExecCommandManager::instance()->undoStack()->clear();
setPdmRoot(NULL);
setResultInfo(""); setResultInfo("");
m_resultQwtPlot->deleteAllCurves(); m_resultQwtPlot->deleteAllCurves();
@ -200,6 +199,16 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
m_processMonitor->startMonitorWorkProcess(NULL); m_processMonitor->startMonitorWorkProcess(NULL);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::cleanupGuiBeforeProjectClose()
{
setPdmRoot(NULL);
cleanupGuiCaseClose();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -79,6 +79,7 @@ public:
virtual QString mainWindowName() { return "RiuMainWindow"; } virtual QString mainWindowName() { return "RiuMainWindow"; }
void initializeGuiNewProjectLoaded(); void initializeGuiNewProjectLoaded();
void cleanupGuiCaseClose();
void cleanupGuiBeforeProjectClose(); void cleanupGuiBeforeProjectClose();
void removeViewer( QWidget* viewer ); void removeViewer( QWidget* viewer );

View File

@ -113,6 +113,12 @@ void RiuMultiCaseImportDialog::on_m_addSearchFolderButton_clicked()
} }
RiaApplication::instance()->setDefaultFileDialogDirectory("MULTICASEIMPORT", selectedFolder); RiaApplication::instance()->setDefaultFileDialogDirectory("MULTICASEIMPORT", selectedFolder);
QPushButton* okButton = ui->m_dialogButtons->button(QDialogButtonBox::Ok);
if (okButton)
{
okButton->setFocus(Qt::OtherFocusReason);
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -623,7 +623,13 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
} }
else else
{ {
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, resultVar); size_t adjustedTimeStep = m_timeStepIndex;
if (resultColors->hasStaticResult())
{
adjustedTimeStep = 0;
}
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(eclipseCaseData, m_gridIndex, porosityModel, adjustedTimeStep, resultVar);
if (resultAccessor.notNull()) if (resultAccessor.notNull())
{ {
double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face); double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face);

View File

@ -101,17 +101,20 @@ bool RiuTreeViewEventFilter::eventFilter(QObject *obj, QEvent *event)
return true; return true;
} }
switch (keyEvent->key()) if (!RiuMainWindow::instance()->projectTreeView()->isTreeItemEditWidgetActive())
{ {
case Qt::Key_Space: switch (keyEvent->key())
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Select:
{ {
RicToggleItemsFeatureImpl::setObjectToggleStateForSelection(RicToggleItemsFeatureImpl::TOGGLE); case Qt::Key_Space:
case Qt::Key_Enter:
case Qt::Key_Return:
case Qt::Key_Select:
{
RicToggleItemsFeatureImpl::setObjectToggleStateForSelection(RicToggleItemsFeatureImpl::TOGGLE);
keyEvent->setAccepted(true); keyEvent->setAccepted(true);
return true; return true;
}
} }
} }
} }

View File

@ -39,6 +39,7 @@
#include "RimEclipseFaultColors.h" #include "RimEclipseFaultColors.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimEclipseWell.h" #include "RimEclipseWell.h"
#include "RimFault.h"
#include "RimFaultCollection.h" #include "RimFaultCollection.h"
#include "RimGeoMechCase.h" #include "RimGeoMechCase.h"
#include "RimGeoMechCellColors.h" #include "RimGeoMechCellColors.h"

View File

@ -107,6 +107,14 @@ QTreeView* PdmUiTreeView::treeView()
return m_treeViewEditor->treeView(); return m_treeViewEditor->treeView();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool PdmUiTreeView::isTreeItemEditWidgetActive() const
{
return m_treeViewEditor->isTreeItemEditWidgetActive();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -72,6 +72,7 @@ public:
void setPdmItem(caf::PdmUiItem* object); void setPdmItem(caf::PdmUiItem* object);
QTreeView* treeView(); QTreeView* treeView();
bool isTreeItemEditWidgetActive() const;
void selectedUiItems(std::vector<PdmUiItem*>& objects); // TODO: rename void selectedUiItems(std::vector<PdmUiItem*>& objects); // TODO: rename
void selectAsCurrentItem(PdmUiItem* uiItem); void selectAsCurrentItem(PdmUiItem* uiItem);

View File

@ -67,6 +67,11 @@ public:
PdmUiTreeViewWidget(QWidget* parent = 0) : QTreeView(parent) {}; PdmUiTreeViewWidget(QWidget* parent = 0) : QTreeView(parent) {};
virtual ~PdmUiTreeViewWidget() {}; virtual ~PdmUiTreeViewWidget() {};
bool isTreeItemEditWidgetActive() const
{
return state() == QAbstractItemView::EditingState;
}
protected: protected:
virtual void dragMoveEvent(QDragMoveEvent* event) virtual void dragMoveEvent(QDragMoveEvent* event)
{ {
@ -162,6 +167,14 @@ QTreeView* PdmUiTreeViewEditor::treeView()
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool PdmUiTreeViewEditor::isTreeItemEditWidgetActive() const
{
return m_treeView->isTreeItemEditWidgetActive();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -58,10 +58,11 @@ class QVBoxLayout;
namespace caf namespace caf
{ {
class PdmUiItem;
class PdmUiTreeViewModel;
class PdmChildArrayFieldHandle; class PdmChildArrayFieldHandle;
class PdmUiDragDropInterface; class PdmUiDragDropInterface;
class PdmUiItem;
class PdmUiTreeViewModel;
class PdmUiTreeViewWidget;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -94,6 +95,7 @@ public:
bool isAppendOfClassNameToUiItemTextEnabled(); bool isAppendOfClassNameToUiItemTextEnabled();
QTreeView* treeView(); QTreeView* treeView();
bool isTreeItemEditWidgetActive() const;
void selectAsCurrentItem(PdmUiItem* uiItem); void selectAsCurrentItem(PdmUiItem* uiItem);
void selectedUiItems(std::vector<PdmUiItem*>& objects); void selectedUiItems(std::vector<PdmUiItem*>& objects);
@ -133,7 +135,7 @@ private:
QPointer<QWidget> m_mainWidget; QPointer<QWidget> m_mainWidget;
QVBoxLayout* m_layout; QVBoxLayout* m_layout;
QTreeView* m_treeView; PdmUiTreeViewWidget* m_treeView;
PdmUiTreeViewModel* m_treeViewModel; PdmUiTreeViewModel* m_treeViewModel;
PdmUiTreeViewEditorAttribute m_editorAttributes; PdmUiTreeViewEditorAttribute m_editorAttributes;